private static GuardedByExpression bind(JCTree.JCExpression exp, BinderContext context) { GuardedByExpression expr = BINDER.visit(exp, context); checkGuardedBy(expr != null, String.valueOf(exp)); checkGuardedBy(expr.kind() != Kind.TYPE_LITERAL, "Raw type literal: %s", exp); return expr; }
@Override public ComparisonResult visitIdentifier(IdentifierTree node, VisitorState state) { Symbol sym = ASTHelpers.getSymbol(node); if (sym instanceof VarSymbol) { Object value = ((VarSymbol) sym).getConstantValue(); if (value instanceof Integer) { return forInt((Integer) value); } } return super.visitIdentifier(node, state); }
@Override public ComparisonResult visitLiteral(LiteralTree node, VisitorState state) { if (node.getValue() instanceof Integer) { return forInt((Integer) node.getValue()); } return super.visitLiteral(node, state); } };
public R visitOther(Tree node, P p) { return defaultAction(node, p); } }
@Override public ComparisonResult visitMemberSelect(MemberSelectTree node, VisitorState state) { Symbol sym = ASTHelpers.getSymbol(node); if (sym instanceof VarSymbol) { Object value = ((VarSymbol) sym).getConstantValue(); if (value instanceof Integer) { return forInt((Integer) value); } } return super.visitMemberSelect(node, state); }
public R visitOther(Tree node, P p) { return defaultAction(node, p); } }
@Override public ComparisonResult visitMemberSelect(MemberSelectTree node, VisitorState state) { Symbol sym = ASTHelpers.getSymbol(node); if (sym instanceof VarSymbol) { Object value = ((VarSymbol) sym).getConstantValue(); if (value instanceof Integer) { return forInt((Integer) value); } } return super.visitMemberSelect(node, state); }
public R visitOther(Tree node, P p) { return defaultAction(node, p); } }
@Override public Void visitSynchronized(SynchronizedTree node, Context context) { scan(SKIP_PARENS.visit(node.getExpression(), null), context); scan(node.getBlock(), context); return null; }
@Override public ComparisonResult visitIdentifier(IdentifierTree node, VisitorState state) { Symbol sym = ASTHelpers.getSymbol(node); if (sym instanceof VarSymbol) { Object value = ((VarSymbol) sym).getConstantValue(); if (value instanceof Integer) { return forInt((Integer) value); } } return super.visitIdentifier(node, state); }
@Override public ComparisonResult visitLiteral(LiteralTree node, VisitorState state) { if (node.getValue() instanceof Integer) { return forInt((Integer) node.getValue()); } return super.visitLiteral(node, state); } };
public R visitOther(Tree node, P p) { return defaultAction(node, p); } }
@Override public Void visitDoWhileLoop(DoWhileLoopTree node, Context context) { scan(node.getStatement(), context); scan(SKIP_PARENS.visit(node.getCondition(), null), context); return null; }
public R visitCompilationUnit(CompilationUnitTree node, P p) { return defaultAction(node, p); }
@Override public Void visitWhileLoop(WhileLoopTree node, Context context) { scan(SKIP_PARENS.visit(node.getCondition(), null), context); scan(node.getStatement(), context); return null; }
public R visitImport(ImportTree node, P p) { return defaultAction(node, p); }
@Override public Void visitIf(IfTree node, Context context) { scan(SKIP_PARENS.visit(node.getCondition(), null), context); scan(node.getThenStatement(), context); scan(node.getElseStatement(), context); return null; } }
public R visitVariable(VariableTree node, P p) { return defaultAction(node, p); }
@Override public Void visitMethodInvocation( MethodInvocationTree node, BiConsumer<MethodInvocationTree, Name> biConsumer) { Name identifier = OWNED_IDENTIFIER.visit(node.getMethodSelect(), null); if (identifier != null) { biConsumer.accept(node, identifier); } return super.visitMethodInvocation(node, biConsumer); } };
public R visitSynchronized(SynchronizedTree node, P p) { return defaultAction(node, p); }