1
0
Fork 0
mirror of https://github.com/eclipse-cdt/cdt synced 2025-06-07 01:36:01 +02:00

Bug 491984 - Optimise toString().isEmpty() checks

The use of toString().toEmpty() is a potential code smell, and has
identified a couple of places where this pattern could be optimised.

Change-Id: I1a37e62ed8546a48151a494e9f24fea46d9d2497
Signed-off-by: Alex Blewitt <alex.blewitt@gmail.com>
This commit is contained in:
Alex Blewitt 2016-04-20 22:23:26 +01:00 committed by Gerrit Code Review @ Eclipse.org
parent 6e98f402bd
commit b23de2f366
2 changed files with 4 additions and 4 deletions

View file

@ -314,7 +314,7 @@ public class AutoconfTextHover implements ITextHover, ITextHoverExtension {
NamedNodeMap parms = v.getAttributes(); NamedNodeMap parms = v.getAttributes();
Node parmNode = parms.item(0); Node parmNode = parms.item(0);
String parm = parmNode.getNodeValue(); String parm = parmNode.getNodeValue();
if (prototype.toString().isEmpty()) if (prototype.length() == 0)
prototype.append(parm); prototype.append(parm);
else else
prototype.append(", " + parm); prototype.append(", " + parm);

View file

@ -1249,9 +1249,9 @@ public class GnuMakefileGenerator implements IManagedBuilderMakefileGenerator2 {
// Add includes for each subdir in child-subdir-first order (required for makefile rule matching to work). // Add includes for each subdir in child-subdir-first order (required for makefile rule matching to work).
List<String> subDirList = new ArrayList<String>(); List<String> subDirList = new ArrayList<String>();
for (IContainer subDir : getSubdirList()) { for (IContainer subDir : getSubdirList()) {
IPath projectRelativePath = subDir.getProjectRelativePath(); String projectRelativePath = subDir.getProjectRelativePath().toString();
if(!projectRelativePath.toString().isEmpty()) if(!projectRelativePath.isEmpty())
subDirList.add(0, projectRelativePath.toString()); subDirList.add(0, projectRelativePath);
} }
Collections.sort(subDirList, Collections.reverseOrder()); Collections.sort(subDirList, Collections.reverseOrder());
for (String dir : subDirList) { for (String dir : subDirList) {