public int getArgumentCount() { if (this.jjtGetNumChildren() == 1) { return ((ASTArguments) this.jjtGetChild(0)).getArgumentCount(); } else { return ((ASTArguments) this.jjtGetChild(1)).getArgumentCount(); } }
@Override protected boolean isException(ASTArguments node) { List<ASTExpression> arguments = node.findDescendantsOfType(ASTExpression.class); boolean isExceptionJunit4 = isStringTypeOrNull(arguments.get(0)); boolean isExceptionJunit5 = isStringTypeOrNull(arguments.get(2)); return isExceptionJunit4 || isExceptionJunit5; } });
@Override public Object visit(ASTAllocationExpression node, Object data) { ASTClassOrInterfaceType declClassName = node.getFirstChildOfType(ASTClassOrInterfaceType.class); if (declClassName != null && TypeHelper.isA(declClassName, javax.crypto.spec.IvParameterSpec.class)) { Node firstArgument = null; ASTArguments arguments = node.getFirstChildOfType(ASTArguments.class); if (arguments.getArgumentCount() > 0) { firstArgument = arguments.getFirstChildOfType(ASTArgumentList.class).jjtGetChild(0); } if (firstArgument != null) { ASTPrimaryPrefix prefix = firstArgument.getFirstDescendantOfType(ASTPrimaryPrefix.class); validateProperIv(data, prefix); } } return data; }
public int getArgumentCount() { if (this.jjtGetNumChildren() == 0) { return 0; } return this.jjtGetChild(0).jjtGetNumChildren(); }
public void check(Object ctx, ASTArguments node) { if (node.getArgumentCount() == argumentsCount && node.getNthParent(2) instanceof ASTPrimaryExpression) { ASTPrimaryPrefix primaryPrefix = node.getNthParent(2).getFirstChildOfType(ASTPrimaryPrefix.class); if (primaryPrefix != null) { ASTName name = primaryPrefix.getFirstChildOfType(ASTName.class); if (name != null && name.hasImageEqualTo(this.assertionName)) { if (isException(node)) { return; } JUnitAssertionsShouldIncludeMessageRule.this.addViolation(ctx, name); } } } }
final public void Arguments() throws ParseException { ASTArguments jjtn000 = new ASTArguments(this, JJTARGUMENTS); boolean jjtc000 = true; jjtree.openNodeScope(jjtn000); jjtn000.jjtSetFirstToken(getToken(1)); try { jj_consume_token(LPAREN); if (jjtc000) { jjtree.closeNodeScope(jjtn000, true); jjtn000.jjtSetLastToken(getToken(0));
private ASTArgumentList getArgumentList(ASTArguments args) { if (args != null) { return args.getFirstChildOfType(ASTArgumentList.class); } return null; }
public void check(Object ctx, ASTArguments node) { if (node.getArgumentCount() == argumentsCount && node.getNthParent(2) instanceof ASTPrimaryExpression) { ASTPrimaryPrefix primaryPrefix = node.getNthParent(2).getFirstChildOfType(ASTPrimaryPrefix.class); if (primaryPrefix != null) { ASTName name = primaryPrefix.getFirstChildOfType(ASTName.class); if (name != null && name.hasImageEqualTo(this.assertionName)) { if (isException(node)) { return; } JUnitAssertionsShouldIncludeMessageRule.this.addViolation(ctx, name); } } } }
final public void Arguments() throws ParseException { ASTArguments jjtn000 = new ASTArguments(this, JJTARGUMENTS); boolean jjtc000 = true; jjtree.openNodeScope(jjtn000); jjtn000.jjtSetFirstToken(getToken(1)); try { jj_consume_token(LPAREN); if (jjtc000) { jjtree.closeNodeScope(jjtn000, true); jjtn000.jjtSetLastToken(getToken(0));
ASTArguments arguments = (ASTArguments) primarySuffix.jjtGetChild(0); ASTFormalParameters formalParameters = (ASTFormalParameters) methodDeclarator.jjtGetChild(0); if (formalParameters.jjtGetNumChildren() != arguments.jjtGetNumChildren()) { return super.visit(node, data); if (arguments.jjtGetNumChildren() == 0) { addViolation(data, node, getMessage()); } else { ASTArgumentList argumentList = (ASTArgumentList) arguments.jjtGetChild(0); for (int i = 0; i < argumentList.jjtGetNumChildren(); i++) { Node expressionChild = argumentList.jjtGetChild(i).jjtGetChild(0);
private static List<String> getArgumentTypes(ASTArguments args) { List<String> argumentTypes = new ArrayList<>(); ASTArgumentList argumentList = args.getFirstChildOfType(ASTArgumentList.class); if (argumentList != null) { for (int a = 0; a < argumentList.jjtGetNumChildren(); a++) {
ConstructorInvocation(ASTExplicitConstructorInvocation eci) { this.eci = eci; List<ASTArguments> l = eci.findChildrenOfType(ASTArguments.class); if (!l.isEmpty()) { ASTArguments aa = l.get(0); count = aa.getArgumentCount(); argumentTypes = ConstructorCallsOverridableMethodRule.getArgumentTypes(aa); } name = eci.getImage(); }
@Override public Object visit(ASTAllocationExpression node, Object data) { ASTClassOrInterfaceType declClassName = node.getFirstChildOfType(ASTClassOrInterfaceType.class); if (declClassName != null && TypeHelper.isA(declClassName, SECRET_KEY_SPEC)) { Node firstArgument = null; ASTArguments arguments = node.getFirstChildOfType(ASTArguments.class); if (arguments.getArgumentCount() > 0) { firstArgument = arguments.getFirstChildOfType(ASTArgumentList.class).jjtGetChild(0); } if (firstArgument != null) { ASTPrimaryPrefix prefix = firstArgument.getFirstDescendantOfType(ASTPrimaryPrefix.class); validateProperKeyArgument(data, prefix); } } return data; }
public int getArgumentCount() { if (this.jjtGetNumChildren() == 0) { return 0; } return this.jjtGetChild(0).jjtGetNumChildren(); }
private ASTArgumentList getArgumentList(ASTArguments args) { if (args != null) { return args.getFirstChildOfType(ASTArgumentList.class); } return null; }
@Override protected boolean isException(ASTArguments node) { List<ASTExpression> arguments = node.findDescendantsOfType(ASTExpression.class); boolean isExceptionJunit4 = isStringTypeOrNull(arguments.get(0)); boolean isExceptionJunit5 = isStringTypeOrNull(arguments.get(2)); return isExceptionJunit4 || isExceptionJunit5; } });
/** * Get the number of arguments for this primary suffix. One should call * {@link #isArguments()} to see if there are arguments. If this method is * called when there are no arguments it returns <code>-1</code>. * * @return A non-negative argument number when there are arguments, * <code>-1</code> otherwise. */ public int getArgumentCount() { if (!this.isArguments()) { return -1; } return ((ASTArguments) jjtGetChild(jjtGetNumChildren() - 1)).getArgumentCount(); }
@Override public Object visit(ASTAllocationExpression node, Object data) { ASTClassOrInterfaceType declClassName = node.getFirstChildOfType(ASTClassOrInterfaceType.class); if (declClassName != null && TypeHelper.isA(declClassName, SECRET_KEY_SPEC)) { Node firstArgument = null; ASTArguments arguments = node.getFirstChildOfType(ASTArguments.class); if (arguments.getArgumentCount() > 0) { firstArgument = arguments.getFirstChildOfType(ASTArgumentList.class).jjtGetChild(0); } if (firstArgument != null) { ASTPrimaryPrefix prefix = firstArgument.getFirstDescendantOfType(ASTPrimaryPrefix.class); validateProperKeyArgument(data, prefix); } } return data; }
ASTArguments arguments = (ASTArguments) primarySuffix.jjtGetChild(0); ASTFormalParameters formalParameters = (ASTFormalParameters) methodDeclarator.jjtGetChild(0); if (formalParameters.jjtGetNumChildren() != arguments.jjtGetNumChildren()) { return super.visit(node, data); if (arguments.jjtGetNumChildren() == 0) { addViolation(data, node, getMessage()); } else { ASTArgumentList argumentList = (ASTArgumentList) arguments.jjtGetChild(0); for (int i = 0; i < argumentList.jjtGetNumChildren(); i++) { Node expressionChild = argumentList.jjtGetChild(i).jjtGetChild(0);
private static List<String> getArgumentTypes(ASTArguments args) { List<String> argumentTypes = new ArrayList<>(); ASTArgumentList argumentList = args.getFirstChildOfType(ASTArgumentList.class); if (argumentList != null) { for (int a = 0; a < argumentList.jjtGetNumChildren(); a++) {