Java 类com.sun.source.tree.ParameterizedTypeTree 实例源码

项目:incubator-netbeans    文件:ElementOverlay.java   
private String fqnFor(Tree t) {
    Element el = ASTService.getElementImpl(t);

    if (el != null) {
        if (el.getKind().isClass() || el.getKind().isInterface() || el.getKind() == ElementKind.PACKAGE) {
            return ((QualifiedNameable) el).getQualifiedName().toString();
        } else {
            Logger.getLogger(ElementOverlay.class.getName()).log(Level.SEVERE, "Not a QualifiedNameable: {0}", el);
            return null;
        }
    } else if (t instanceof QualIdentTree) {
        return ((QualIdentTree) t).getFQN();
    } else if (t.getKind() == Kind.PARAMETERIZED_TYPE) {
        return fqnFor(((ParameterizedTypeTree) t).getType());
    } else {
        Logger.getLogger(ElementOverlay.class.getName()).log(Level.FINE, "No element and no QualIdent");
        return null;
    }
}
项目:incubator-netbeans    文件:ConvertToDiamondBulkHint.java   
@Override
protected void performRewrite(TransformationContext ctx) {
    WorkingCopy copy = ctx.getWorkingCopy();
    TreePath tp = ctx.getPath();
    if (tp.getLeaf().getKind() != Tree.Kind.NEW_CLASS) {
        //XXX: warning
        return ;
    }

    NewClassTree nct = (NewClassTree) tp.getLeaf();

    if (nct.getIdentifier().getKind() != Tree.Kind.PARAMETERIZED_TYPE) {
        //XXX: warning
        return ;
    }

    TreeMaker make = copy.getTreeMaker();
    ParameterizedTypeTree ptt = (ParameterizedTypeTree) nct.getIdentifier();
    ParameterizedTypeTree nue = make.ParameterizedType(ptt.getType(), Collections.<Tree>emptyList());

    copy.rewrite(ptt, nue);
}
项目:jCode    文件:RestUtils.java   
private static ClassTree createGetClasses(WorkingCopy workingCopy, TreeMaker maker, ClassTree newTree, RestSupport restSupport, List<String> providerClasses) {

        ModifiersTree modifiersTree = maker.Modifiers(
                EnumSet.of(Modifier.PUBLIC), Collections.singletonList(
                maker.Annotation(maker.QualIdent(
                        Override.class.getCanonicalName()),
                        Collections.<ExpressionTree>emptyList())));

        WildcardTree wildCard = maker.Wildcard(Tree.Kind.UNBOUNDED_WILDCARD,
                null);
        ParameterizedTypeTree wildClass = maker.ParameterizedType(
                maker.QualIdent(Class.class.getCanonicalName()),
                Collections.singletonList(wildCard));
        ParameterizedTypeTree wildSet = maker.ParameterizedType(
                maker.QualIdent(Set.class.getCanonicalName()),
                Collections.singletonList(wildClass));

        MethodTree methodTree = maker.Method(modifiersTree,
                RestConstants.GET_CLASSES, wildSet,
                Collections.<TypeParameterTree>emptyList(),
                Collections.<VariableTree>emptyList(),
                Collections.<ExpressionTree>emptyList(),
                createBodyForGetClassesMethod(restSupport, providerClasses), null);
        return maker.addClassMember(newTree, methodTree);
    }
项目:error-prone    文件:ASTHelpers.java   
/**
 * Gets the symbol declared by a tree. Returns null if {@code tree} does not declare a symbol or
 * is null.
 */
