forked from phoedos/pmd
Fix ClassCastException on SignatureDeclareThrowsException
- Java 8 code allows for things such as `class UnmodifiableList<T> implements @Readonly List<@Readonly T> {}` where not all token in the ASTImplementsList are ASTClassOrInterfaceType
This commit is contained in:

committed by
Andreas Dangel

parent
020170bd76
commit
f8d1162886
@@ -50,7 +50,13 @@ public class SignatureDeclareThrowsException extends AbstractJavaRule {
|
||||
ASTImplementsList impl = node.getFirstChildOfType(ASTImplementsList.class);
|
||||
if (impl != null && impl.jjtGetParent().equals(node)) {
|
||||
for (int ix = 0; ix < impl.jjtGetNumChildren(); ix++) {
|
||||
ASTClassOrInterfaceType type = (ASTClassOrInterfaceType) impl.jjtGetChild(ix);
|
||||
Node child = impl.jjtGetChild(ix);
|
||||
|
||||
if (child.getClass() != ASTClassOrInterfaceType.class) {
|
||||
continue;
|
||||
}
|
||||
|
||||
ASTClassOrInterfaceType type = (ASTClassOrInterfaceType) child;
|
||||
if (isJUnitTest(type)) {
|
||||
junitImported = true;
|
||||
return super.visit(node, data);
|
||||
|
Reference in New Issue
Block a user