use of spoon.reflect.code.CtConstructorCall in project spoon by INRIA.
the class IntercessionScanner method avoidThrowUnsupportedOperationException.
protected boolean avoidThrowUnsupportedOperationException(CtMethod<?> candidate) {
if (candidate.getBody().getStatements().size() != 1) {
return true;
}
if (!(candidate.getBody().getStatement(0) instanceof CtThrow)) {
return true;
}
CtThrow ctThrow = candidate.getBody().getStatement(0);
if (!(ctThrow.getThrownExpression() instanceof CtConstructorCall)) {
return true;
}
final CtConstructorCall<? extends Throwable> thrownExpression = (CtConstructorCall<? extends Throwable>) ctThrow.getThrownExpression();
if (!thrownExpression.getType().equals(factory.Type().createReference(UnsupportedOperationException.class))) {
return true;
}
return false;
}
Aggregations