public static Symbol getDeclaredSymbol(Tree tree) {
  if (tree instanceof AnnotationTree) {
    return getSymbol(((AnnotationTree) tree).getAnnotationType());
  }
  if (tree instanceof PackageTree) {
    return getSymbol((PackageTree) tree);
  }
  if (tree instanceof ParameterizedTypeTree) {
    return getSymbol(((ParameterizedTypeTree) tree).getType());
  }
  if (tree instanceof TypeParameterTree) {
    Type type = ((JCTypeParameter) tree).type;
    return type == null ? null : type.tsym;
  }
  if (tree instanceof ClassTree) {
    return getSymbol((ClassTree) tree);
  }
  if (tree instanceof MethodTree) {
    return getSymbol((MethodTree) tree);
  }
  if (tree instanceof VariableTree) {
    return getSymbol((VariableTree) tree);
  }
  return null;
}
项目:error-prone    文件:JdkObsolete.java   
private static Optional<Fix> linkedListFix(Tree tree, VisitorState state) {
  Type type = getTargetType(state);
  if (type == null) {
    return Optional.empty();
  }
  Types types = state.getTypes();
  for (String replacement : ImmutableList.of("java.util.ArrayList", "java.util.ArrayDeque")) {
    Symbol sym = state.getSymbolFromString(replacement);
    if (sym == null) {
      continue;
    }
    if (types.isAssignable(types.erasure(sym.asType()), types.erasure(type))) {
      SuggestedFix.Builder fix = SuggestedFix.builder();
      while (tree instanceof ParameterizedTypeTree) {
        tree = ((ParameterizedTypeTree) tree).getType();
      }
      fix.replace(tree, SuggestedFixes.qualifyType(state, fix, sym));
      return Optional.of(fix.build());
    }
  }
  return Optional.empty();
}
项目:checker-framework    文件:BaseTypeValidator.java   
/**
 * Checks that the annotations on the type arguments supplied to a type or a
 * method invocation are within the bounds of the type variables as
 * declared, and issues the "type.argument.type.incompatible" error if they are
 * not.
 *
 * This method used to be visitParameterizedType, which incorrectly handles
 * the main annotation on generic types.
 */
