Java Code Examples for sun.reflect.generics.visitor.Reifier

The following examples show how to use sun.reflect.generics.visitor.Reifier. These examples are extracted from open source projects. 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
public Type[] getParameterTypes(){
    if (paramTypes == null) { // lazily initialize parameter types
        // first, extract parameter type subtree(s) from AST
        TypeSignature[] pts = getTree().getParameterTypes();
        // create array to store reified subtree(s)
        Type[] ps = new Type[pts.length];
        // reify all subtrees
        for (int i = 0; i < pts.length; i++) {
            Reifier r = getReifier(); // obtain visitor
            pts[i].accept(r); // reify subtree
            // extract result from visitor and store it
            ps[i] = r.getResult();
        }
        paramTypes = ps; // cache overall result
    }
    return paramTypes.clone(); // return cached result
}
 
Example 2
/**
 * Return the formal type parameters of this generic declaration.
 * @return the formal type parameters of this generic declaration
 */
public TypeVariable<?>[] getTypeParameters() {
    TypeVariable<?>[] typeParams = this.typeParams;
    if (typeParams == null) { // lazily initialize type parameters
        // first, extract type parameter subtree(s) from AST
        FormalTypeParameter[] ftps = getTree().getFormalTypeParameters();
        // create array to store reified subtree(s)
        typeParams = new TypeVariable<?>[ftps.length];
        // reify all subtrees
        for (int i = 0; i < ftps.length; i++) {
            Reifier r = getReifier(); // obtain visitor
            ftps[i].accept(r); // reify subtree
            // extract result from visitor and store it
            typeParams[i] = (TypeVariable<?>) r.getResult();
        }
        this.typeParams = typeParams; // cache overall result
    }
    return typeParams.clone(); // return cached result
}
 
Example 3
public Type[] getParameterTypes(){
    if (paramTypes == null) { // lazily initialize parameter types
        // first, extract parameter type subtree(s) from AST
        TypeSignature[] pts = getTree().getParameterTypes();
        // create array to store reified subtree(s)
        Type[] ps = new Type[pts.length];
        // reify all subtrees
        for (int i = 0; i < pts.length; i++) {
            Reifier r = getReifier(); // obtain visitor
            pts[i].accept(r); // reify subtree
            // extract result from visitor and store it
            ps[i] = r.getResult();
        }
        paramTypes = ps; // cache overall result
    }
    return paramTypes.clone(); // return cached result
}
 
Example 4
/**
 * Return the formal type parameters of this generic declaration.
 * @return the formal type parameters of this generic declaration
 */
public TypeVariable<?>[] getTypeParameters() {
    TypeVariable<?>[] typeParams = this.typeParams;
    if (typeParams == null) { // lazily initialize type parameters
        // first, extract type parameter subtree(s) from AST
        FormalTypeParameter[] ftps = getTree().getFormalTypeParameters();
        // create array to store reified subtree(s)
        typeParams = new TypeVariable<?>[ftps.length];
        // reify all subtrees
        for (int i = 0; i < ftps.length; i++) {
            Reifier r = getReifier(); // obtain visitor
            ftps[i].accept(r); // reify subtree
            // extract result from visitor and store it
            typeParams[i] = (TypeVariable<?>) r.getResult();
        }
        this.typeParams = typeParams; // cache overall result
    }
    return typeParams.clone(); // return cached result
}
 
Example 5
public Type[] getParameterTypes(){
    if (paramTypes == null) { // lazily initialize parameter types
        // first, extract parameter type subtree(s) from AST
        TypeSignature[] pts = getTree().getParameterTypes();
        // create array to store reified subtree(s)
        Type[] ps = new Type[pts.length];
        // reify all subtrees
        for (int i = 0; i < pts.length; i++) {
            Reifier r = getReifier(); // obtain visitor
            pts[i].accept(r); // reify subtree
            // extract result from visitor and store it
            ps[i] = r.getResult();
        }
        paramTypes = ps; // cache overall result
    }
    return paramTypes.clone(); // return cached result
}
 
Example 6
public Type[] getExceptionTypes(){
    if (exceptionTypes == null) { // lazily initialize exception types
        // first, extract exception type subtree(s) from AST
        FieldTypeSignature[] ets = getTree().getExceptionTypes();
        // create array to store reified subtree(s)
        Type[] es = new Type[ets.length];
        // reify all subtrees
        for (int i = 0; i < ets.length; i++) {
            Reifier r = getReifier(); // obtain visitor
            ets[i].accept(r); // reify subtree
            // extract result from visitor and store it
            es[i] = r.getResult();
        }
        exceptionTypes = es; // cache overall result
    }
    return exceptionTypes.clone(); // return cached result
}
 
