bug fix: incorrect detection of top level classes/interfaces (crashed on jdk 1.5 and 1.6 source code)

git-svn-id: https://pmd.svn.sourceforge.net/svnroot/pmd/trunk@4743 51baf565-9d33-0410-a72c-fc3788e3496d
This commit is contained in:
Xavier Le Vourch
2006-10-25 23:21:30 +00:00
parent 9bad2be979
commit 15abbd44ae

View File

@ -153,7 +153,8 @@ public class AccessorClassGeneration extends AbstractRule {
*/
public Object visit(ASTClassOrInterfaceDeclaration node, Object data) {
if (node.isInterface()) {
if (node.isNested()) {
if (!(node.jjtGetParent().jjtGetParent() instanceof ASTCompilationUnit)) {
// not a top level interface
String interfaceName = node.getImage();
int formerID = getClassID();
setClassID(classDataList.size());
@ -179,7 +180,8 @@ public class AccessorClassGeneration extends AbstractRule {
setClassID(-1);
return o;
}
} else if (node.isNested()) {
} else if (!(node.jjtGetParent().jjtGetParent() instanceof ASTCompilationUnit)) {
// not a top level class
String className = node.getImage();
int formerID = getClassID();
setClassID(classDataList.size());