protected Void visitParameterizedType(AnnotatedDeclaredType type,
        ParameterizedTypeTree tree) {
    // System.out.printf("TypeValidator.visitParameterizedType: type: %s, tree: %s\n",
    // type, tree);

    if (TreeUtils.isDiamondTree(tree))
        return null;

    final TypeElement element = (TypeElement) type.getUnderlyingType().asElement();
    if (checker.shouldSkipUses(element))
        return null;

    List<AnnotatedTypeVariable> typevars = atypeFactory.typeVariablesFromUse(type, element);

    visitor.checkTypeArguments(tree, typevars, type.getTypeArguments(),
            tree.getTypeArguments());

    return null;
}
项目:checker-framework    文件:TypeFromTree.java   
@Override
public AnnotatedTypeMirror visitParameterizedType(
        ParameterizedTypeTree node, AnnotatedTypeFactory f) {

    List<AnnotatedTypeMirror> args = new LinkedList<AnnotatedTypeMirror>();
    for (Tree t : node.getTypeArguments()) {
        args.add(visit(t, f));
    }

    AnnotatedTypeMirror result = f.type(node); // use creator?
    AnnotatedTypeMirror atype = visit(node.getType(), f);
    result.addAnnotations(atype.getAnnotations());
    // new ArrayList<>() type is AnnotatedExecutableType for some reason

    if (result instanceof AnnotatedDeclaredType) {
        assert result instanceof AnnotatedDeclaredType : node + " --> " + result;
        ((AnnotatedDeclaredType)result).setTypeArguments(args);
    }
    return result;
}
项目:incubator-netbeans    文件:TreeDuplicator.java   
@Override
public Tree visitParameterizedType(ParameterizedTypeTree tree, Void p) {
    ParameterizedTypeTree n = make.ParameterizedType(tree.getType(), tree.getTypeArguments());
    model.setType(n, model.getType(tree));
    comments.copyComments(tree, n);
    model.setPos(n, model.getPos(tree));
    return n;
}
项目:incubator-netbeans    文件:CopyFinder.java   
public Boolean visitParameterizedType(ParameterizedTypeTree node, TreePath p) {
    if (p == null)
        return super.visitParameterizedType(node, p);

    ParameterizedTypeTree t = (ParameterizedTypeTree) p.getLeaf();

    if (!scan(node.getType(), t.getType(), p))
        return false;

    return checkLists(node.getTypeArguments(), t.getTypeArguments(), p);
}
项目:incubator-netbeans    文件:JavaFixUtilities.java   
@Override
public Number visitParameterizedType(ParameterizedTypeTree node, Void p) {
    List<? extends ExpressionTree> typeArgs = (List<? extends ExpressionTree>) resolveMultiParameters(node.getTypeArguments());
    ParameterizedTypeTree nue = make.ParameterizedType(node.getType(), typeArgs);

    rewrite(node, nue);
    return super.visitParameterizedType(node, p);
}
项目:incubator-netbeans    文件:CreateElementUtilities.java   
private static List<? extends TypeMirror> computeNewClass(Set<ElementKind> types, CompilationInfo info, TreePath parent, Tree error, int offset) {
    NewClassTree nct = (NewClassTree) parent.getLeaf();
    boolean errorInRealArguments = false;

    for (Tree param : nct.getArguments()) {
        errorInRealArguments |= param == error;
    }

    if (errorInRealArguments) {
        List<TypeMirror> proposedTypes = new ArrayList<TypeMirror>();
        int[] proposedIndex = new int[1];
        List<ExecutableElement> ee = fuzzyResolveMethodInvocation(info, parent, proposedTypes, proposedIndex);

        if (ee.isEmpty()) { //cannot be resolved
            return null;
        }

        types.add(ElementKind.PARAMETER);
        types.add(ElementKind.LOCAL_VARIABLE);
        types.add(ElementKind.FIELD);

        return proposedTypes;
    }

    Tree id = nct.getIdentifier();

    if (id.getKind() == Kind.PARAMETERIZED_TYPE) {
        id = ((ParameterizedTypeTree) id).getType();
    }

    if (id == error) {
        return resolveType(EnumSet.noneOf(ElementKind.class), info, parent.getParentPath(), nct, offset, null, null);
    }

    return null;
}
项目:incubator-netbeans    文件:BreadCrumbsNodeImpl.java   
private static String simpleName(Tree t) {
    switch (t.getKind()) {
        case PARAMETERIZED_TYPE:
            return simpleName(((ParameterizedTypeTree) t).getType());
        case IDENTIFIER:
            return ((IdentifierTree) t).getName().toString();
        case MEMBER_SELECT:
            return ((MemberSelectTree) t).getIdentifier().toString();
        default:
            return "";//XXX
    }
}
项目:incubator-netbeans    文件:TreeNode.java   
@Override
public Void visitParameterizedType(ParameterizedTypeTree tree, List<Node> d) {
    List<Node> below = new ArrayList<Node>();

    addCorrespondingElement(below);
    addCorrespondingType(below);
    addCorrespondingComments(below);

    super.visitParameterizedType(tree, below);

    d.add(new TreeNode(info, getCurrentPath(), below));
    return null;
}
项目:incubator-netbeans    文件:CreateElementUtilities.java   
private static List<? extends TypeMirror> computeNewClass(Set<ElementKind> types, CompilationInfo info, TreePath parent, Tree error, int offset) {
    NewClassTree nct = (NewClassTree) parent.getLeaf();
    boolean errorInRealArguments = false;

    for (Tree param : nct.getArguments()) {
        errorInRealArguments |= param == error;
    }

    if (errorInRealArguments) {
        List<TypeMirror> proposedTypes = new ArrayList<TypeMirror>();
        int[] proposedIndex = new int[1];
        List<ExecutableElement> ee = org.netbeans.modules.editor.java.Utilities.fuzzyResolveMethodInvocation(info, parent, proposedTypes, proposedIndex);

        if (ee.isEmpty()) { //cannot be resolved
            return null;
        }

        types.add(ElementKind.PARAMETER);
        types.add(ElementKind.LOCAL_VARIABLE);
        types.add(ElementKind.FIELD);

        return proposedTypes;
    }

    Tree id = nct.getIdentifier();

    if (id.getKind() == Kind.PARAMETERIZED_TYPE) {
        id = ((ParameterizedTypeTree) id).getType();
    }

    if (id == error) {
        return resolveType(EnumSet.noneOf(ElementKind.class), info, parent.getParentPath(), nct, offset, null, null);
    }

    return null;
}
项目:incubator-netbeans    文件:ComputeImports.java   
private void filterByKind(Tree toFilter, Set<ElementKind> acceptedKinds, Set<ElementKind> notAcceptedKinds) {
    if (toFilter == null) return;
    switch (toFilter.getKind()) {
        case IDENTIFIER:
            hints.add(new KindHint(((IdentifierTree) toFilter).getName().toString(), acceptedKinds, notAcceptedKinds));
            break;
        case PARAMETERIZED_TYPE:
            filterByKind(((ParameterizedTypeTree) toFilter).getType(), acceptedKinds, notAcceptedKinds);
            break;
    }
}
项目:javaide    文件:JavaInputAstVisitor.java   
@Override
public Void visitParameterizedType(ParameterizedTypeTree node, Void unused) {
    sync(node);
    if (node.getTypeArguments().isEmpty()) {
        scan(node.getType(), null);
        token("<");
        token(">");
    } else {
        builder.open(plusFour);
        scan(node.getType(), null);
        token("<");
        builder.breakOp();
        builder.open(ZERO);
        boolean first = true;
        for (Tree typeArgument : node.getTypeArguments()) {
            if (!first) {
                token(",");
                // TODO(cushon): unify breaks
                builder.breakToFill(" ");
            }
            scan(typeArgument, null);
            first = false;
        }
        builder.close();
        builder.close();
        token(">");
    }
    return null;
}
项目:oblivion-netbeans-plugin    文件:VariableMutableTreeNode.java   
private String createType(VariableTree tree) {
    Tree returnType = tree.getType();

    if (returnType instanceof ParameterizedTypeTree || returnType instanceof ArrayTypeTree) {
        return returnType.toString();
    } else {
        return TreeUtils.getTokenFromIdentifierTree(returnType).getImage();
    }
}
项目:oblivion-netbeans-plugin    文件:MethodMutableTreeNode.java   
private String createDataType(Tree returnType) {
    if (returnType instanceof ParameterizedTypeTree || returnType instanceof ArrayTypeTree) {
        return returnType.toString();
    } else {
        return TreeUtils.getTokenFromIdentifierTree(returnType).getImage();
    }
}
项目:annotation-tools    文件:TreeFinder.java   
@Override
public Pair<ASTRecord, Integer> visitParameterizedType(ParameterizedTypeTree node, Insertion ins) {
  Tree parent = parent(node);
  dbug.debug("TypePositionFinder.visitParameterizedType %s parent=%s%n",
      node, parent);
  Integer pos = getBaseTypePosition(((JCTypeApply) node).getType()).b;
  return Pair.of(astRecord(node), pos);
}
项目:annotation-tools    文件:ASTPathCriterion.java   
private boolean checkTypePath(int i, Tree typeTree) {
        try {
loop:       while (typeTree != null && i < astPath.size()) {
                ASTPath.ASTEntry entry = astPath.get(i);
                Tree.Kind kind = entry.getTreeKind();
                switch (kind) {
                case ANNOTATED_TYPE:
                    typeTree = ((AnnotatedTypeTree) typeTree)
                        .getUnderlyingType();
                    continue;
                case ARRAY_TYPE:
                    typeTree = ((ArrayTypeTree) typeTree).getType();
                    break;
                case MEMBER_SELECT:
                    typeTree = ((MemberSelectTree) typeTree).getExpression();
                    break;
                case PARAMETERIZED_TYPE:
                    if (entry.childSelectorIs(ASTPath.TYPE_ARGUMENT)) {
                        int arg = entry.getArgument();
                        typeTree = ((ParameterizedTypeTree) typeTree)
                                .getTypeArguments().get(arg);
                    } else {  // TYPE
                        typeTree = ((ParameterizedTypeTree) typeTree).getType();
                    }
                    break;
                default:
                    if (isWildcard(kind)) {
                        return ++i == astPath.size();  // ???
                    }
                    break loop;
                }
                ++i;
            }
        } catch (RuntimeException ex) {}
        return false;
    }
