Search in sources :

Example 1 with TypeTree

use of sun.reflect.generics.tree.TypeTree in project jdk8u_jdk by JetBrains.

the class ClassRepository method getSuperInterfaces.

public Type[] getSuperInterfaces() {
    Type[] superInterfaces = this.superInterfaces;
    if (superInterfaces == null) {
        // lazily initialize super interfaces
        // first, extract super interface subtree(s) from AST
        TypeTree[] ts = getTree().getSuperInterfaces();
        // create array to store reified subtree(s)
        superInterfaces = new Type[ts.length];
        // reify all subtrees
        for (int i = 0; i < ts.length; i++) {
            // obtain visitor
            Reifier r = getReifier();
            // reify subtree
            ts[i].accept(r);
            // extract result from visitor and store it
            superInterfaces[i] = r.getResult();
        }
        this.superInterfaces = superInterfaces;
    }
    // return cached result
    return superInterfaces.clone();
}
Also used : Type(java.lang.reflect.Type) TypeTree(sun.reflect.generics.tree.TypeTree) Reifier(sun.reflect.generics.visitor.Reifier)

Aggregations

Type (java.lang.reflect.Type)1 TypeTree (sun.reflect.generics.tree.TypeTree)1 Reifier (sun.reflect.generics.visitor.Reifier)1