Search in sources :

Example 66 with VarSymbol

use of com.sun.tools.javac.code.Symbol.VarSymbol in project ceylon-compiler by ceylon.

the class SerializedForm method computeDefaultSerializableFields.

/*
     * Compute default Serializable fields from all members of ClassSymbol.
     *
     * Since the fields of ClassDocImpl might not contain private or
     * package accessible fields, must walk over all members of ClassSymbol.
     */
private void computeDefaultSerializableFields(DocEnv env, ClassSymbol def, ClassDocImpl cd) {
    for (Scope.Entry e = def.members().elems; e != null; e = e.sibling) {
        if (e.sym != null && e.sym.kind == Kinds.VAR) {
            VarSymbol f = (VarSymbol) e.sym;
            if ((f.flags() & Flags.STATIC) == 0 && (f.flags() & Flags.TRANSIENT) == 0) {
                // ### No modifier filtering applied here.
                FieldDocImpl fd = env.getFieldDoc(f);
                // ### Add to beginning.
                // ### Preserve order used by old 'javadoc'.
                fields.prepend(fd);
            }
        }
    }
}
Also used : Scope(com.sun.tools.javac.code.Scope) VarSymbol(com.sun.tools.javac.code.Symbol.VarSymbol)

Example 67 with VarSymbol

use of com.sun.tools.javac.code.Symbol.VarSymbol in project ceylon-compiler by ceylon.

the class JavacClass method getDirectFields.

@Override
public List<FieldMirror> getDirectFields() {
    if (fields == null) {
        List<FieldMirror> ret = new LinkedList<FieldMirror>();
        for (Symbol sym : classSymbol.getEnclosedElements()) {
            if (sym instanceof VarSymbol && (sym.flags() & Flags.PRIVATE) == 0) {
                ret.add(new JavacField((VarSymbol) sym));
            }
        }
        fields = Collections.unmodifiableList(ret);
    }
    return fields;
}
Also used : FieldMirror(com.redhat.ceylon.model.loader.mirror.FieldMirror) MethodSymbol(com.sun.tools.javac.code.Symbol.MethodSymbol) Symbol(com.sun.tools.javac.code.Symbol) ClassSymbol(com.sun.tools.javac.code.Symbol.ClassSymbol) VarSymbol(com.sun.tools.javac.code.Symbol.VarSymbol) VarSymbol(com.sun.tools.javac.code.Symbol.VarSymbol) LinkedList(java.util.LinkedList)

Example 68 with VarSymbol

use of com.sun.tools.javac.code.Symbol.VarSymbol in project ceylon-compiler by ceylon.

the class JavacMethod method getParameters.

@Override
public List<VariableMirror> getParameters() {
    if (parameters == null) {
        com.sun.tools.javac.util.List<VarSymbol> params = methodSymbol.getParameters();
        List<VariableMirror> ret = new ArrayList<VariableMirror>(params.size());
        for (VarSymbol parameter : params) ret.add(new JavacVariable(parameter));
        parameters = Collections.unmodifiableList(ret);
    }
    return parameters;
}
Also used : VariableMirror(com.redhat.ceylon.model.loader.mirror.VariableMirror) ArrayList(java.util.ArrayList) VarSymbol(com.sun.tools.javac.code.Symbol.VarSymbol)

Aggregations

VarSymbol (com.sun.tools.javac.code.Symbol.VarSymbol)68 Symbol (com.sun.tools.javac.code.Symbol)29 ClassSymbol (com.sun.tools.javac.code.Symbol.ClassSymbol)23 MethodSymbol (com.sun.tools.javac.code.Symbol.MethodSymbol)22 Type (com.sun.tools.javac.code.Type)20 ExpressionTree (com.sun.source.tree.ExpressionTree)15 Tree (com.sun.source.tree.Tree)15 TypeSymbol (com.sun.tools.javac.code.Symbol.TypeSymbol)13 MethodInvocationTree (com.sun.source.tree.MethodInvocationTree)11 VariableTree (com.sun.source.tree.VariableTree)11 ClassTree (com.sun.source.tree.ClassTree)10 IdentifierTree (com.sun.source.tree.IdentifierTree)10 MemberSelectTree (com.sun.source.tree.MemberSelectTree)10 PackageSymbol (com.sun.tools.javac.code.Symbol.PackageSymbol)10 NewClassTree (com.sun.source.tree.NewClassTree)9 ArrayList (java.util.ArrayList)9 VisitorState (com.google.errorprone.VisitorState)7 MethodTree (com.sun.source.tree.MethodTree)7 TreePath (com.sun.source.util.TreePath)7 ClassType (com.sun.tools.javac.code.Type.ClassType)7