项目:refactor-faster    文件:UTypeApply.java   
@Override
@Nullable
public Unifier visitParameterizedType(
    ParameterizedTypeTree typeApply, @Nullable Unifier unifier) {
  unifier = getType().unify(typeApply.getType(), unifier);
  return Unifier.unifyList(unifier, getTypeArguments(), typeApply.getTypeArguments());
}
项目:generic-type-inference-solver    文件:DataflowInferenceTreeAnnotator.java   
@Override
public Void visitParameterizedType(final ParameterizedTypeTree param, final AnnotatedTypeMirror atm) {
    TreePath path = atypeFactory.getPath(param);
    if (path != null) {
        final TreePath parentPath = path.getParentPath();
        final Tree parentNode = parentPath.getLeaf();
        if (!parentNode.getKind().equals(Kind.NEW_CLASS)) {
            variableAnnotator.visit(atm, param);
        }
    }
    return null;
}
项目:error-prone    文件:ErrorProneScanner.java   
@Override
public Void visitParameterizedType(ParameterizedTypeTree tree, VisitorState visitorState) {
  VisitorState state = visitorState.withPath(getCurrentPath());
  for (ParameterizedTypeTreeMatcher matcher : parameterizedTypeMatchers) {
    if (!isSuppressed(matcher, state)) {
      try {
        reportMatch(matcher.matchParameterizedType(tree, state), tree, state);
      } catch (Throwable t) {
        handleError(matcher, t);
      }
    }
  }
  return super.visitParameterizedType(tree, state);
}
项目:error-prone    文件:UTypeApply.java   
@Override
@Nullable
public Choice<Unifier> visitParameterizedType(
    ParameterizedTypeTree typeApply, @Nullable Unifier unifier) {
  Choice<Unifier> choice = getType().unify(typeApply.getType(), unifier);
  if (getTypeArguments().isEmpty()) {
    // the template uses diamond syntax; accept anything except raw
    return choice.condition(typeApply.getTypeArguments() != null);
  } else {
    return choice.thenChoose(unifications(getTypeArguments(), typeApply.getTypeArguments()));
  }
}
项目:error-prone    文件:IterablePathParameter.java   
@Override
public Description matchVariable(VariableTree tree, VisitorState state) {
  Type type = ASTHelpers.getType(tree);
  VarSymbol symbol = ASTHelpers.getSymbol(tree);
  if (type == null || symbol == null) {
    return NO_MATCH;
  }
  if (symbol.getKind() != ElementKind.PARAMETER) {
    return NO_MATCH;
  }
  if (!isSameType(type, state.getSymtab().iterableType, state)) {
    return NO_MATCH;
  }
  if (type.getTypeArguments().isEmpty()) {
    return NO_MATCH;
  }
  if (!isSameType(
      wildBound(getOnlyElement(type.getTypeArguments())),
      state.getTypeFromString(Path.class.getName()),
      state)) {
    return NO_MATCH;
  }
  Description.Builder description = buildDescription(tree);
  if (tree.getType() instanceof ParameterizedTypeTree) {
    description.addFix(
        SuggestedFix.builder()
            .addImport("java.util.Collection")
            .replace(((ParameterizedTypeTree) tree.getType()).getType(), "Collection")
            .build());
  }
  return description.build();
}
项目:checker-framework    文件:TreeUtils.java   
/**
 * Returns true if the tree is of a diamond type.
 * In contrast to the implementation in TreeInfo, this version
 * works on Trees.
 *
 * @see com.sun.tools.javac.tree.TreeInfo#isDiamond(JCTree)
 */
