From 28e2f11003653f91ee9a5d0ba475cfceb971c2de Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Juan=20Mart=C3=ADn=20Sotuyo=20Dodero?= Date: Fri, 11 Nov 2016 20:07:22 -0300 Subject: [PATCH] Avoid creating a new String to qualify types - This is now slightly faster, which for a method that gets called over 1 million times on large projects is significant. - We should still look for ways to reduce the number of calls to this method. --- .../net/sourceforge/pmd/lang/java/symboltable/ClassScope.java | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/pmd-java/src/main/java/net/sourceforge/pmd/lang/java/symboltable/ClassScope.java b/pmd-java/src/main/java/net/sourceforge/pmd/lang/java/symboltable/ClassScope.java index 47870c87a9..b6c379d91d 100644 --- a/pmd-java/src/main/java/net/sourceforge/pmd/lang/java/symboltable/ClassScope.java +++ b/pmd-java/src/main/java/net/sourceforge/pmd/lang/java/symboltable/ClassScope.java @@ -341,7 +341,7 @@ public class ClassScope extends AbstractJavaScope { for (String qualified : qualifiedNames) { int fullLength = qualified.length(); if (qualified.endsWith(typeImage) - && (fullLength == nameLength || qualified.substring(0, fullLength - nameLength).endsWith("."))) { + && (fullLength == nameLength || qualified.charAt(fullLength - nameLength - 1) == '.')) { return qualified; } }