Example 7
/**
 * Return the formal type parameters of this generic declaration.
 * @return the formal type parameters of this generic declaration
 */
public TypeVariable<?>[] getTypeParameters() {
    TypeVariable<?>[] typeParams = this.typeParams;
    if (typeParams == null) { // lazily initialize type parameters
        // first, extract type parameter subtree(s) from AST
        FormalTypeParameter[] ftps = getTree().getFormalTypeParameters();
        // create array to store reified subtree(s)
        typeParams = new TypeVariable<?>[ftps.length];
        // reify all subtrees
        for (int i = 0; i < ftps.length; i++) {
            Reifier r = getReifier(); // obtain visitor
            ftps[i].accept(r); // reify subtree
            // extract result from visitor and store it
            typeParams[i] = (TypeVariable<?>) r.getResult();
        }
        this.typeParams = typeParams; // cache overall result
    }
    return typeParams.clone(); // return cached result
}
 
Example 8
public Type[] getParameterTypes(){
    if (paramTypes == null) { // lazily initialize parameter types
        // first, extract parameter type subtree(s) from AST
        TypeSignature[] pts = getTree().getParameterTypes();
        // create array to store reified subtree(s)
        Type[] ps = new Type[pts.length];
        // reify all subtrees
        for (int i = 0; i < pts.length; i++) {
            Reifier r = getReifier(); // obtain visitor
            pts[i].accept(r); // reify subtree
            // extract result from visitor and store it
            ps[i] = r.getResult();
        }
        paramTypes = ps; // cache overall result
    }
    return paramTypes.clone(); // return cached result
}
 
Example 9
/**
 * Return the formal type parameters of this generic declaration.
 * @return the formal type parameters of this generic declaration
 */
public TypeVariable/*<?>*/[] getTypeParameters(){
    if (typeParams == null) { // lazily initialize type parameters
        // first, extract type parameter subtree(s) from AST
        FormalTypeParameter[] ftps = getTree().getFormalTypeParameters();
        // create array to store reified subtree(s)
        TypeVariable[] tps = new TypeVariable[ftps.length];
        // reify all subtrees
        for (int i = 0; i < ftps.length; i++) {
            Reifier r = getReifier(); // obtain visitor
            ftps[i].accept(r); // reify subtree
            // extract result from visitor and store it
            tps[i] = (TypeVariable<?>) r.getResult();
        }
        typeParams = tps; // cache overall result
    }
    return typeParams.clone(); // return cached result
}
 
Example 10
public Type[] getExceptionTypes(){
    if (exceptionTypes == null) { // lazily initialize exception types
        // first, extract exception type subtree(s) from AST
        FieldTypeSignature[] ets = getTree().getExceptionTypes();
        // create array to store reified subtree(s)
        Type[] es = new Type[ets.length];
        // reify all subtrees
        for (int i = 0; i < ets.length; i++) {
            Reifier r = getReifier(); // obtain visitor
            ets[i].accept(r); // reify subtree
            // extract result from visitor and store it
            es[i] = r.getResult();
        }
        exceptionTypes = es; // cache overall result
    }
    return exceptionTypes.clone(); // return cached result
}
 
Example 11
public Type[] getExceptionTypes(){
    if (exceptionTypes == null) { // lazily initialize exception types
        // first, extract exception type subtree(s) from AST
        FieldTypeSignature[] ets = getTree().getExceptionTypes();
        // create array to store reified subtree(s)
        Type[] es = new Type[ets.length];
        // reify all subtrees
        for (int i = 0; i < ets.length; i++) {
            Reifier r = getReifier(); // obtain visitor
            ets[i].accept(r); // reify subtree
            // extract result from visitor and store it
            es[i] = r.getResult();
        }
        exceptionTypes = es; // cache overall result
    }
    return exceptionTypes.clone(); // return cached result
}
 
Example 12
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++) {
            Reifier r = getReifier(); // obtain visitor
            ts[i].accept(r);// reify subtree
            // extract result from visitor and store it
            superInterfaces[i] = r.getResult();
        }
        this.superInterfaces = superInterfaces;
    }
    return superInterfaces.clone(); // return cached result
}
 