public static final boolean isDiamondTree(Tree tree) {
    switch (tree.getKind()) {
    case ANNOTATED_TYPE: return isDiamondTree(((AnnotatedTypeTree)tree).getUnderlyingType());
    case PARAMETERIZED_TYPE: return ((ParameterizedTypeTree)tree).getTypeArguments().isEmpty();
    case NEW_CLASS: return isDiamondTree(((NewClassTree)tree).getIdentifier());
    default: return false;
    }
}
项目:checker-framework    文件:Locations.java   
@Override
public Void visitParameterizedType(ParameterizedTypeTree tree, Void p) {
    if (locations) {
        for (@SuppressWarnings("unused") Tree t : tree.getTypeArguments())
            System.out.println("parameterized type");
    }
    return super.visitParameterizedType(tree, p);
}
项目:groovy-cps    文件:Translator.java   
@Override
public JType visitParameterizedType(ParameterizedTypeTree pt, Void __) {
    JClass base = (JClass)visit(pt.getType());
    List<JClass> args = new ArrayList<>();
    for (Tree arg : pt.getTypeArguments()) {
        args.add((JClass)visit(arg));
    }
    return base.narrow(args);
}
项目:Refaster    文件:UTypeApply.java   
@Override
@Nullable
public Unifier visitParameterizedType(
    ParameterizedTypeTree typeApply, @Nullable Unifier unifier) {
  unifier = getType().unify(typeApply.getType(), unifier);
  return Unifier.unifyList(unifier, getTypeArguments(), typeApply.getTypeArguments());
}
项目:vertx-codegen    文件:TreeTypeInternal.java   
@Override
public String rawName() {
  if (type instanceof ParameterizedTypeTree) {
    ParameterizedTypeTree parameterizedType = (ParameterizedTypeTree) type;
    return ((TypeElement)((JCTree.JCTypeApply) parameterizedType).type.asElement()).getQualifiedName().toString();
  }
  return null;
}
项目:bazel    文件:TreeUtils.java   
/**
 * Returns true if the tree is of a diamond type. In contrast to the implementation in TreeInfo,
 * this version works on Trees.
 *
 * @see com.sun.tools.javac.tree.TreeInfo#isDiamond(JCTree)
 */
