Skip to main content
aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorAlex Blewitt2016-04-19 10:35:21 +0000
committerGerrit Code Review @ Eclipse.org2016-04-19 17:35:54 +0000
commit2114f6b108763ff027fe0936e1f7b4d7e9cc655c (patch)
treeafd55872d8d3dae5de15300ef63cc6acffdc6e92 /build/org.eclipse.cdt.autotools.ui
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.ui')
-rw-r--r--build/org.eclipse.cdt.autotools.ui/src/org/eclipse/cdt/internal/autotools/ui/properties/AutotoolsBuildPropertyPage.java4
-rw-r--r--build/org.eclipse.cdt.autotools.ui/src/org/eclipse/cdt/internal/autotools/ui/text/hover/AutoconfTextHover.java4
-rw-r--r--build/org.eclipse.cdt.autotools.ui/src/org/eclipse/cdt/internal/autotools/ui/wizards/ConfigurationLabelProvider.java4
3 files changed, 6 insertions, 6 deletions
diff --git a/build/org.eclipse.cdt.autotools.ui/src/org/eclipse/cdt/internal/autotools/ui/properties/AutotoolsBuildPropertyPage.java b/build/org.eclipse.cdt.autotools.ui/src/org/eclipse/cdt/internal/autotools/ui/properties/AutotoolsBuildPropertyPage.java
index c2a4a865d9e..54af1ce7db9 100644
--- a/build/org.eclipse.cdt.autotools.ui/src/org/eclipse/cdt/internal/autotools/ui/properties/AutotoolsBuildPropertyPage.java
+++ b/build/org.eclipse.cdt.autotools.ui/src/org/eclipse/cdt/internal/autotools/ui/properties/AutotoolsBuildPropertyPage.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
@@ -119,7 +119,7 @@ public class AutotoolsBuildPropertyPage extends AbstractCBuildPropertyTab {
});
fCleanMakeTarget.addModifyListener(e -> {
- if (fCleanMakeTarget.getText().equals("")) { // $NON-NLS-1$
+ if (fCleanMakeTarget.getText().isEmpty()) {
// FIXME: should probably issue warning here, but how?
}
});
diff --git a/build/org.eclipse.cdt.autotools.ui/src/org/eclipse/cdt/internal/autotools/ui/text/hover/AutoconfTextHover.java b/build/org.eclipse.cdt.autotools.ui/src/org/eclipse/cdt/internal/autotools/ui/text/hover/AutoconfTextHover.java
index 338c6ded8ba..9aed7224b87 100644
--- a/build/org.eclipse.cdt.autotools.ui/src/org/eclipse/cdt/internal/autotools/ui/text/hover/AutoconfTextHover.java
+++ b/build/org.eclipse.cdt.autotools.ui/src/org/eclipse/cdt/internal/autotools/ui/text/hover/AutoconfTextHover.java
@@ -1,5 +1,5 @@
/*******************************************************************************
- * Copyright (c) 2006, 2015 Red Hat, Inc.
+ * Copyright (c) 2006, 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
@@ -314,7 +314,7 @@ public class AutoconfTextHover implements ITextHover, ITextHoverExtension {
NamedNodeMap parms = v.getAttributes();
Node parmNode = parms.item(0);
String parm = parmNode.getNodeValue();
- if (prototype.toString().equals(""))
+ if (prototype.toString().isEmpty())
prototype.append(parm);
else
prototype.append(", " + parm);
diff --git a/build/org.eclipse.cdt.autotools.ui/src/org/eclipse/cdt/internal/autotools/ui/wizards/ConfigurationLabelProvider.java b/build/org.eclipse.cdt.autotools.ui/src/org/eclipse/cdt/internal/autotools/ui/wizards/ConfigurationLabelProvider.java
index 2f3177c5733..c4b9b50cc69 100644
--- a/build/org.eclipse.cdt.autotools.ui/src/org/eclipse/cdt/internal/autotools/ui/wizards/ConfigurationLabelProvider.java
+++ b/build/org.eclipse.cdt.autotools.ui/src/org/eclipse/cdt/internal/autotools/ui/wizards/ConfigurationLabelProvider.java
@@ -1,5 +1,5 @@
/*******************************************************************************
- * Copyright (c) 2002, 2015 Rational Software Corporation and others.
+ * Copyright (c) 2002, 2016 Rational Software Corporation 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
@@ -29,7 +29,7 @@ public class ConfigurationLabelProvider extends LabelProvider implements ITableL
if (obj instanceof IConfiguration) {
IConfiguration tmpConfig = (IConfiguration) obj;
- if( (tmpConfig.getDescription() == null)|| (tmpConfig.getDescription().equals("")) ) //$NON-NLS-1$
+ if( (tmpConfig.getDescription() == null)|| (tmpConfig.getDescription().isEmpty()) )
return ((IConfiguration) obj).getName();
else
return ( tmpConfig.getName() + " ( " + tmpConfig.getDescription() + " )"); //$NON-NLS-1$ //$NON-NLS-2$

Back to the top