Package com.sun.tools.javac.code.Symbol

Examples of com.sun.tools.javac.code.Symbol.ClassSymbol


   */
  public static Matcher<ClassTree> nestingKind(final NestingKind kind) {
    return new Matcher<ClassTree>() {
      @Override
      public boolean matches(ClassTree classTree, VisitorState state) {
        ClassSymbol sym = ASTHelpers.getSymbol(classTree);
        return sym.getNestingKind() == kind;
      }
    };
  }
View Full Code Here


    if (isPrimitiveType(typeStr)) {
      return getPrimitiveType(typeStr);
    }
    Name typeName = getName(typeStr);
    try {
      ClassSymbol typeSymbol = getSymtab().classes.get(typeName);
      if (typeSymbol == null) {
        JavaCompiler compiler = JavaCompiler.instance(context);
        Symbol sym = compiler.resolveIdent(typeStr);
        if (!(sym instanceof ClassSymbol)) {
          return null;
        }
        typeSymbol = (ClassSymbol) sym;
      }
      Type type = typeSymbol.asType();
      // Throws CompletionFailure if the source/class file for this type is not available.
      // This is hacky but the best way I can think of to handle this case.
      type.complete();
      if (type.isErroneous()) {
        return null;
View Full Code Here

    if (!isArray && !isGeneric) {
      // Simple type.
      return baseType;
    } else if (isArray && !isGeneric) {
      // Array type, not generic.
      ClassSymbol arraySymbol = getSymtab().arrayClass;
      return new ArrayType(baseType, arraySymbol);
    } else if (!isArray && isGeneric) {
      return new ClassType(Type.noType, typeParams, baseType.tsym);
    } else {
      throw new IllegalArgumentException("Unsupported arguments to getType");
View Full Code Here

    if (!isArray && !isGeneric) {
      // Simple type.
      return baseType;
    } else if (isArray && !isGeneric) {
      // Array type, not generic.
      ClassSymbol arraySymbol = getSymtab().arrayClass;
      return new ArrayType(baseType, arraySymbol);
    } else if (!isArray && isGeneric) {
      // Generic type, not array.
      List<Type> typeParamsCopy = List.from(typeParams.toArray(new Type[typeParams.size()]));
      return new ClassType(Type.noType, typeParamsCopy, baseType.tsym);
View Full Code Here

  private MethodSymbol supermethod;

  @Override
  public Description matchMethod(MethodTree tree, VisitorState state) {
    MethodSymbol method = (MethodSymbol) ASTHelpers.getSymbol(tree);
    ClassSymbol classSym = method.enclClass();
    TypeSymbol superClass = classSym.getSuperclass().tsym;

    for (Symbol s : superClass.members().getElements()) {
      if (s.name.contentEquals(method.name) && s.getKind() == ElementKind.METHOD) {
        MethodSymbol supermethod = (MethodSymbol) s;
View Full Code Here

    Collection<? extends Element> listgetSameNameEls(Iterable<? extends Element> list, Name varName, java.util.List<? extends Type> args) {
        Collection<Element> els = new ArrayList<Element>();
        for (Element e : list) {
            final Name elName;
            if (e instanceof ClassSymbol) {
                ClassSymbol ct = (ClassSymbol) e;
                elName = ct.getQualifiedName();
            } else {
                elName = (Name) e.getSimpleName();
            }
            if (elName.equals(varName) || e.getSimpleName().equals(varName)) {
                if (args != null) {//isEmpty means empty-args method
View Full Code Here

    }

    protected abstract void processElement(final Element e, TypeElement ann, boolean warningsOnly);

    public DeclaredType getDeclaredType(String className) {
        ClassSymbol typ = getTypeElement(className);
        return typeUtils.getDeclaredType(typ);
    }
View Full Code Here

        return typeUtils.getDeclaredType(typ);
    }

    public ClassSymbol getTypeElement(String className) {
        className = rs.getName(className).toString();
        final ClassSymbol typ = elementUtils.getTypeElement(className);
        return typ;
    }
View Full Code Here

                    lb.add(t);
                }
                paramTypes = lb.toList();
            }

            ClassSymbol sym = (ClassSymbol) types.upperBound(tsym.type).tsym;

            Symbol msym = (memberName == sym.name)
                    ? findConstructor(sym, paramTypes)
                    : findMethod(sym, memberName, paramTypes);
            if (paramTypes != null) {
View Full Code Here

            MethodSymbol ee = (MethodSymbol) javadocSymbol;
            params = ptag.isTypeParameter()
                    ? ee.getTypeParameters()
                    : ee.getParameters();
        } else if (kind.isClass() || kind.isInterface()) {
            ClassSymbol te = (ClassSymbol) javadocSymbol;
            params = te.getTypeParameters();
        }

        for (Symbol param : params) {
            if (param.getSimpleName() == ptag.getName().getName()) {
                return param;
View Full Code Here

TOP

Related Classes of com.sun.tools.javac.code.Symbol.ClassSymbol

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.