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

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


    /**
     * {@inheritDoc}
     */
    public DeclaredType getDeclaredType(TypeDeclaration decl,
                                        TypeMirror... typeArgs) {
        ClassSymbol sym = ((TypeDeclarationImpl) decl).sym;

        if (typeArgs.length == 0)
            return (DeclaredType) env.typeMaker.getType(
                                        env.jctypes.erasure(sym.type));
        if (sym.type.getEnclosingType().isParameterized())
View Full Code Here


                                        TypeDeclaration decl,
                                        TypeMirror... typeArgs) {
        if (containing == null)
            return getDeclaredType(decl, typeArgs);

        ClassSymbol sym = ((TypeDeclarationImpl) decl).sym;
        Type outer = ((TypeMirrorImpl) containing).type;

        if (outer.tsym != sym.owner.enclClass())
            throw new IllegalArgumentException(containing.toString());
        if (!outer.isParameterized())
View Full Code Here

            return allClassesFiltered;
        }
        ListBuffer<ClassDocImpl> classes = new ListBuffer<ClassDocImpl>();
        for (Scope.Entry e = sym.members().elems; e != null; e = e.sibling) {
            if (e.sym != null) {
                ClassSymbol s = (ClassSymbol)e.sym;
                ClassDocImpl c = env.getClassDoc(s);
                if (c != null && !c.isSynthetic())
                    c.addAllClasses(classes, filtered);
            }
        }
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

    /**
     * {@inheritDoc}
     */
    public DeclaredType getDeclaredType(TypeDeclaration decl,
                                        TypeMirror... typeArgs) {
        ClassSymbol sym = ((TypeDeclarationImpl) decl).sym;

        if (typeArgs.length == 0)
            return (DeclaredType) env.typeMaker.getType(
                                        env.jctypes.erasure(sym.type));
        if (sym.type.getEnclosingType().isParameterized())
View Full Code Here

                                        TypeDeclaration decl,
                                        TypeMirror... typeArgs) {
        if (containing == null)
            return getDeclaredType(decl, typeArgs);

        ClassSymbol sym = ((TypeDeclarationImpl) decl).sym;
        Type outer = ((TypeMirrorImpl) containing).type;

        if (outer.tsym != sym.owner.enclClass())
            throw new IllegalArgumentException(containing.toString());
        if (!outer.isParameterized())
View Full Code Here

    void attribBounds(List<JCTypeParameter> typarams) {
        for (JCTypeParameter typaram : typarams) {
            Type bound = typaram.type.getUpperBound();
            if (bound != null && bound.tsym instanceof ClassSymbol) {
                ClassSymbol c = (ClassSymbol)bound.tsym;
                if ((c.flags_field & COMPOUND) != 0) {
                    Assert.check((c.flags_field & UNATTRIBUTED) != 0, c);
                    attribClass(typaram.pos(), c);
                }
            }
View Full Code Here

                    || tree.name.isEmpty()){
                enter.classEnter(tree, env);
            }
        }

        ClassSymbol c = tree.sym;
        if (c == null) {
            // exit in case something drastic went wrong during enter.
            result = null;
        } else {
            // make sure class has been completed:
            c.complete();

            // Ceylon: For Ceylon, this code moved to Enter.visitClassDef so that it is available to it,
            // because that method is called before we set it here.
            if(!sourceLanguage.isCeylon()){
                // If this class appears as an anonymous class
View Full Code Here

            // Enter all type parameters into the local method scope.
            for (List<JCTypeParameter> l = tree.typarams; l.nonEmpty(); l = l.tail)
                localEnv.info.scope.enterIfAbsent(l.head.type.tsym);

            ClassSymbol owner = env.enclClass.sym;
            if ((owner.flags() & ANNOTATION) != 0 &&
                tree.params.nonEmpty())
                log.error(tree.params.head.pos(),
                          "intf.annotation.members.cant.have.params");

            // Attribute all value parameters.
            for (List<JCVariableDecl> l = tree.params; l.nonEmpty(); l = l.tail) {
                attribStat(l.head, localEnv);
            }

            chk.checkVarargsMethodDecl(localEnv, tree);

            // Check that type parameters are well-formed.
            chk.validate(tree.typarams, localEnv);

            // Check that result type is well-formed.
            chk.validate(tree.restype, localEnv);

            // annotation method checks
            if ((owner.flags() & ANNOTATION) != 0) {
                // annotation method cannot have throws clause
                if (tree.thrown.nonEmpty()) {
                    log.error(tree.thrown.head.pos(),
                            "throws.not.allowed.in.intf.annotation");
                }
                // annotation method cannot declare type-parameters
                if (tree.typarams.nonEmpty()) {
                    log.error(tree.typarams.head.pos(),
                            "intf.annotation.members.cant.have.type.params");
                }
                // validate annotation method's return type (could be an annotation type)
                chk.validateAnnotationType(tree.restype);
                // ensure that annotation method does not clash with members of Object/Annotation
                chk.validateAnnotationMethod(tree.pos(), m);

                if (tree.defaultValue != null) {
                    // if default value is an annotation, check it is a well-formed
                    // annotation value (e.g. no duplicate values, no missing values, etc.)
                    chk.validateAnnotationTree(tree.defaultValue);
                }
            }

            for (List<JCExpression> l = tree.thrown; l.nonEmpty(); l = l.tail)
                chk.checkType(l.head.pos(), l.head.type, syms.throwableType);

            if (tree.body == null) {
                // Empty bodies are only allowed for
                // abstract, native, or interface methods, or for methods
                // in a retrofit signature class.
                if ((owner.flags() & INTERFACE) == 0 &&
                    (tree.mods.flags & (ABSTRACT | NATIVE)) == 0 &&
                    !relax)
                    log.error(tree.pos(), "missing.meth.body.or.decl.abstract");
                if (tree.defaultValue != null) {
                    if ((owner.flags() & ANNOTATION) == 0)
                        log.error(tree.pos(),
                                  "default.allowed.in.intf.annotation.member");
                }
            } else if ((owner.flags() & INTERFACE) != 0) {
                log.error(tree.body.pos(), "intf.meth.cant.have.body");
            } else if ((tree.mods.flags & ABSTRACT) != 0) {
                log.error(tree.pos(), "abstract.meth.cant.have.body");
            } else if ((tree.mods.flags & NATIVE) != 0) {
                log.error(tree.pos(), "native.meth.cant.have.body");
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.