references #81
This commit is contained in:
@ -9,6 +9,7 @@ import java.util.List;
|
|||||||
import java.util.ListIterator;
|
import java.util.ListIterator;
|
||||||
|
|
||||||
import net.sourceforge.pmd.lang.java.ast.ASTAllocationExpression;
|
import net.sourceforge.pmd.lang.java.ast.ASTAllocationExpression;
|
||||||
|
import net.sourceforge.pmd.lang.java.ast.ASTAnnotationTypeDeclaration;
|
||||||
import net.sourceforge.pmd.lang.java.ast.ASTArguments;
|
import net.sourceforge.pmd.lang.java.ast.ASTArguments;
|
||||||
import net.sourceforge.pmd.lang.java.ast.ASTArrayDimsAndInits;
|
import net.sourceforge.pmd.lang.java.ast.ASTArrayDimsAndInits;
|
||||||
import net.sourceforge.pmd.lang.java.ast.ASTClassOrInterfaceDeclaration;
|
import net.sourceforge.pmd.lang.java.ast.ASTClassOrInterfaceDeclaration;
|
||||||
@ -224,6 +225,39 @@ public class AccessorClassGenerationRule extends AbstractJavaRule {
|
|||||||
return o;
|
return o;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public Object visit(ASTAnnotationTypeDeclaration node, Object data) {
|
||||||
|
if (!(node.jjtGetParent().jjtGetParent() instanceof ASTCompilationUnit)) {
|
||||||
|
// not a toplevel annotation type
|
||||||
|
String interfaceName = node.getImage();
|
||||||
|
int formerID = getClassID();
|
||||||
|
setClassID(classDataList.size());
|
||||||
|
ClassData newClassData = new ClassData(interfaceName);
|
||||||
|
// store the names of any outer classes of this class in the
|
||||||
|
// classQualifyingName List
|
||||||
|
ClassData formerClassData = classDataList.get(formerID);
|
||||||
|
newClassData.addClassQualifyingName(formerClassData.getClassName());
|
||||||
|
classDataList.add(getClassID(), newClassData);
|
||||||
|
Object o = super.visit(node, data);
|
||||||
|
setClassID(formerID);
|
||||||
|
return o;
|
||||||
|
}
|
||||||
|
|
||||||
|
// top-level annotation type
|
||||||
|
String interfaceName = node.getImage();
|
||||||
|
classDataList.clear();
|
||||||
|
setClassID(0);
|
||||||
|
classDataList.add(getClassID(), new ClassData(interfaceName));
|
||||||
|
Object o = super.visit(node, data);
|
||||||
|
if (o != null) {
|
||||||
|
processRule(o);
|
||||||
|
} else {
|
||||||
|
processRule(data);
|
||||||
|
}
|
||||||
|
setClassID(-1);
|
||||||
|
return o;
|
||||||
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Store all target constructors
|
* Store all target constructors
|
||||||
*/
|
*/
|
||||||
|
@ -120,4 +120,12 @@ public class Foo1 {
|
|||||||
}
|
}
|
||||||
]]></code>
|
]]></code>
|
||||||
</test-code> -->
|
</test-code> -->
|
||||||
|
|
||||||
|
<test-code>
|
||||||
|
<description>#1452 ArrayIndexOutOfBoundsException with Annotations for AccessorClassGenerationRule</description>
|
||||||
|
<expected-problems>0</expected-problems>
|
||||||
|
<code><![CDATA[
|
||||||
|
public @interface Something { public interface SomthingElse{}; }
|
||||||
|
]]></code>
|
||||||
|
</test-code>
|
||||||
</test-data>
|
</test-data>
|
||||||
|
@ -16,12 +16,15 @@
|
|||||||
**Pull Requests:**
|
**Pull Requests:**
|
||||||
|
|
||||||
* [#27](https://github.com/adangel/pmd/pull/27): Added support for Raw String Literals (C++11).
|
* [#27](https://github.com/adangel/pmd/pull/27): Added support for Raw String Literals (C++11).
|
||||||
* [#29)(https://github.com/adangel/pmd/pull/29): Added support for files with UTF-8 BOM to JSP tokenizer.
|
* [#29](https://github.com/adangel/pmd/pull/29): Added support for files with UTF-8 BOM to JSP tokenizer.
|
||||||
* [#79](https://github.com/pmd/pmd/pull/79): do not flag public static void main(String[]) as UseVarargs; ignore @Override for UseVarargs
|
* [#79](https://github.com/pmd/pmd/pull/79): do not flag public static void main(String[]) as UseVarargs; ignore @Override for UseVarargs
|
||||||
* [#80](https://github.com/pmd/pmd/pull/80): Update mvn-plugin.md
|
* [#80](https://github.com/pmd/pmd/pull/80): Update mvn-plugin.md
|
||||||
* [#83](https://github.com/pmd/pmd/pull/83): Adds new Code Climate-compliant JSON renderer
|
* [#83](https://github.com/pmd/pmd/pull/83): Adds new Code Climate-compliant JSON renderer
|
||||||
|
|
||||||
**Bugfixes:**
|
**Bugfixes:**
|
||||||
|
|
||||||
|
* java-design/AccessorClassGeneration:
|
||||||
|
* [#1452](https://sourceforge.net/p/pmd/bugs/1452/): ArrayIndexOutOfBoundsException with Annotations for AccessorClassGenerationRule
|
||||||
|
|
||||||
**API Changes:**
|
**API Changes:**
|
||||||
|
|
||||||
|
Reference in New Issue
Block a user