Java Code Examples for com.sun.tools.javac.code.Symbol.ClassSymbol#members()

The following examples show how to use com.sun.tools.javac.code.Symbol.ClassSymbol#members() . You can vote up the ones you like or vote down the ones you don't like, and go to the original project or source file by following the links above each example. You may check out the related API usage on the sidebar.
Example 1
Source File: SerializedForm.java    From TencentKona-8 with GNU General Public License v2.0 6 votes vote down vote up
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);
            }
        }
    }
}
 
Example 2
Source File: SerializedForm.java    From jdk8u60 with GNU General Public License v2.0 6 votes vote down vote up
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);
            }
        }
    }
}
 
Example 3
Source File: AnnotationProxyMaker.java    From java-n-IDE-for-Android with Apache License 2.0 6 votes vote down vote up
/**
 * Returns a map from element symbols to their values.
 * Includes all elements, whether explicit or defaulted.
 */
private Map<MethodSymbol, Attribute> getAllValues() {
    Map<MethodSymbol, Attribute> res =
        new LinkedHashMap<MethodSymbol, Attribute>();

    // First find the default values.
    ClassSymbol sym = (ClassSymbol) anno.type.tsym;
    for (Scope.Entry e = sym.members().elems; e != null; e = e.sibling) {
        if (e.sym.kind == Kinds.MTH) {
            MethodSymbol m = (MethodSymbol) e.sym;
            Attribute def = m.getDefaultValue();
            if (def != null)
                res.put(m, def);
        }
    }
    // Next find the explicit values, possibly overriding defaults.
    for (Pair<MethodSymbol, Attribute> p : anno.values)
        res.put(p.fst, p.snd);
    return res;
}
 
Example 4
Source File: SerializedForm.java    From openjdk-jdk8u with GNU General Public License v2.0 6 votes vote down vote up
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);
            }
        }
    }
}
 
Example 5
Source File: ElementsService.java    From netbeans with Apache License 2.0 6 votes vote down vote up
public boolean alreadyDefinedIn(CharSequence name, TypeMirror returnType, List<TypeMirror> paramTypes, TypeElement enclClass) {
    ClassSymbol clazz = (ClassSymbol)enclClass;
    Scope scope = clazz.members();
    Name n = names.fromString(name.toString());
    ListBuffer<Type> buff = new ListBuffer<>();
    for (TypeMirror tm : paramTypes) {
        buff.append((Type)tm);
    }
    for (Symbol sym : scope.getSymbolsByName(n, Scope.LookupKind.NON_RECURSIVE)) {
        if(sym.type instanceof ExecutableType &&
                jctypes.containsTypeEquivalent(sym.type.asMethodType().getParameterTypes(), buff.toList()) &&
                jctypes.isSameType(sym.type.asMethodType().getReturnType(), (Type)returnType))
            return true;
    }
    return false;
}
 
Example 6
Source File: SerializedForm.java    From openjdk-jdk8u-backup with GNU General Public License v2.0 6 votes vote down vote up
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);
            }
        }
    }
}
 
Example 7
Source File: AnnotationProxyMaker.java    From javaide with GNU General Public License v3.0 6 votes vote down vote up
/**
 * Returns a map from element symbols to their values.
 * Includes all elements, whether explicit or defaulted.
 */
private Map<MethodSymbol, Attribute> getAllValues() {
    Map<MethodSymbol, Attribute> res =
        new LinkedHashMap<MethodSymbol, Attribute>();

    // First find the default values.
    ClassSymbol sym = (ClassSymbol) anno.type.tsym;
    for (Scope.Entry e = sym.members().elems; e != null; e = e.sibling) {
        if (e.sym.kind == Kinds.MTH) {
            MethodSymbol m = (MethodSymbol) e.sym;
            Attribute def = m.getDefaultValue();
            if (def != null)
                res.put(m, def);
        }
    }
    // Next find the explicit values, possibly overriding defaults.
    for (Pair<MethodSymbol, Attribute> p : anno.values)
        res.put(p.fst, p.snd);
    return res;
}
 
Example 8
Source File: SerializedForm.java    From hottub with GNU General Public License v2.0 6 votes vote down vote up
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);
            }
        }
    }
}
 
Example 9
Source File: SerializedForm.java    From openjdk-8-source with GNU General Public License v2.0 6 votes vote down vote up
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);
            }
        }
    }
}
 
Example 10
Source File: SerializedForm.java    From openjdk-8 with GNU General Public License v2.0 6 votes vote down vote up
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);
            }
        }
    }
}
 
Example 11
Source File: ElementsService.java    From netbeans with Apache License 2.0 5 votes vote down vote up
public boolean alreadyDefinedIn(CharSequence name, ExecutableType method, TypeElement enclClass) {
    Type.MethodType meth = ((Type)method).asMethodType();
    ClassSymbol clazz = (ClassSymbol)enclClass;
    Scope scope = clazz.members();
    Name n = names.fromString(name.toString());
    for (Symbol sym : scope.getSymbolsByName(n, Scope.LookupKind.NON_RECURSIVE)) {
        if(sym.type instanceof ExecutableType &&
                types.isSubsignature(meth, (ExecutableType)sym.type))
            return true;
    }
    return false;
}