diff options
Diffstat (limited to 'sonar-duplications/src/main/java/net/sourceforge')
3 files changed, 14 insertions, 12 deletions
diff --git a/sonar-duplications/src/main/java/net/sourceforge/pmd/cpd/AbstractLanguage.java b/sonar-duplications/src/main/java/net/sourceforge/pmd/cpd/AbstractLanguage.java index e3927589e67..7237e68d2e1 100644 --- a/sonar-duplications/src/main/java/net/sourceforge/pmd/cpd/AbstractLanguage.java +++ b/sonar-duplications/src/main/java/net/sourceforge/pmd/cpd/AbstractLanguage.java @@ -35,6 +35,7 @@ public abstract class AbstractLanguage implements Language { /** * @deprecated in 2.14, seems that not used in Sonar ecosystem - we don't scan directories. */ + @Deprecated public FilenameFilter getFileFilter() { return fileFilter; } diff --git a/sonar-duplications/src/main/java/net/sourceforge/pmd/cpd/Language.java b/sonar-duplications/src/main/java/net/sourceforge/pmd/cpd/Language.java index 12009cd6d0e..6b1e11c643c 100644 --- a/sonar-duplications/src/main/java/net/sourceforge/pmd/cpd/Language.java +++ b/sonar-duplications/src/main/java/net/sourceforge/pmd/cpd/Language.java @@ -29,7 +29,8 @@ public interface Language { String fileSeparator = System.getProperty("file.separator"); - public Tokenizer getTokenizer(); + Tokenizer getTokenizer(); + + FilenameFilter getFileFilter(); - public FilenameFilter getFileFilter(); } diff --git a/sonar-duplications/src/main/java/net/sourceforge/pmd/cpd/TokenEntry.java b/sonar-duplications/src/main/java/net/sourceforge/pmd/cpd/TokenEntry.java index 1976cefa619..fe1ef9e3f0c 100644 --- a/sonar-duplications/src/main/java/net/sourceforge/pmd/cpd/TokenEntry.java +++ b/sonar-duplications/src/main/java/net/sourceforge/pmd/cpd/TokenEntry.java @@ -28,6 +28,9 @@ import java.util.Map; public class TokenEntry implements Comparable<TokenEntry> { + private final static Map<String, Integer> TOKENS = new HashMap<String, Integer>(); + private static int tokenCount = 0; + public static final TokenEntry EOF = new TokenEntry(); private String tokenSrcID; @@ -36,34 +39,31 @@ public class TokenEntry implements Comparable<TokenEntry> { private int identifier; private int hashCode; - private final static Map<String, Integer> Tokens = new HashMap<String, Integer>(); - private static int TokenCount = 0; - private TokenEntry() { this.identifier = 0; this.tokenSrcID = "EOFMarker"; } public TokenEntry(String image, String tokenSrcID, int beginLine) { - Integer i = Tokens.get(image); + Integer i = TOKENS.get(image); if (i == null) { - i = Tokens.size() + 1; - Tokens.put(image, i); + i = TOKENS.size() + 1; + TOKENS.put(image, i); } this.identifier = i.intValue(); this.tokenSrcID = tokenSrcID; this.beginLine = beginLine; - this.index = TokenCount++; + this.index = tokenCount++; } public static TokenEntry getEOF() { - TokenCount++; + tokenCount++; return EOF; } public static void clearImages() { - Tokens.clear(); - TokenCount = 0; + TOKENS.clear(); + tokenCount = 0; } public String getTokenSrcID() { |