* Upgrade asm so that it understands default method and static methods in interfaces jdk8 class files
* see 9b91690f218408ba1c65e633a824660e18080b00 for ASM4 support
A missing assertion message for assertEquals(double, double, double)
is detected in most cases now. If the assertEquals method has two
arguments, an assertion message is missing, if the assertEquals method
has three arguments, the first one has to be a string.
Pmd will only print an error if the first argument type has been
determined (getType() != null) and isn't a String. Therefore
assertEquals(getInt(), getInt(), getInt()) won't be detected as an
error. However, double d = 1.0; assertEquals(d, 1.0, 1.0); will be
detected.
The JUnitAssertionsShouldIncludeMessageRule.check method has been moved
to the inner class AssertionCall and has been expanded by an
isException hook. The assertEquals with three arguments check overrides
the isException method, returns true if the first argument can't be
determined or is a String and if so, no violation will be added. Also
the constructor arguments have been swapped for readability.
https://sourceforge.net/p/pmd/bugs/1313/
Some of the tokenizers ignore comments and therefore the line count of a
duplication can differ per file. Take for example the following files:
FileA.java:
1: public class FileA {
2: pulbic String Foo() {
3: return "Foo";
4: }
5: }
FileB.java:
1: public class FileB {
2: pulbic String Foo() {
3: // This is a comment
4: return "Foo";
5: }
6: }
When comments are ignored and not tokenized, the duplication consist of
the following tokens:
'{', 'public', 'String', 'Foo', '(', ')', '{', 'return', 'Foo', ';',
'}', '}'
For 'FileA.java' the duplication is 5 lines long, it starts at line 1
and ends at line 5. For 'FileB.java' the duplication is 6 lines long, it
starts at line 1 and ends at line 6.
Note that this is just 1 example, because for most tokenizers comments
and white spaces are not significant. For example the following file
contains the same duplication all on 1 line:
FileC.java
1: public class FileC { public String Foo() { return "Foo"; } }
For us the correct line count per file is important, because we
highlight the duplications in an annotated source view and show the
percentage of duplicated code the file contains. The current output
formats only contain 1 line count per duplication and file set. For the
above example CPD would output the following:
Found a 4 line (12 tokens) duplication in the following files:
Starting at line 1 of FileA.java
Starting at line 1 of FileB.java
For FileB.java this is not correct and would lead to incorrect
percentage of duplicated code. (66% (4 of 6 lines) instead of the
correct 83% (5 of 6 lines)).
To fix the problem, I created an extra output format
'csv_with_linecount_per_file' which outputs the correct line count per
file. The format contains the following:
tokens,occurrences
<nr of tokens>,<nr of occurrences>(,<begin line>,<line count>,<file
name>)+
For the above example the output would be
tokens,occurrences
12,2,1,4,FileA.java,1,5,FileB.java