public static final boolean isDiamondTree(Tree tree) {
    switch (tree.getKind()) {
        case ANNOTATED_TYPE:
            return isDiamondTree(((AnnotatedTypeTree) tree).getUnderlyingType());
        case PARAMETERIZED_TYPE:
            return ((ParameterizedTypeTree) tree).getTypeArguments().isEmpty();
        case NEW_CLASS:
            return isDiamondTree(((NewClassTree) tree).getIdentifier());
        default:
            return false;
    }
}
项目:compile-testing    文件:TreeDiffer.java   
@Override
public Void visitParameterizedType(ParameterizedTypeTree expected, Tree actual) {
  Optional<ParameterizedTypeTree> other = checkTypeAndCast(expected, actual);
  if (!other.isPresent()) {
    addTypeMismatch(expected, actual);
    return null;
  }

  scan(expected.getType(), other.get().getType());
  parallelScan(expected.getTypeArguments(), other.get().getTypeArguments());
  return null;
}
项目:yield4j    文件:JavaTreeBuilderNew.java   
@Override
public Wrapper visitParameterizedType(ParameterizedTypeTree arg0,
        Void arg1) {
    return new GenericTypeWrapper(arg0, visit(arg0.getType(),
            ExpressionWrapper.class), visitList(
            arg0.getTypeArguments(), ExpressionWrapper.class));
}
项目:incubator-netbeans    文件:Flow.java   
public Boolean visitParameterizedType(ParameterizedTypeTree node, ConstructorData p) {
    super.visitParameterizedType(node, p);
    return null;
}
项目:incubator-netbeans    文件:Utilities.java   
private String simpleName(Tree t) {
    if (t == null) {
        return Bundle.DisplayName_Unknown();
    }
    if (t.getKind() == Kind.IDENTIFIER) {
        return ((IdentifierTree) t).getName().toString();
    }

    if (t.getKind() == Kind.MEMBER_SELECT) {
        return ((MemberSelectTree) t).getIdentifier().toString();
    }

    if (t.getKind() == Kind.METHOD_INVOCATION) {
        return scan(t, null);
    }

    if (t.getKind() == Kind.PARAMETERIZED_TYPE) {
        return simpleName(((ParameterizedTypeTree) t).getType()) + "<...>"; // NOI18N
    }

    if (t.getKind() == Kind.ARRAY_ACCESS) {
        return simpleName(((ArrayAccessTree) t).getExpression()) + "[]"; //NOI18N
    }

    if (t.getKind() == Kind.PARENTHESIZED) {
        return "(" + simpleName(((ParenthesizedTree)t).getExpression()) + ")"; //NOI18N
    }

    if (t.getKind() == Kind.TYPE_CAST) {
        return simpleName(((TypeCastTree)t).getType());
    }

    if (t.getKind() == Kind.ARRAY_TYPE) {
        return simpleName(((ArrayTypeTree)t).getType());
    }

    if (t.getKind() == Kind.PRIMITIVE_TYPE) {
        return ((PrimitiveTypeTree) t).getPrimitiveTypeKind().name().toLowerCase();
    }

    throw new IllegalStateException("Currently unsupported kind of tree: " + t.getKind()); // NOI18N
}
项目:incubator-netbeans    文件:ExpectedTypeResolver.java   
@Override
public List<? extends TypeMirror> visitParameterizedType(ParameterizedTypeTree node, Object p) {
    return null;
}
项目:incubator-netbeans    文件:ComputeImports.java   
@Override
public Void visitParameterizedType(ParameterizedTypeTree node, Map<String, Object> p) {
    scan(node.getType(), p);
    scan(node.getTypeArguments(), new HashMap<String, Object>());
    return null;
}
项目:incubator-netbeans    文件:Utilities.java   
private static String varNameForTree(Tree et) {
    if (et == null)
        return null;
    switch (et.getKind()) {
        case IDENTIFIER:
            return ((IdentifierTree) et).getName().toString();
        case MEMBER_SELECT:
            return ((MemberSelectTree) et).getIdentifier().toString();
        case METHOD_INVOCATION:
            return varNameForTree(((MethodInvocationTree) et).getMethodSelect());
        case NEW_CLASS:
            return firstToLower(varNameForTree(((NewClassTree) et).getIdentifier()));
        case PARAMETERIZED_TYPE:
            return firstToLower(varNameForTree(((ParameterizedTypeTree) et).getType()));
        case STRING_LITERAL:
            String name = guessLiteralName((String) ((LiteralTree) et).getValue());
            if (name == null) {
                return firstToLower(String.class.getSimpleName());
            } else {
                return firstToLower(name);
            }
        case VARIABLE:
            return ((VariableTree) et).getName().toString();
        case ARRAY_ACCESS:
            name = varNameForTree(((ArrayAccessTree)et).getExpression());
            if (name != null) {
                String singular = getSingular(name);
                if (singular != null) {
                    return singular;
                }
            }
            return null;
        case ASSIGNMENT:
            if (((AssignmentTree)et).getExpression() != null) {
                return varNameForTree(((AssignmentTree)et).getExpression());
            }
            return null;
        default:
            return null;
    }
}
项目:incubator-netbeans    文件:ExpressionScanner.java   
@Override
public List<Tree> visitParameterizedType(ParameterizedTypeTree node, ExpressionScanner.ExpressionsInfo p) {
    return null;
}
项目:incubator-netbeans    文件:EvaluatorVisitor.java   
@Override
public Mirror visitParameterizedType(ParameterizedTypeTree arg0, EvaluationContext evaluationContext) {
    return arg0.getType().accept(this, evaluationContext);
}