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

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


   *
   * TODO(user): Are there other places this could be used?
   */
  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();
    }
View Full Code Here


   *    a.bar().foo() ==> type of a.bar()
   *    this.foo() ==> type of this
   */
  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;
    }
View Full Code Here

        (!isWildCard && !sym.getQualifiedName().equals(state.getName(methodName)))) {  // methodName doesn't match
      return false;
    }

    if (item instanceof JCFieldAccess) {
      JCFieldAccess fieldAccess = (JCFieldAccess) item;
      return receiverMatcher.matches(fieldAccess.getExpression(), state);
    } else if (item instanceof JCIdent) {
      // There's no explicit receiver in this case, so try the receiverMatcher against null. If it
      // throws a NullPointerException (i.e., it cares about the input), then return false.
      try {
        return receiverMatcher.matches(null, state);
View Full Code Here

        }
        ExpressionTree arg = args.get(argNum);

        JCExpression methodSelect = (JCExpression) t.getMethodSelect();
        if (methodSelect instanceof JCFieldAccess) {
          JCFieldAccess fieldAccess = (JCFieldAccess) methodSelect;
          return ASTHelpers.sameVariable(fieldAccess.getExpression(), arg);
        } else if (methodSelect instanceof JCIdent) {
          // A bare method call: "equals(foo)".  Receiver is implicitly "this".
          return "this".equals(arg.toString());
        }
View Full Code Here

  }

  private static String getMethodName(ExpressionTree tree) {
    MethodInvocationTree method = (MethodInvocationTree) tree;
    ExpressionTree expressionTree = method.getMethodSelect();
    JCFieldAccess access = (JCFieldAccess) expressionTree;
    return access.sym.getQualifiedName().toString();
  }
View Full Code Here

      if (!returnsListMatcher.matches(method, state)) {
        return false;
      }
      ExpressionTree expressionTree = method.getMethodSelect();
      if (expressionTree instanceof JCFieldAccess) {
        JCFieldAccess access = (JCFieldAccess) expressionTree;
        String methodName = access.sym.getQualifiedName().toString();
        return isFieldGetMethod(methodName);
      }
      return true;
    }
View Full Code Here

      if (returnsListMatcher.matches(method, state)) {
        return false;
      }
      ExpressionTree expressionTree = method.getMethodSelect();
      if (expressionTree instanceof JCFieldAccess) {
        JCFieldAccess access = (JCFieldAccess) expressionTree;
        String methodName = access.sym.getQualifiedName().toString();
        return isFieldGetMethod(methodName);
      }
      return true;
    }
View Full Code Here

 
  public void parseJCTree_JCMethodInvocation(com.sun.tools.javac.tree.JCTree.JCMethodInvocation inv) {
//    System.out.println("INV: " + inv);
   
    JCFieldAccess fa = null;
    String mName = null;
    if(inv.meth instanceof JCFieldAccess) {
      fa = (JCFieldAccess)inv.meth;
      mName = fa.getIdentifier().toString();
    } else {
      mName = inv.meth.toString();
    }
   
    if("super".equals(mName)) {
      parseSuperConstructorInvocation(inv);
      return;
    }
   
   
    if(null!=fa && null != fa.getExpression()) {
//      System.out.println("PARSE EXPT:: " + fa.getExpression().getClass());
      parse(fa.getExpression());
    } else {
      for(int i=currentClass.size()-1; i>=0;i--) {
        ParsedClass cl = currentClass.get(i);
        if(cl.staticMethods.contains(mName)) {
          ParsedMethod m = cl.methods.get(mName);
View Full Code Here

            ListBuffer<JCTree> defs = new ListBuffer<JCTree>();
            for (JCTree def: tree.defs) {
                if (def.getTag() == JCTree.Tag.IMPORT) {
                    JCImport imp = (JCImport) def;
                    if (imp.qualid.getTag() == JCTree.Tag.SELECT) {
                        JCFieldAccess qualid = (JCFieldAccess) imp.qualid;
                        if (!qualid.name.toString().equals("*")
                                && !names.contains(qualid.name)) {
                            continue;
                        }
                    }
View Full Code Here

        for (JCTree t : compenv.toplevel.defs) {
            if (t.hasTag(IMPORT)) {
                JCTree imp = ((JCImport) t).qualid;
                if (TreeInfo.name(imp) == names.asterisk) {
                    JCFieldAccess sel = (JCFieldAccess)imp;
                    Symbol s = sel.selected.type.tsym;
                    PackageDocImpl pdoc = env.getPackageDoc(s.packge());
                    if (!importedPackages.contains(pdoc))
                        importedPackages.append(pdoc);
                }
View Full Code Here

TOP

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

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.