Example 13
Source Project: jdk8u-jdk   Source File: ClassRepository.java    License: GNU General Public License v2.0 6 votes vote down vote up
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++) {
            Reifier r = getReifier(); // obtain visitor
            ts[i].accept(r);// reify subtree
            // extract result from visitor and store it
            superInterfaces[i] = r.getResult();
        }
        this.superInterfaces = superInterfaces;
    }
    return superInterfaces.clone(); // return cached result
}
 
Example 14
/**
 * Return the formal type parameters of this generic declaration.
 * @return the formal type parameters of this generic declaration
 */
public TypeVariable<?>[] getTypeParameters() {
    TypeVariable<?>[] typeParams = this.typeParams;
    if (typeParams == null) { // lazily initialize type parameters
        // first, extract type parameter subtree(s) from AST
        FormalTypeParameter[] ftps = getTree().getFormalTypeParameters();
        // create array to store reified subtree(s)
        typeParams = new TypeVariable<?>[ftps.length];
        // reify all subtrees
        for (int i = 0; i < ftps.length; i++) {
            Reifier r = getReifier(); // obtain visitor
            ftps[i].accept(r); // reify subtree
            // extract result from visitor and store it
            typeParams[i] = (TypeVariable<?>) r.getResult();
        }
        this.typeParams = typeParams; // cache overall result
    }
    return typeParams.clone(); // return cached result
}
 
Example 15
private static Class<?> parseSig(String sig, Class<?> container) {
    if (sig.equals("V")) return void.class;
    SignatureParser parser = SignatureParser.make();
    TypeSignature typeSig = parser.parseTypeSig(sig);
    GenericsFactory factory = CoreReflectionFactory.make(container, ClassScope.make(container));
    Reifier reify = Reifier.make(factory);
    typeSig.accept(reify);
    Type result = reify.getResult();
    return toClass(result);
}
 
Example 16
private Type computeReturnType() {
    Reifier r = getReifier(); // obtain visitor
    // Extract return type subtree from AST and reify
    getTree().getReturnType().accept(r);
    // extract result from visitor and cache it
    return r.getResult();
}
 
Example 17
public Type getReturnType() {
    if (returnType == null) { // lazily initialize return type
        Reifier r = getReifier(); // obtain visitor
        // Extract return type subtree from AST and reify
        getTree().getReturnType().accept(r);
        // extract result from visitor and cache it
        returnType = r.getResult();
        }
    return returnType; // return cached result
}
 
Example 18
public Type getSuperclass() {
    Type superclass = this.superclass;
    if (superclass == null) { // lazily initialize superclass
        Reifier r = getReifier(); // obtain visitor
        // Extract superclass subtree from AST and reify
        getTree().getSuperclass().accept(r);
        // extract result from visitor and cache it
        superclass = r.getResult();
        this.superclass = superclass;
    }
    return superclass; // return cached result
}
 
Example 19
public Type getGenericType(){
    if (genericType == null) { // lazily initialize generic type
        Reifier r = getReifier(); // obtain visitor
        getTree().accept(r); // reify subtree
        // extract result from visitor and cache it
        genericType = r.getResult();
    }
    return genericType; // return cached result
}
 
Example 20
private static Class<?> parseSig(String sig, Class<?> container) {
    if (sig.equals("V")) return void.class;
    SignatureParser parser = SignatureParser.make();
    TypeSignature typeSig = parser.parseTypeSig(sig);
    GenericsFactory factory = CoreReflectionFactory.make(container, ClassScope.make(container));
    Reifier reify = Reifier.make(factory);
    typeSig.accept(reify);
    Type result = reify.getResult();
    return toClass(result);
}
 
Example 21
Source Project: Bytecoder   Source File: LazyReflectiveObjectGenerator.java    License: Apache License 2.0 5 votes vote down vote up
Type[] reifyBounds(FieldTypeSignature[] boundASTs) {
    final int length = boundASTs.length;
    final Type[] bounds = new Type[length];
    // iterate over bound trees, reifying each in turn
    for (int i = 0; i < length; i++) {
        Reifier r = getReifier();
        boundASTs[i].accept(r);
        bounds[i] = r.getResult();
    }
    return bounds;
}
 
Example 22
public Type getGenericType(){
    if (genericType == null) { // lazily initialize generic type
        Reifier r = getReifier(); // obtain visitor
        getTree().accept(r); // reify subtree
        // extract result from visitor and cache it
        genericType = r.getResult();
    }
    return genericType; // return cached result
}
 
