Update changelog with new rule "AccessorMethodGeneration"

References #244
This commit is contained in:
Andreas Dangel
2017-02-13 20:02:21 +01:00
parent e027871f2a
commit 070011c3ae
2 changed files with 50 additions and 5 deletions

View File

@@ -0,0 +1,14 @@
<?xml version="1.0"?>
<ruleset name="554"
xmlns="http://pmd.sourceforge.net/ruleset/2.0.0"
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
xsi:schemaLocation="http://pmd.sourceforge.net/ruleset/2.0.0 http://pmd.sourceforge.net/ruleset_2_0_0.xsd">
<description>
This ruleset contains links to rules that are new in PMD v5.5.4
</description>
<rule ref="rulesets/java/design.xml/AccessorMethodGeneration"/>
</ruleset>

View File

@@ -7,22 +7,53 @@ The PMD team is pleased to announce PMD 5.5.4
### Table Of Contents
* [New and noteworthy](#New_and_noteworthy)
* [Fixed Issues](#Fixed_Issues)
* [API Changes](#API_Changes)
* [External Contributions](#External_Contributions)
* [New and noteworthy](#New_and_noteworthy)
* [New Rules](#New_Rules)
* [Fixed Issues](#Fixed_Issues)
* [API Changes](#API_Changes)
* [External Contributions](#External_Contributions)
### New and noteworthy
#### New Rules
##### AccessorMethodGeneration (java-design)
When accessing a private field / method from another class, the Java compiler will generate a accessor methods
with package-private visibility. This adds overhead, and to the dex method count on Android. This situation can
be avoided by changing the visibility of the field / method from private to package-private.
For instance, it would report violations on code such as:
```
public class OuterClass {
private int counter;
/* package */ int id;
public class InnerClass {
InnerClass() {
OuterClass.this.counter++; // wrong, accessor method will be generated
}
public int getOuterClassId() {
return OuterClass.this.id; // id is package-private, no accessor method needed
}
}
}
```
This new rule is part of the `java-design` ruleset.
### Fixed Issues
* general
* General
* [#234](https://github.com/pmd/pmd/issues/234): \[core] Zip file stream closes spuriously when loading rulesets
* java-basic
* [#232](https://github.com/pmd/pmd/issues/232): \[java] SimplifiedTernary: Incorrect ternary operation can be simplified.
* java-design
* [#1496](https://sourceforge.net/p/pmd/bugs/1496/): \[java] New Rule: AccesorMethodGeneration - complements accessor class rule
* [#216](https://github.com/pmd/pmd/issues/216): \[java] \[doc] NonThreadSafeSingleton: Be more explicit as to why double checked locking is not recommended
* [#219](https://github.com/pmd/pmd/issues/219): \[java] UnnecessaryLocalBeforeReturn: ClassCastException in switch case with local variable returned
* java-optimizations