399 Commits

Author SHA1 Message Date
Juan Martín Sotuyo Dodero
c53e1790e1 [java] Allow more than 1 annotation in local classes
- This fixes #208
2017-01-27 20:00:08 +01:00
Juan Martín Sotuyo Dodero
455b1c4ded Fix grammar for annotation members
- The lookahead (3 tokens) was too small, and without reaching the opening
    parenthesis assumed it was parsing a method and not a field.
 - Using a larger lookahead solves the issue.
 - Fixes #206
2017-01-27 19:38:48 +01:00
Juan Martín Sotuyo Dodero
33fd84d521 [java] Support generics in method references
- Fixes #207
 - Extend the Java grammar to support generics in
    method references: `Type::<Generic>method`
2017-01-27 19:10:42 +01:00
Juan Martín Sotuyo Dodero
47137e3789 Improve docs on ConsecutiveAppendsShouldReuse
- This should help with people having doubts for this rule such as #202
    and http://stackoverflow.com/questions/37672785/how-can-i-improve-performance-if-append-is-called-on-stringbuffer-or-stringb
 - Fixes #202
2017-01-27 17:30:13 +01:00
Juan Martín Sotuyo Dodero
420c6d45a3 Fixes #199 - False positives with ternary operator
- I deected a couple of extra related issues with ternary operators which are now fixed.
2017-01-27 16:42:24 +01:00
Andreas Dangel
ba260e753c Adjust unit test to verify console encoding of XML formatter 2017-01-21 11:58:59 +01:00
Andreas Dangel
4c1890d56c Add unit test to verify encoding of XML formatter 2017-01-21 11:58:59 +01:00
Andreas Dangel
c0e1c3e731 Slightly improve performance of XPath Rule UseLocaleWithCaseConversions 2017-01-08 13:51:44 +01:00
Andreas Dangel
af3ad2bc02 Fixes #1556 [java] UseLocaleWithCaseConversions does not works with ResultSet (false negative) 2017-01-08 12:12:56 +01:00
Andreas Dangel
af9d78c01a Update changelog 2017-01-06 10:16:45 +01:00
Andreas Dangel
767c9aae79 Bugfix singular field + lambda 2017-01-06 10:07:19 +01:00
Juan Martín Sotuyo Dodero
6283316e51 Avoid redundant method calls and improve codebase
- Avoid making calls within for loops, specially costly ones
    such as `getQualifiedTypeNames`
 - Don't create lists when they are empty.
 - Create lists of proper size to avoid resizing / oversizing
 - I'm seeing a ~5% improvement. We are reaching the point were noise
    makes it hard to detect improvements. We should attack GC cycles soon.
