Merge branch 'issue-291' into pmd/5.5.x

This commit is contained in:
Andreas Dangel
2017-03-18 10:39:09 +01:00
3 changed files with 121 additions and 340 deletions

View File

@ -99,28 +99,7 @@ public class Foo1 {
}
}
]]></code>
</test-code> <!--
<test-code>
<description><![CDATA[
See bug# 1807370 (False +). static private inner classes DOES not
generate an accesor. They are ok.
]]></description>
This is buggy, the point of the fix is that there should
be '0' expected problem !
<expected-problems>1</expected-problems>
<code><![CDATA[
public class Foo1 {
public class InnerClass {
private static InnerClass(int[] a){
}
}
void method(){
new InnerClass(new int[]{1});//Causes generation of accessor
}
}
]]></code>
</test-code> -->
</test-code>
<test-code>
<description>#1452 ArrayIndexOutOfBoundsException with Annotations for AccessorClassGenerationRule</description>
<expected-problems>0</expected-problems>
@ -128,4 +107,28 @@ public class Foo1 {
public @interface Something { public interface SomthingElse{}; }
]]></code>
</test-code>
<test-code>
<description><![CDATA[
#291 - Private constructor called from anonymous class
]]></description>
<expected-problems>1</expected-problems>
<code><![CDATA[
public class Example extends View {
private int foo;
private Example(final Context context) {
super(context);
}
public static void create() {
new Handler().post(new Runnable() {
@Override
public void run() {
Example example = new Example(null); // Should be marked since the constructor is private.
}
});
}
}
]]></code>
</test-code>
</test-data>

View File

@ -19,6 +19,7 @@ The PMD team is pleased to announce PMD 5.5.5.
* java-design
* [#274](https://github.com/pmd/pmd/issues/274): \[java] AccessorMethodGeneration: Method inside static inner class incorrectly reported
* [#275](https://github.com/pmd/pmd/issues/275): \[java] FinalFieldCouldBeStatic: Constant in @interface incorrectly reported as "could be made static"
* [#291](https://github.com/pmd/pmd/issues/291): \[java] Improve quality of AccessorClassGeneration
### API Changes