public VariableTree Variable(ModifiersTree modifiers, CharSequence name, Tree type, ExpressionTree initializer) { return make.at(NOPOS).VarDef((JCModifiers)modifiers, names.fromString(name.toString()), (JCExpression)type, (JCExpression)initializer); }
public JCTree visitLabeledStatement(LabeledStatementTree node, P p) { JCLabeledStatement t = (JCLabeledStatement) node; JCStatement body = copy(t.body, p); return M.at(t.pos).Labelled(t.label, t.body); }
public JCTree visitParenthesized(ParenthesizedTree node, P p) { JCParens t = (JCParens) node; JCExpression expr = copy(t.expr, p); return M.at(t.pos).Parens(expr); }
public JCTree visitAnnotation(AnnotationTree node, P p) { JCAnnotation t = (JCAnnotation) node; JCTree annotationType = copy(t.annotationType, p); List<JCExpression> args = copy(t.args, p); return M.at(t.pos).Annotation(annotationType, args); }
public JCTree visitCompoundAssignment(CompoundAssignmentTree node, P p) { JCAssignOp t = (JCAssignOp) node; JCTree lhs = copy(t.lhs, p); JCTree rhs = copy(t.rhs, p); return M.at(t.pos).Assignop(t.tag, lhs, rhs); }
public JCTree visitArrayAccess(ArrayAccessTree node, P p) { JCArrayAccess t = (JCArrayAccess) node; JCExpression indexed = copy(t.indexed, p); JCExpression index = copy(t.index, p); return M.at(t.pos).Indexed(indexed, index); }
public JCTree visitParameterizedType(ParameterizedTypeTree node, P p) { JCTypeApply t = (JCTypeApply) node; JCExpression clazz = copy(t.clazz, p); List<JCExpression> arguments = copy(t.arguments, p); return M.at(t.pos).TypeApply(clazz, arguments); }
public JCTree visitInstanceOf(InstanceOfTree node, P p) { JCInstanceOf t = (JCInstanceOf) node; JCExpression expr = copy(t.expr, p); JCTree clazz = copy(t.clazz, p); return M.at(t.pos).TypeTest(expr, clazz); }
public ExpressionTree QualIdent(Element element) { Symbol s = (Symbol) element; if (s.owner != null && (s.owner.kind == Kinds.Kind.MTH || s.owner.name.isEmpty())) { JCIdent result = make.at(NOPOS).Ident(s); result.setType(s.type); return result; } QualIdentTree result = new QualIdentTree(make.at(NOPOS).QualIdent(s.owner), s.name, s); result.setPos(make.pos).setType(s.type); return result; }
public MemberReferenceTree MemberReference(ReferenceMode refMode, CharSequence name, ExpressionTree expression, List<? extends ExpressionTree> typeArguments) { ListBuffer<JCExpression> targs; if (typeArguments != null) { targs = new ListBuffer<JCExpression>(); for (ExpressionTree t : typeArguments) targs.append((JCExpression)t); } else { targs = null; } return make.at(NOPOS).Reference(refMode, names.fromString(name.toString()), (JCExpression) expression, targs != null ? targs.toList() : null); }
public AnnotationTree Annotation(Tree type, List<? extends ExpressionTree> arguments) { ListBuffer<JCExpression> lb = new ListBuffer<JCExpression>(); for (ExpressionTree t : arguments) lb.append((JCExpression)t); return make.at(NOPOS).Annotation((JCTree)type, lb.toList()); }
public UnionTypeTree UnionType(List<? extends Tree> typeComponents) { ListBuffer<JCExpression> components = new ListBuffer<JCExpression>(); for (Tree t : typeComponents) components.append((JCExpression)t); return make.at(NOPOS).TypeUnion(components.toList()); }
public CaseTree Case(ExpressionTree expression, List<? extends StatementTree> statements) { ListBuffer<JCStatement> lb = new ListBuffer<JCStatement>(); for (StatementTree t : statements) lb.append((JCStatement)t); return make.at(NOPOS).Case((JCExpression)expression, lb.toList()); }
public ParameterizedTypeTree ParameterizedType(Tree type, List<? extends Tree> typeArguments) { ListBuffer<JCExpression> typeargs = new ListBuffer<JCExpression>(); for (Tree t : typeArguments) typeargs.append((JCExpression)t); return make.at(NOPOS).TypeApply((JCExpression)type, typeargs.toList()); }
public SwitchTree Switch(ExpressionTree expression, List<? extends CaseTree> caseList) { ListBuffer<JCCase> cases = new ListBuffer<JCCase>(); for (CaseTree t : caseList) cases.append((JCCase)t); return make.at(NOPOS).Switch((JCExpression)expression, cases.toList()); }
/** Generate a base clause for an enum type. * @param pos The position for trees and diagnostics, if any * @param c The class symbol of the enum */ private JCExpression enumBase(int pos, ClassSymbol c) { JCExpression result = make.at(pos). TypeApply(make.QualIdent(syms.enumSym), List.<JCExpression>of(make.Type(c.type))); return result; }
/** The qualifier to be used for accessing a symbol in an outer class. * This is either C.sym or C.this.sym, depending on whether or not * sym is static. * @param sym The accessed symbol. */ JCExpression accessBase(DiagnosticPosition pos, Symbol sym) { return (sym.flags() & STATIC) != 0 ? access(make.at(pos.getStartPosition()).QualIdent(sym.owner)) : makeOwnerThis(pos, sym, true); }
public JCTree visitClass(ClassTree node, P p) { JCClassDecl t = (JCClassDecl) node; JCModifiers mods = copy(t.mods, p); List<JCTypeParameter> typarams = copy(t.typarams, p); JCTree extending = copy(t.extending, p); List<JCExpression> implementing = copy(t.implementing, p); List<JCTree> defs = copy(t.defs, p); return M.at(t.pos).ClassDef(mods, t.name, typarams, extending, implementing, defs); }
/** BasicType = BYTE | SHORT | CHAR | INT | LONG | FLOAT | DOUBLE | BOOLEAN */ JCPrimitiveTypeTree basicType() { JCPrimitiveTypeTree t = to(F.at(S.pos()).TypeIdent(typetag(S.token()))); S.nextToken(); return t; }