Package com.sun.tools.javac.tree.JCTree

Examples of com.sun.tools.javac.tree.JCTree.JCIdent


  public static Type getReturnType(ExpressionTree expressionTree) {
    if (expressionTree instanceof JCFieldAccess) {
      JCFieldAccess methodCall = (JCFieldAccess) expressionTree;
      return methodCall.type.getReturnType();
    } else if (expressionTree instanceof JCIdent) {
      JCIdent methodCall = (JCIdent) expressionTree;
      return methodCall.type.getReturnType();
    }
    throw new IllegalArgumentException("Expected a JCFieldAccess or JCIdent");
  }
View Full Code Here


  public static Type getReceiverType(ExpressionTree expressionTree) {
    if (expressionTree instanceof JCFieldAccess) {
      JCFieldAccess methodSelectFieldAccess = (JCFieldAccess) expressionTree;
      return methodSelectFieldAccess.selected.type;
    } else if (expressionTree instanceof JCIdent) {
      JCIdent methodCall = (JCIdent) expressionTree;
      return methodCall.sym.owner.type;
    }
    throw new IllegalArgumentException(
        "Expected a JCFieldAccess or JCIdent from expression " + expressionTree);
  }
View Full Code Here

    // e.g. new Comparator<String>() { ... }
    JCNewClass newComparatorInvocation = (JCNewClass) methodInvocation.getArguments().get(0);

    // e.g. Ordering
    JCIdent orderingIdent = (JCIdent)
        ((JCFieldAccess) ((JCMethodInvocation) methodInvocation).meth).selected;
    // e.g. Ordering<String>
    JCTypeApply newOrderingType = state.getTreeMaker().TypeApply(orderingIdent,
        ((JCTypeApply) newComparatorInvocation.clazz).arguments);
View Full Code Here

                    List<JCStatement> failblock = transformBlock(stmt.getElseClause().getBlock());
                    // Close the inner substitutions of the else block
                    closeInnerSubstituionsForSpecifiedValues(stmt.getElseClause());
                    if (needsFailVar()) {
                        // if ($doforelse$X) ...
                        JCIdent failtest_id = at(stmt).Ident(currentForFailVariable);
                        outer.append(at(stmt).If(failtest_id, at(stmt).Block(0, failblock), null));
                    } else {
                        outer.appendList(failblock);
                    }
                }
View Full Code Here

        closeInnerSubstituionsForSpecifiedValues(currentForClause);
       
        JCStatement brk = at(stmt).Break(getLabel(stmt));
   
        if (currentForFailVariable != null) {
            JCIdent failtest_id = at(stmt).Ident(currentForFailVariable);
            List<JCStatement> list = List.<JCStatement> of(at(stmt).Exec(at(stmt).Assign(failtest_id, make().Literal(TypeTags.BOOLEAN, 0))));
            list = list.append(brk);
            return list;
        } else {
            return List.<JCStatement> of(brk);
View Full Code Here

    private Symbol enumConstant(JCTree tree, Type enumType) {
        if (tree.getTag() != JCTree.IDENT) {
            log.error(tree.pos(), "enum.label.must.be.unqualified.enum");
            return syms.errSymbol;
        }
        JCIdent ident = (JCIdent)tree;
        Name name = ident.name;
        for (Scope.Entry e = enumType.tsym.members().lookup(name);
             e.scope != null; e = e.next()) {
            if (e.sym.kind == VAR) {
                Symbol s = ident.sym = e.sym;
View Full Code Here

           concept (Select, Method Invocation, etcetera) are set to right after the dot following
           it. This doesn't happen with 'this' or anything other than super. */ {
          if (tree instanceof JCMethodInvocation) {
            JCMethodInvocation invoke = (JCMethodInvocation) tree;
            if (invoke.meth instanceof JCFieldAccess && ((JCFieldAccess) invoke.meth).selected instanceof JCIdent) {
              JCIdent selected = (JCIdent) ((JCFieldAccess) invoke.meth).selected;
              if (selected.name.toString().equals("super")) endPos = -2;
            }
          }
         
          if (tree instanceof JCFieldAccess && ((JCFieldAccess) tree).selected instanceof JCIdent) {
            JCIdent selected = (JCIdent) ((JCFieldAccess) tree).selected;
            if (selected.name.toString().equals("super")) endPos = -2;
          }
        }
       
        /* Javac bug: the 'JCAssign' starts at a dot (if present) in the expression instead of at the start of it, which is weird
View Full Code Here

    return astNode;
  }
 
  private void fillWithIdentifiers(JCTree node, StrictListAccessor<Identifier, ?> list) {
    if (node instanceof JCIdent) {
      JCIdent id = (JCIdent) node;
      list.addToEnd(setPos(node, new Identifier().astValue(id.name.toString())));
    } else if (node instanceof JCFieldAccess) {
      JCFieldAccess sel = (JCFieldAccess) node;
      fillWithIdentifiers(sel.selected, list);
      list.addToEnd(setPos(node, new Identifier().astValue(sel.name.toString())));
View Full Code Here

TOP

Related Classes of com.sun.tools.javac.tree.JCTree.JCIdent

Copyright © 2018 www.massapicom. All rights reserved.
All source code are property of their respective owners. Java is a trademark of Sun Microsystems, Inc and owned by ORACLE Inc. Contact coftware#gmail.com.