Skip to main content
summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorAlex Blewitt2016-04-19 06:35:21 -0400
committerGerrit Code Review @ Eclipse.org2016-04-19 13:35:54 -0400
commit2114f6b108763ff027fe0936e1f7b4d7e9cc655c (patch)
treeafd55872d8d3dae5de15300ef63cc6acffdc6e92 /build/org.eclipse.cdt.autotools.core
parent10ba077124e266fb7cfa661241d044a3ee91e0d3 (diff)
downloadorg.eclipse.cdt-2114f6b108763ff027fe0936e1f7b4d7e9cc655c.tar.gz
org.eclipse.cdt-2114f6b108763ff027fe0936e1f7b4d7e9cc655c.tar.xz
org.eclipse.cdt-2114f6b108763ff027fe0936e1f7b4d7e9cc655c.zip
Bug 491984 - Replace .equals("") with .isEmpty()
In many cases a String's empty status is tested with `.equals("")`. However, Java 1.6 added `.isEmpty()` which can be more efficient since it compares the internal length parameter only for testing. Replace code using the `.isEmpty()` variant instead. Some tests for `"".equals(expr)` can be replaced with `expr.isEmpty()` where it is already known that the `expr` is not null; however, these have to be reviewed on a case-by-case basis. Change-Id: I3c6af4d8b7638e757435914ac76cb3a67899a5fd Signed-off-by: Alex Blewitt <alex.blewitt@gmail.com>
Diffstat (limited to 'build/org.eclipse.cdt.autotools.core')
-rw-r--r--build/org.eclipse.cdt.autotools.core/src/org/eclipse/cdt/internal/autotools/core/AutotoolsNewMakeGenerator.java4
-rw-r--r--build/org.eclipse.cdt.autotools.core/src/org/eclipse/cdt/internal/autotools/core/configure/AutotoolsConfiguration.java6
-rw-r--r--build/org.eclipse.cdt.autotools.core/src/org/eclipse/cdt/internal/autotools/core/configure/AutotoolsOptionValueHandler.java4
-rw-r--r--build/org.eclipse.cdt.autotools.core/src/org/eclipse/cdt/internal/autotools/core/wizards/NewAutotoolsProject.java4
4 files changed, 9 insertions, 9 deletions
diff --git a/build/org.eclipse.cdt.autotools.core/src/org/eclipse/cdt/internal/autotools/core/AutotoolsNewMakeGenerator.java b/build/org.eclipse.cdt.autotools.core/src/org/eclipse/cdt/internal/autotools/core/AutotoolsNewMakeGenerator.java
index c017c0bafb..09f3adf7e3 100644
--- a/build/org.eclipse.cdt.autotools.core/src/org/eclipse/cdt/internal/autotools/core/AutotoolsNewMakeGenerator.java
+++ b/build/org.eclipse.cdt.autotools.core/src/org/eclipse/cdt/internal/autotools/core/AutotoolsNewMakeGenerator.java
@@ -410,7 +410,7 @@ public class AutotoolsNewMakeGenerator extends MarkerGenerator {
if (target == null)
target = AutotoolsPropertyConstants.CLEAN_MAKE_TARGET_DEFAULT;
String args = builder.getBuildArguments();
- if (args != null && !(args = args.trim()).equals("")) { //$NON-NLS-1$
+ if (args != null && !(args = args.trim()).isEmpty()) {
String[] newArgs = makeArray(args);
makeargs = new String[newArgs.length + 1];
System.arraycopy(newArgs, 0, makeargs, 0, newArgs.length);
@@ -460,7 +460,7 @@ public class AutotoolsNewMakeGenerator extends MarkerGenerator {
if (target == null)
target = AutotoolsPropertyConstants.CLEAN_MAKE_TARGET_DEFAULT;
String args = builder.getBuildArguments();
- if (args != null && !(args = args.trim()).equals("")) { //$NON-NLS-1$
+ if (args != null && !(args = args.trim()).isEmpty()) {
String[] newArgs = makeArray(args);
makeargs = new String[newArgs.length + 1];
System.arraycopy(newArgs, 0, makeargs, 0, newArgs.length);
diff --git a/build/org.eclipse.cdt.autotools.core/src/org/eclipse/cdt/internal/autotools/core/configure/AutotoolsConfiguration.java b/build/org.eclipse.cdt.autotools.core/src/org/eclipse/cdt/internal/autotools/core/configure/AutotoolsConfiguration.java
index 5a1b16e07b..42ad8f0f91 100644
--- a/build/org.eclipse.cdt.autotools.core/src/org/eclipse/cdt/internal/autotools/core/configure/AutotoolsConfiguration.java
+++ b/build/org.eclipse.cdt.autotools.core/src/org/eclipse/cdt/internal/autotools/core/configure/AutotoolsConfiguration.java
@@ -1,5 +1,5 @@
/*******************************************************************************
- * Copyright (c) 2009, 2015 Red Hat Inc.
+ * Copyright (c) 2009, 2016 Red Hat Inc.
* All rights reserved. This program and the accompanying materials
* are made available under the terms of the Eclipse Public License v1.0
* which accompanies this distribution, and is available at
@@ -302,12 +302,12 @@ public class AutotoolsConfiguration implements IAConfiguration {
for (int j = 0; j < childOptions.length; ++j) {
IConfigureOption childOption = getOption(childOptions[j].getName());
String parameter = childOption.getParameter();
- if (!parameter.equals(""))
+ if (!parameter.isEmpty())
buf.append(" " + parameter);
}
} else {
String parameter = option.getParameter();
- if (!parameter.equals(""))
+ if (!parameter.isEmpty())
buf.append(" " + parameter);
}
}
diff --git a/build/org.eclipse.cdt.autotools.core/src/org/eclipse/cdt/internal/autotools/core/configure/AutotoolsOptionValueHandler.java b/build/org.eclipse.cdt.autotools.core/src/org/eclipse/cdt/internal/autotools/core/configure/AutotoolsOptionValueHandler.java
index e21bf2b03d..84bc34bd41 100644
--- a/build/org.eclipse.cdt.autotools.core/src/org/eclipse/cdt/internal/autotools/core/configure/AutotoolsOptionValueHandler.java
+++ b/build/org.eclipse.cdt.autotools.core/src/org/eclipse/cdt/internal/autotools/core/configure/AutotoolsOptionValueHandler.java
@@ -1,5 +1,5 @@
/*******************************************************************************
- * Copyright (c) 2007, 2015 Red Hat Inc..
+ * Copyright (c) 2007, 2016 Red Hat Inc..
* All rights reserved. This program and the accompanying materials
* are made available under the terms of the Eclipse Public License v1.0
* which accompanies this distribution, and is available at
@@ -53,7 +53,7 @@ public class AutotoolsOptionValueHandler extends ManagedOptionValueHandler
ICConfigurationDescription cfgd = ManagedBuildManager.getDescriptionForConfiguration(configuration);
if (option.getName().equals("Name") && cfgd != null) {
String cfgId = cfgd.getId();
- if (!value.equals("") && !value.equals(cfgId)) {
+ if (!value.isEmpty() && !value.equals(cfgId)) {
// we have a cloned configuration and we know that the
// clonee's name is the value of the option
IProject project = (IProject)configuration.getManagedProject().getOwner();
diff --git a/build/org.eclipse.cdt.autotools.core/src/org/eclipse/cdt/internal/autotools/core/wizards/NewAutotoolsProject.java b/build/org.eclipse.cdt.autotools.core/src/org/eclipse/cdt/internal/autotools/core/wizards/NewAutotoolsProject.java
index 555e4e361b..2d65334341 100644
--- a/build/org.eclipse.cdt.autotools.core/src/org/eclipse/cdt/internal/autotools/core/wizards/NewAutotoolsProject.java
+++ b/build/org.eclipse.cdt.autotools.core/src/org/eclipse/cdt/internal/autotools/core/wizards/NewAutotoolsProject.java
@@ -1,5 +1,5 @@
/*******************************************************************************
- * Copyright (c) 2007, 2015 Symbian Software Limited and others.
+ * Copyright (c) 2007, 2016 Symbian Software Limited and others.
* All rights reserved. This program and the accompanying materials
* are made available under the terms of the Eclipse Public License v1.0
* which accompanies this distribution, and is available at
@@ -66,7 +66,7 @@ public class NewAutotoolsProject extends ProcessRunner {
turnOffAutoBuild(workspace);
IPath locationPath = null;
- if (location != null && !location.trim().equals("")) { //$NON-NLS-1$
+ if (location != null && !location.trim().isEmpty()) {
locationPath = Path.fromPortableString(location);
}

Back to the top