2017-01-03 11:41:33 +01:00
Juan Martín Sotuyo Dodero
54db0ffbd9 [java] UnnecessaryFullyQualifiedNameRule handles same file class conflicts
- This resolves [#1555](https://sourceforge.net/p/pmd/bugs/1555/)
 - If a class is defined in the same file that conflicts with an import,
    it's not considered a violation
2017-01-03 10:18:29 +01:00
Juan Martín Sotuyo Dodero
28a24dec2a [java] Speedup PreserveStackTrace by over 7X
- By avoiding to look at all variable declarators we can greatly improve
    analysis speed without loosing accurancy
2016-12-10 10:13:37 +01:00
Juan Martín Sotuyo Dodero
f4e727d274 [java] Make CloneMethodMustImplementCloneable over 500x faster
- This was an excruciatingly slow rule, the slowest by far of all PMD
 - We speed it up by:
    * checking early if we are analyzing a `clone()` method to cut the AST tree
    * making better use of type information available
    * only performing additional checks when we know we can't rely on
       available type information
2016-12-09 09:44:23 +01:00
Sebastian Ratz
61e0fc5875 [java] Fix #1547: UnusedImports: Adjust regex to support underscores 2016-12-07 14:14:07 -03:00
Felix Otto
9f1f63ffe6 fixes #1552 [java] continue does not require break
Similar to RETURN after a CONTINUE statement break is not required in a
case section
2016-12-07 13:10:23 -03:00
Juan Martín Sotuyo Dodero
7e3546c130 UnnecessaryFullyQualifiedName can detect conflicts
- Fixes https://sourceforge.net/p/pmd/bugs/1546/
2016-11-26 18:13:10 +01:00
Juan Martín Sotuyo Dodero
b5ca7baa9a Ensure className is never null 2016-11-26 11:04:29 +01:00
Juan Martín Sotuyo Dodero
19a8d0d060 Minor optimizations to type resolution 2016-11-26 11:04:00 +01:00
Juan Martín Sotuyo Dodero
95101fddaf Don't look twice for the same variables
- This reduces calls to all scope resolution methods
2016-11-26 10:29:02 +01:00
Juan Martín Sotuyo Dodero
28e2f11003 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.
2016-11-20 18:27:06 +01:00
Andreas Dangel
e78f80416a [maven-release-plugin] prepare for next development iteration 2016-11-04 21:01:18 +01:00
Andreas Dangel
5019eb11e4 [maven-release-plugin] prepare release pmd_releases/5.4.3 2016-11-04 21:01:18 +01:00
Andreas Dangel
7bfc1b9545 Merge branch 'bug-1532' into pmd/5.4.x 2016-11-04 12:47:21 +01:00
Andreas Dangel
a9d0de9450 Fixes #1532 [java] CloneMethodMustImplementCloneable: Implemented Interface extends Cloneable 2016-11-04 12:41:57 +01:00
Andreas Dangel
15ff7ca944 Fixes #1490 [java] PMD Error while processing - NullPointerException 2016-11-04 08:46:00 +01:00
Andreas Dangel
4ac34af067 Merge branch 'bug-1494' into pmd/5.4.x 2016-11-02 20:22:53 +01:00
Andreas Dangel
0c75e5123c Fixes #1494 [java] SingularField: lombok.Data false positive 2016-11-02 20:22:15 +01:00
Andreas Dangel
315ea28d4c Merge branch 'pr-113' into pmd/5.4.x 2016-10-30 17:25:47 +01:00
Juan Martín Sotuyo Dodero
f8d1162886 Fix ClassCastException on SignatureDeclareThrowsException
- Java 8 code allows for things such as
   `class UnmodifiableList<T> implements @Readonly List<@Readonly T> {}`
    where not all token in the ASTImplementsList are ASTClassOrInterfaceType
2016-10-30 17:19:16 +01:00
Andreas Dangel
020170bd76 Add test for #1535 [java] SignatureDeclareThrowsException: ClassCastException with Annotation 2016-10-30 17:18:31 +01:00
Andreas Dangel
b0fb0cadc1 Merge branch 'pr-112' into pmd/5.4.x 2016-10-29 18:28:36 +02:00
Andreas Dangel
127a2be871 whitespaces 2016-10-29 18:19:59 +02:00
Juan Martín Sotuyo Dodero
238f6b721b Fix ClassCastException on CloneMethodMustImplementCloneable
- Java 8 code allows for things such as
    `class UnmodifiableList<T> implements @Readonly List<@Readonly T> {}`
    where not all token in the ASTImplementsList are ASTClassOrInterfaceType
2016-10-29 18:19:00 +02:00
Andreas Dangel
f4f2402661 Add test for #1534 [java] CloneMethodMustImplementCloneable: ClassCastException with Annotation (java8) 2016-10-29 18:17:59 +02:00
Andreas Dangel
b2c59bcbdb Merge branch 'pr-111' into pmd/5.4.x 2016-10-29 17:20:32 +02:00
Juan Martín Sotuyo Dodero
1e5c1c05ca In Java 8, annotations may appear as first child
- For instance `Object o = new @Interned MyObject();` would fail with a ClassCastException
 - The current code deals with it gracefully
2016-10-29 17:13:33 +02:00
Andreas Dangel
5d11e77208 Add test for #1533 [java] BooleanInstantiation: ClassCastException with Annotation 2016-10-29 17:12:20 +02:00
Andreas Dangel
578d854632 Merge branch 'bug-1530' into pmd/5.4.x 2016-10-16 14:08:13 +02:00
Juan Martín Sotuyo Dodero
283dc00a43 Replace syntactic lookahead with semantic one
- They are the same, but JavaCC seems to handle this one better.
2016-10-16 14:01:26 +02:00
Juan Martín Sotuyo Dodero
e9f14e4496 Add failing test scenario 2016-10-16 13:59:17 +02:00
Andreas Dangel
1b52e0192a Merge branch 'bug-1529' into pmd/5.4.x 2016-10-01 17:54:11 +02:00
Andreas Dangel
8667aea076 Fixes #1529 [java] UnusedImports: The created rule violation has no class name 2016-10-01 17:45:47 +02:00
Andreas Dangel
354b9a9cbc Merge branch 'bug-1522' into pmd/5.4.x 2016-09-25 18:37:38 +02:00
Andreas Dangel
db44bc4745 Fixes #1522 [java] CommentRequired: false positive 2016-09-25 18:32:26 +02:00
Andreas Dangel
42a5c6a537 Merge branch 'bug-1508' into pmd/5.4.x 2016-07-26 21:42:55 +02:00
Andreas Dangel
88d1823c2e Fixes #1508 [core] [java] PMD is leaking file handles
Fixes InputStreams and Readers
2016-07-25 21:25:34 +02:00
Andreas Dangel
9240f98cce Merge branch 'pr-103' into pmd/5.4.x 2016-07-07 22:35:26 +02:00
Andreas Dangel
0660097db2 Add unit test for #1501 [java] CyclomaticComplexity rule causes OOM when class reporting is disabled 2016-07-07 22:27:16 +02:00