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

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


            return null;
        }
    }
   
    private ClassMirror lookupNewClassMirror(String name) {
        ClassSymbol classSymbol = null;

        String outerName = name;
        /*
         * This madness here tries to look for a class, and if it fails, tries to resolve it
         * from its parent class. This is required because a.b.C.D (where D is an inner class
         * of C) is not found in symtab.classes but in C's ClassSymbol.enclosedElements.
         */

        // make sure we load the class file, since we no longer complete packages unless we absolutely must
        loadClass(outerName);
        do{
            // we must first try with no postfix, because we can have a valid class foo.bar in Java,
            // when in Ceylon it would be foo.bar_
            classSymbol = symtab.classes.get(names.fromString(Util.quoteJavaKeywords(outerName)));
            // try again with a postfix "_"
            if (classSymbol == null && lastPartHasLowerInitial(outerName) && !outerName.endsWith("_")) {
                classSymbol = symtab.classes.get(names.fromString(Util.quoteJavaKeywords(outerName+"_")));
            }
            if(classSymbol != null){
                // if we got a source symbol for something non-Java it's a slipery slope
                if(Util.isLoadedFromSource(classSymbol) && !Util.isJavaSource(classSymbol))
                    return null;
                if(outerName.length() != name.length()){
                    try{
                        classSymbol = lookupInnerClass(classSymbol, name.substring(outerName.length()+1).split("\\."));
                    }catch(CompletionFailure x){
                        // something wrong, we will report it properly elsewhere
                        classSymbol = null;
                    }
                }
                if(classSymbol != null && classSymbol.classfile == null && classSymbol.sourcefile == null){
                    // try to complete it if that changes anything
                    try{
                        classSymbol.complete();
                    }catch(CompletionFailure x){
                        // if we can't complete it it doesn't exist, its classfile will remain null
                    }
                    if(classSymbol.classfile == null){
                        PackageSymbol pkg = classSymbol.packge();
                        // do not log an error for missing oracle jdk stuff
                        if(pkg == null || !JDKUtils.isOracleJDKAnyPackage(pkg.getQualifiedName().toString())){
                            // do not log an error because it will be logged elsewhere
                            logVerbose("Unable to find required class file for "+name);
                        }
View Full Code Here


    public MethodMirror getEnclosingMethod() {
        if (!enclosingMethodSet) {
            Symbol encl = classSymbol.getEnclosingElement();
            if (encl != null && encl instanceof MethodSymbol) {
                // it's a method, it must be in a Class
                ClassSymbol enclosingClass = (ClassSymbol) encl.getEnclosingElement();
                JavacClass enclosingClassMirror = new JavacClass(enclosingClass);
                enclosingMethod = new JavacMethod(enclosingClassMirror, (MethodSymbol)encl);
            }
            enclosingMethodSet = true;
        }
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

    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

    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

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.