Package sun.reflect.generics.visitor

Examples of sun.reflect.generics.visitor.Reifier


    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);
    }
View Full Code Here


            // allocate result array; note that
            // keeping ts and bounds separate helps with threads
            Type[] ts = new Type[fts.length];
            // iterate over bound trees, reifying each in turn
            for ( int j = 0; j  < fts.length; j++) {
                Reifier r = getReifier();
                fts[j].accept(r);
                ts[j] = r.getResult();
            }
            // cache result
            bounds = ts;
            // could throw away bound ASTs here; thread safety?
        }
View Full Code Here

            // allocate result array; note that
            // keeping ts and bounds separate helps with threads
            Type[] ts = new Type[fts.length];
            // iterate over bound trees, reifying each in turn
            for ( int j = 0; j  < fts.length; j++) {
                Reifier r = getReifier();
                fts[j].accept(r);
                ts[j] = r.getResult();
            }
            // cache result
            upperBounds = ts;
            // could throw away upper bound ASTs here; thread safety?
        }
View Full Code Here

            // allocate result array; note that
            // keeping ts and bounds separate helps with threads
            Type[] ts = new Type[fts.length];
            // iterate over bound trees, reifying each in turn
            for ( int j = 0; j  < fts.length; j++) {
                Reifier r = getReifier();
                fts[j].accept(r);
                ts[j] = r.getResult();
            }
            // cache result
            lowerBounds = ts;
            // could throw away lower bound ASTs here; thread safety?
        }
View Full Code Here

            TypeTree[] ts  = getTree().getSuperInterfaces();
            // create array to store reified subtree(s)
            Type[] sis = 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
                sis[i] = r.getResult();
            }
            superInterfaces = sis; // cache overall result
        }
        return superInterfaces.clone(); // return cached result
    }
View Full Code Here

* with which the repository was created.
*/

    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
    }
View Full Code Here

            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
    }
View Full Code Here

            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
    }
View Full Code Here

            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
    }
View Full Code Here

    // public API

    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
    }
View Full Code Here

TOP

Related Classes of sun.reflect.generics.visitor.Reifier

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.