diff --git a/pmd-java/src/main/java/net/sourceforge/pmd/lang/java/oom/ClassStats.java b/pmd-java/src/main/java/net/sourceforge/pmd/lang/java/oom/ClassStats.java index cb42646e9c..c3687747e4 100644 --- a/pmd-java/src/main/java/net/sourceforge/pmd/lang/java/oom/ClassStats.java +++ b/pmd-java/src/main/java/net/sourceforge/pmd/lang/java/oom/ClassStats.java @@ -210,7 +210,7 @@ import net.sourceforge.pmd.lang.java.oom.signature.OperationSignature; List operations = new ArrayList<>(); for (ASTAnyTypeBodyDeclaration decl : node.getDeclarations()) { - if (decl.jjtGetChild(0) instanceof ASTMethodOrConstructorDeclaration) { + if (decl.jjtGetNumChildren() > 0 && decl.jjtGetChild(0) instanceof ASTMethodOrConstructorDeclaration) { operations.add((ASTMethodOrConstructorDeclaration) decl.jjtGetChild(0)); } }