@Override public void visitApply(JCMethodInvocation tree) { JCExpression select = tree.getMethodSelect(); if (select != null && select.toString().equals("Refaster.emitCommentBefore")) { String commentLiteral = (String) ((JCLiteral) tree.getArguments().get(0)).getValue(); JCExpression expr = tree.getArguments().get(1); try { print("/* " + commentLiteral + " */ "); } catch (IOException e) { throw new RuntimeException(e); } expr.accept(this); } else { super.visitApply(tree); } }
@Override protected Choice<Unifier> defaultAction(Tree target, Unifier unifier) { JCExpression expr = (JCExpression) target; Type targetType = expr.type; if (targetType == null) { return Choice.none(); } @Nullable TypeWithExpression boundType = unifier.getBinding(key()); if (boundType == null) { unifier.putBinding( key(), expr.accept(QUALIFIED_FROM_PACKAGE, null) ? TypeWithExpression.create( targetType) /* use the ImportPolicy to refer to this type */ : TypeWithExpression.create(targetType, expr)); return Choice.of(unifier); } else if (unifier.types().isSameType(targetType, boundType.type())) { return Choice.of(unifier); } return Choice.none(); } }
public void visitSelectInternal(JCFieldAccess tree) { if (tree.type.tsym.isStatic() && tree.selected.type.isParameterized()) { // The enclosing type is not a class, so we are // looking at a static member type. However, the // qualifying expression is parameterized. log.error(tree.pos(), "cant.select.static.class.from.param.type"); } else { // otherwise validate the rest of the expression tree.selected.accept(this); } }
@Override public void visitUnary(JCUnary tree) { tree.arg.accept(this); }
@Override public void visitAnnotatedType(JCAnnotatedType tree) { tree.underlyingType.accept(this); }
public Type complete(DeferredType dt, ResultInfo resultInfo, DeferredAttrContext deferredAttrContext) { this.resultInfo = resultInfo; this.inferenceContext = deferredAttrContext.inferenceContext; this.env = dt.env; dt.tree.accept(this); dt.speculativeCache.put(stuckTree, resultInfo); return Type.noType; }
@Override public void visitTypeCast(JCTypeCast tree) { tree.expr.accept(this); } }
@Override public void visitTypeCast(JCTypeCast tree) { tree.expr.accept(this); } }
public Type complete(DeferredType dt, ResultInfo resultInfo, DeferredAttrContext deferredAttrContext) { this.resultInfo = resultInfo; this.inferenceContext = deferredAttrContext.inferenceContext; this.env = dt.env; dt.tree.accept(this); dt.speculativeCache.put(stuckTree, resultInfo); return Type.noType; }
@Override public void visitUnary(JCUnary tree) { tree.arg.accept(this); }
@Override public void visitTypeCast(JCTypeCast tree) { tree.expr.accept(this); } }
@Override public void visitAnnotatedType(JCAnnotatedType tree) { tree.underlyingType.accept(this); }
public void visitSelectInternal(JCFieldAccess tree) { if (tree.type.tsym.isStatic() && tree.selected.type.isParameterized()) { // The enclosing type is not a class, so we are // looking at a static member type. However, the // qualifying expression is parameterized. log.error(tree.pos(), "cant.select.static.class.from.param.type"); } else { // otherwise validate the rest of the expression tree.selected.accept(this); } }
@Override public void visitTypeCast(JCTypeCast tree) { tree.expr.accept(this); } }
@Override public void visitParens(JCParens tree) { tree.expr.accept(this); }