Affects PMD Version:
pmd-bin-7.0.0-rc3
Description:
I use the cpd function, and the command is as follows:
pmd-bin-7.0.0-rc3\bin>.\pmd.bat cpd --language java --format xml --ignore-annotations false --ignore-literals false --ignore-identifiers false --minimum-tokens 45 --dir "...Enum.java"
the result is as follows:
WARNING: An illegal reflective access operation has occurred WARNING: Illegal reflective access by org.codehaus.groovy.reflection.CachedClass (file:/C:/.../pmd/lib/groovy-2.4.21.jar) to method java.lang.Object.finalize() WARNING: Please consider reporting this to the maintainers of org.codehaus.groovy.reflection.CachedClass WARNING: Use --illegal-access=warn to enable warnings of further illegal reflective access operations WARNING: All illegal access operations will be denied in a future release [main] INFO net.sourceforge.pmd.cli.commands.internal.AbstractPmdSubcommand - Log level is at INFO <?xml version="1.0" encoding="UTF-8"?> <pmd-cpd> <file path="C:\...Enum.java" totalNumberOfTokens="137"/> <duplication lines="15" tokens="49"> <file begintoken="4" column="5" endcolumn="17" endline="16" endtoken="52" line="2" path="C:\...Enum.java"/> <file begintoken="59" column="5" endcolumn="23" endline="30" endtoken="107" line="20" path="C:\...Enum.java"/> <codefragment><![CDATA[ SUB_LIST("subList"), /* List.subList(int start, int end) */ GET_BYTES1("getBytes"), /* String.getBytes(...) */ GET("get"), /* List.get(int index) / FileItem.get() / Properties.get() / Map.get() */ SET("set"), /* set() / Collection.set(int index, E element) */ GET_BYTES("getBytes"), /* String.getBytes(...) */ GET_NAME("getName"), /* ZipEntry.getName(), Class.getName() */ GET_SIZE("getSize"), /* ZipEntry.getSize() */ GET_INSTANCE("getInstance"), /* Calendar.getInstance() */ GET_AND_INCREMENT("getAndIncrement"), /* AtomicInteger.getAndIncrement */ LOCK("lock"), /* Lock.lock() */]]></codefragment> </duplication> </pmd-cpd>
The content from row 2 to 16 is different from row 20 to 30. Args --ignore-literals
and --ignore-identifiers
have been set to false. The expected result is no duplicates be found which contradicts the actual result.
Is there something wrong with my args? What should I do if I want to reach my expectations?
And is there any way to know the similarity rate of the duplicates?
Thanks so much!
Exception Stacktrace:
# Copy-paste the stack trace here
Code Sample demonstrating the issue:
public enum Enum { SUB_LIST("subList"), /* List.subList(int start, int end) */ GET_BYTES1("getBytes"), /* String.getBytes(...) */ GET("get"), /* List.get(int index) / FileItem.get() / Properties.get() / Map.get() */ SET("set"), /* set() / Collection.set(int index, E element) */ GET_BYTES("getBytes"), /* String.getBytes(...) */ GET_NAME("getName"), /* ZipEntry.getName(), Class.getName() */ GET_SIZE("getSize"), /* ZipEntry.getSize() */ GET_INSTANCE("getInstance"), /* Calendar.getInstance() */ GET_AND_INCREMENT("getAndIncrement"), /* AtomicInteger.getAndIncrement */ LOCK("lock"), /* Lock.lock() */ TRY_LOCK("tryLock"), /* Lock.tryLock() */ VALIDATE("validate"), /* ValidatorForm.validate */ PARSE_INT("parseInt"), /* Integer.parseInt */ PARSE_BYTE("parseByte"), /* Byte.parseByte */ PARSE_SHORT1("parseShort"), /* Short.parseShort */ PARSE_LONG("parseLong"), /* Long.parseLong */ PARSE_FLOAT("parseFloat"), /* Float.parseFloat */ PARSE_DOUBLE1("parseDouble"), /* Double.parseDouble */ PARSE_BOOLEAN("parseBoolean"), /* Boolean.parseBoolean */ SUBMIT("submit"), /* ThreadPoolExecutor.submit(), ExecutorService.submit() */ EXECUTE("execute"); /* ThreadPoolExecutor.execute() */ private final String name; private CommonMethodEnum(String name) { this.name = name; } public String simpleName() { return this.name; } }
Steps to reproduce:
Please provide detailed steps for how we can reproduce the bug.
mvn clean verify
)Running PMD through: [CLI | Ant | Maven | Gradle | Designer | Other]
RetroSearch is an open source project built by @garambo | Open a GitHub Issue
Search and Browse the WWW like it's 1997 | Search results from DuckDuckGo
HTML:
3.2
| Encoding:
UTF-8
| Version:
0.7.4