Example 23
Source Project: jdk8u60   Source File: AnnotationParser.java    License: GNU General Public License v2.0 5 votes vote down vote up
private static Class<?> parseSig(String sig, Class<?> container) {
    if (sig.equals("V")) return void.class;
    SignatureParser parser = SignatureParser.make();
    TypeSignature typeSig = parser.parseTypeSig(sig);
    GenericsFactory factory = CoreReflectionFactory.make(container, ClassScope.make(container));
    Reifier reify = Reifier.make(factory);
    typeSig.accept(reify);
    Type result = reify.getResult();
    return toClass(result);
}
 
Example 24
private Type[] computeExceptionTypes() {
    // first, extract exception type subtree(s) from AST
    FieldTypeSignature[] ets = getTree().getExceptionTypes();
    // create array to store reified subtree(s)
    int length = ets.length;
    Type[] exceptionTypes = new Type[length];
    // reify all subtrees
    for (int i = 0; i < length; i++) {
        Reifier r = getReifier(); // obtain visitor
        ets[i].accept(r); // reify subtree
        // extract result from visitor and store it
        exceptionTypes[i] = r.getResult();
    }
    return exceptionTypes;
}
 
Example 25
Source Project: jdk8u60   Source File: ClassRepository.java    License: GNU General Public License v2.0 5 votes vote down vote up
public Type getSuperclass() {
    Type superclass = this.superclass;
    if (superclass == null) { // lazily initialize superclass
        Reifier r = getReifier(); // obtain visitor
        // Extract superclass subtree from AST and reify
        getTree().getSuperclass().accept(r);
        // extract result from visitor and cache it
        superclass = r.getResult();
        this.superclass = superclass;
    }
    return superclass; // return cached result
}
 
Example 26
Source Project: java-n-IDE-for-Android   Source File: AnnotationParser.java    License: Apache License 2.0 5 votes vote down vote up
private static Class<?> parseSig(String sig, Class container) {
    if (sig.equals("V")) return void.class;
    SignatureParser parser = SignatureParser.make();
    TypeSignature typeSig = parser.parseTypeSig(sig);
    GenericsFactory factory = CoreReflectionFactory.make(container, ClassScope.make(container));
    Reifier reify = Reifier.make(factory);
    typeSig.accept(reify);
    Type result = reify.getResult();
    return toClass(result);
}
 
Example 27
Source Project: jdk8u-jdk   Source File: MethodRepository.java    License: GNU General Public License v2.0 5 votes vote down vote up
public Type getReturnType() {
    if (returnType == null) { // lazily initialize return type
        Reifier r = getReifier(); // obtain visitor
        // Extract return type subtree from AST and reify
        getTree().getReturnType().accept(r);
        // extract result from visitor and cache it
        returnType = r.getResult();
        }
    return returnType; // return cached result
}
 
Example 28
Source Project: Bytecoder   Source File: ConstructorRepository.java    License: Apache License 2.0 5 votes vote down vote up
private Type[] computeParameterTypes() {
    // first, extract parameter type subtree(s) from AST
    TypeSignature[] pts = getTree().getParameterTypes();
    // create array to store reified subtree(s)
    int length = pts.length;
    Type[] parameterTypes = new Type[length];
    // reify all subtrees
    for (int i = 0; i < length; i++) {
        Reifier r = getReifier(); // obtain visitor
        pts[i].accept(r); // reify subtree
        // extract result from visitor and store it
        parameterTypes[i] = r.getResult();
    }
    return parameterTypes;
}
 
Example 29
private Type[] computeParameterTypes() {
    // first, extract parameter type subtree(s) from AST
    TypeSignature[] pts = getTree().getParameterTypes();
    // create array to store reified subtree(s)
    int length = pts.length;
    Type[] parameterTypes = new Type[length];
    // reify all subtrees
    for (int i = 0; i < length; i++) {
        Reifier r = getReifier(); // obtain visitor
        pts[i].accept(r); // reify subtree
        // extract result from visitor and store it
        parameterTypes[i] = r.getResult();
    }
    return parameterTypes;
}
 
Example 30
Source Project: jdk8u-jdk   Source File: FieldRepository.java    License: GNU General Public License v2.0 5 votes vote down vote up
public Type getGenericType(){
    if (genericType == null) { // lazily initialize generic type
        Reifier r = getReifier(); // obtain visitor
        getTree().accept(r); // reify subtree
        // extract result from visitor and cache it
        genericType = r.getResult();
    }
    return genericType; // return cached result
}