From 5e887b61d371b11f11e56f26c27bb24d30cca9cb Mon Sep 17 00:00:00 2001 From: oowekyala Date: Sat, 15 Jul 2017 18:39:13 +0200 Subject: [PATCH] Fix bug with empty statements in the body of a class --- .../main/java/net/sourceforge/pmd/lang/java/oom/ClassStats.java | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) 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)); } }