diff --git a/pmd-java/src/main/java/net/sourceforge/pmd/lang/java/ast/ASTClassOrInterfaceDeclaration.java b/pmd-java/src/main/java/net/sourceforge/pmd/lang/java/ast/ASTClassOrInterfaceDeclaration.java index 9e09fe341c..f660683159 100644 --- a/pmd-java/src/main/java/net/sourceforge/pmd/lang/java/ast/ASTClassOrInterfaceDeclaration.java +++ b/pmd-java/src/main/java/net/sourceforge/pmd/lang/java/ast/ASTClassOrInterfaceDeclaration.java @@ -50,7 +50,7 @@ public class ASTClassOrInterfaceDeclaration extends AbstractJavaAccessTypeNode i public JavaQualifiedName getQualifiedName() { if (qualifiedName == null) { if (isNested()) { - ASTClassOrInterfaceDeclaration parent = this.getFirstParentOfType(ASTClassOrInterfaceDeclaration.class); + ASTAnyTypeDeclaration parent = this.getFirstParentOfType(ASTAnyTypeDeclaration.class); JavaQualifiedName parentQN = parent.getQualifiedName(); qualifiedName = JavaQualifiedName.ofNestedClass(parentQN, this.getImage()); return qualifiedName; diff --git a/pmd-java/src/test/resources/net/sourceforge/pmd/lang/java/rule/codesize/xml/NcssCount.xml b/pmd-java/src/test/resources/net/sourceforge/pmd/lang/java/rule/codesize/xml/NcssCount.xml index ac88a3b9d4..236f191a8f 100644 --- a/pmd-java/src/test/resources/net/sourceforge/pmd/lang/java/rule/codesize/xml/NcssCount.xml +++ b/pmd-java/src/test/resources/net/sourceforge/pmd/lang/java/rule/codesize/xml/NcssCount.xml @@ -215,4 +215,34 @@ public class Foo { 0 + + + Nullpointer for getQualifiedName + 0 + +