sun.reflect.generics.tree.FieldTypeSignature Java Examples

The following examples show how to use sun.reflect.generics.tree.FieldTypeSignature. 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: ConstructorRepository.java    From openjdk-jdk8u-backup with GNU General Public License v2.0 6 votes vote down vote up
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 #2
Source File: ConstructorRepository.java    From openjdk-jdk8u with GNU General Public License v2.0 6 votes vote down vote up
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 #3
Source File: ConstructorRepository.java    From jdk8u-jdk with GNU General Public License v2.0 6 votes vote down vote up
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 #4
Source File: ConstructorRepository.java    From java-n-IDE-for-Android with Apache License 2.0 6 votes vote down vote up
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 #5
Source File: ConstructorRepository.java    From jdk8u60 with GNU General Public License v2.0 6 votes vote down vote up
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 #6
Source File: ConstructorRepository.java    From TencentKona-8 with GNU General Public License v2.0 6 votes vote down vote up
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
Source File: ConstructorRepository.java    From javaide with GNU General Public License v3.0 6 votes vote down vote up
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 #8
Source File: TypeVariableImpl.java    From javaide with GNU General Public License v3.0 5 votes vote down vote up
private TypeVariableImpl(D decl, String n, FieldTypeSignature[] bs,
                         GenericsFactory f) {
    super(f);
    genericDeclaration = decl;
    name = n;
    boundASTs = bs;
}
 
Example #9
Source File: TypeVariableImpl.java    From Bytecoder with Apache License 2.0 5 votes vote down vote up
/**
 * Factory method.
 * @param decl - the reflective object that declared the type variable
 * that this method should create
 * @param name - the name of the type variable to be returned
 * @param bs - an array of ASTs representing the bounds for the type
 * variable to be created
 * @param f - a factory that can be used to manufacture reflective
 * objects that represent the bounds of this type variable
 * @return A type variable with name, bounds, declaration and factory
 * specified
 */
public static <T extends GenericDeclaration>
                         TypeVariableImpl<T> make(T decl, String name,
                                                  FieldTypeSignature[] bs,
                                                  GenericsFactory f) {

    if (!((decl instanceof Class) ||
            (decl instanceof Method) ||
            (decl instanceof Constructor))) {
        throw new AssertionError("Unexpected kind of GenericDeclaration" +
                decl.getClass().toString());
    }
    return new TypeVariableImpl<T>(decl, name, bs, f);
}
 
Example #10
Source File: WildcardTypeImpl.java    From dragonwell8_jdk with GNU General Public License v2.0 5 votes vote down vote up
private WildcardTypeImpl(FieldTypeSignature[] ubs,
                         FieldTypeSignature[] lbs,
                         GenericsFactory f) {
    super(f);
    upperBoundASTs = ubs;
    lowerBoundASTs = lbs;
}
 
Example #11
Source File: TypeVariableImpl.java    From jdk8u-jdk with GNU General Public License v2.0 5 votes vote down vote up
/**
 * Factory method.
 * @param decl - the reflective object that declared the type variable
 * that this method should create
 * @param name - the name of the type variable to be returned
 * @param bs - an array of ASTs representing the bounds for the type
 * variable to be created
 * @param f - a factory that can be used to manufacture reflective
 * objects that represent the bounds of this type variable
 * @return A type variable with name, bounds, declaration and factory
 * specified
 */
public static <T extends GenericDeclaration>
                         TypeVariableImpl<T> make(T decl, String name,
                                                  FieldTypeSignature[] bs,
                                                  GenericsFactory f) {

    if (!((decl instanceof Class) ||
            (decl instanceof Method) ||
            (decl instanceof Constructor))) {
        throw new AssertionError("Unexpected kind of GenericDeclaration" +
                decl.getClass().toString());
    }
    return new TypeVariableImpl<T>(decl, name, bs, f);
}
 
Example #12
Source File: ConstructorRepository.java    From openjdk-jdk9 with GNU General Public License v2.0 5 votes vote down vote up
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 #13
Source File: WildcardTypeImpl.java    From openjdk-jdk8u with GNU General Public License v2.0 5 votes vote down vote up
private WildcardTypeImpl(FieldTypeSignature[] ubs,
                         FieldTypeSignature[] lbs,
                         GenericsFactory f) {
    super(f);
    upperBoundASTs = ubs;
    lowerBoundASTs = lbs;
}
 
Example #14
Source File: TypeVariableImpl.java    From openjdk-jdk8u-backup with GNU General Public License v2.0 5 votes vote down vote up
private TypeVariableImpl(D decl, String n, FieldTypeSignature[] bs,
                         GenericsFactory f) {
    super(f);
    genericDeclaration = decl;
    name = n;
    boundASTs = bs;
}
 
Example #15
Source File: TypeVariableImpl.java    From TencentKona-8 with GNU General Public License v2.0 5 votes vote down vote up
/**
 * Factory method.
 * @param decl - the reflective object that declared the type variable
 * that this method should create
 * @param name - the name of the type variable to be returned
 * @param bs - an array of ASTs representing the bounds for the type
 * variable to be created
 * @param f - a factory that can be used to manufacture reflective
 * objects that represent the bounds of this type variable
 * @return A type variable with name, bounds, declaration and factory
 * specified
 */
public static <T extends GenericDeclaration>
                         TypeVariableImpl<T> make(T decl, String name,
                                                  FieldTypeSignature[] bs,
                                                  GenericsFactory f) {

    if (!((decl instanceof Class) ||
            (decl instanceof Method) ||
            (decl instanceof Constructor))) {
        throw new AssertionError("Unexpected kind of GenericDeclaration" +
                decl.getClass().toString());
    }
    return new TypeVariableImpl<T>(decl, name, bs, f);
}
 
Example #16
Source File: WildcardTypeImpl.java    From jdk8u-jdk with GNU General Public License v2.0 5 votes vote down vote up
private WildcardTypeImpl(FieldTypeSignature[] ubs,
                         FieldTypeSignature[] lbs,
                         GenericsFactory f) {
    super(f);
    upperBoundASTs = ubs;
    lowerBoundASTs = lbs;
}
 
Example #17
Source File: TypeVariableImpl.java    From openjdk-jdk9 with GNU General Public License v2.0 5 votes vote down vote up
/**
 * Factory method.
 * @param decl - the reflective object that declared the type variable
 * that this method should create
 * @param name - the name of the type variable to be returned
 * @param bs - an array of ASTs representing the bounds for the type
 * variable to be created
 * @param f - a factory that can be used to manufacture reflective
 * objects that represent the bounds of this type variable
 * @return A type variable with name, bounds, declaration and factory
 * specified
 */
public static <T extends GenericDeclaration>
                         TypeVariableImpl<T> make(T decl, String name,
                                                  FieldTypeSignature[] bs,
                                                  GenericsFactory f) {

    if (!((decl instanceof Class) ||
            (decl instanceof Method) ||
            (decl instanceof Constructor))) {
        throw new AssertionError("Unexpected kind of GenericDeclaration" +
                decl.getClass().toString());
    }
    return new TypeVariableImpl<T>(decl, name, bs, f);
}
 
Example #18
Source File: WildcardTypeImpl.java    From Bytecoder with Apache License 2.0 5 votes vote down vote up
private WildcardTypeImpl(FieldTypeSignature[] ubs,
                         FieldTypeSignature[] lbs,
                         GenericsFactory f) {
    super(f);
    upperBounds = ubs;
    lowerBounds = lbs;
}
 
Example #19
Source File: TypeVariableImpl.java    From openjdk-jdk8u with GNU General Public License v2.0 5 votes vote down vote up
private TypeVariableImpl(D decl, String n, FieldTypeSignature[] bs,
                         GenericsFactory f) {
    super(f);
    genericDeclaration = decl;
    name = n;
    boundASTs = bs;
}
 
Example #20
Source File: TypeVariableImpl.java    From dragonwell8_jdk with GNU General Public License v2.0 5 votes vote down vote up
private TypeVariableImpl(D decl, String n, FieldTypeSignature[] bs,
                         GenericsFactory f) {
    super(f);
    genericDeclaration = decl;
    name = n;
    boundASTs = bs;
}
 
Example #21
Source File: LazyReflectiveObjectGenerator.java    From Bytecoder with 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
Source File: TypeVariableImpl.java    From jdk8u60 with GNU General Public License v2.0 5 votes vote down vote up
/**
 * Factory method.
 * @param decl - the reflective object that declared the type variable
 * that this method should create
 * @param name - the name of the type variable to be returned
 * @param bs - an array of ASTs representing the bounds for the type
 * variable to be created
 * @param f - a factory that can be used to manufacture reflective
 * objects that represent the bounds of this type variable
 * @return A type variable with name, bounds, declaration and factory
 * specified
 */
public static <T extends GenericDeclaration>
                         TypeVariableImpl<T> make(T decl, String name,
                                                  FieldTypeSignature[] bs,
                                                  GenericsFactory f) {

    if (!((decl instanceof Class) ||
            (decl instanceof Method) ||
            (decl instanceof Constructor))) {
        throw new AssertionError("Unexpected kind of GenericDeclaration" +
                decl.getClass().toString());
    }
    return new TypeVariableImpl<T>(decl, name, bs, f);
}
 
Example #23
Source File: TypeVariableImpl.java    From java-n-IDE-for-Android with Apache License 2.0 5 votes vote down vote up
private TypeVariableImpl(D decl, String n, FieldTypeSignature[] bs,
                         GenericsFactory f) {
    super(f);
    genericDeclaration = decl;
    name = n;
    boundASTs = bs;
}
 
Example #24
Source File: WildcardTypeImpl.java    From javaide with GNU General Public License v3.0 5 votes vote down vote up
private WildcardTypeImpl(FieldTypeSignature[] ubs,
                         FieldTypeSignature[] lbs,
                         GenericsFactory f) {
    super(f);
    upperBoundASTs = ubs;
    lowerBoundASTs = lbs;
}
 
Example #25
Source File: TypeVariableImpl.java    From openjdk-jdk8u-backup with GNU General Public License v2.0 5 votes vote down vote up
/**
 * Factory method.
 * @param decl - the reflective object that declared the type variable
 * that this method should create
 * @param name - the name of the type variable to be returned
 * @param bs - an array of ASTs representing the bounds for the type
 * variable to be created
 * @param f - a factory that can be used to manufacture reflective
 * objects that represent the bounds of this type variable
 * @return A type variable with name, bounds, declaration and factory
 * specified
 */
public static <T extends GenericDeclaration>
                         TypeVariableImpl<T> make(T decl, String name,
                                                  FieldTypeSignature[] bs,
                                                  GenericsFactory f) {

    if (!((decl instanceof Class) ||
            (decl instanceof Method) ||
            (decl instanceof Constructor))) {
        throw new AssertionError("Unexpected kind of GenericDeclaration" +
                decl.getClass().toString());
    }
    return new TypeVariableImpl<T>(decl, name, bs, f);
}
 
Example #26
Source File: TypeVariableImpl.java    From java-n-IDE-for-Android with Apache License 2.0 4 votes vote down vote up
private FieldTypeSignature[] getBoundASTs() {
    // check that bounds were not evaluated yet
    assert(bounds == null);
    return boundASTs;
}
 
Example #27
Source File: WildcardTypeImpl.java    From openjdk-jdk8u-backup with GNU General Public License v2.0 4 votes vote down vote up
private FieldTypeSignature[] getLowerBoundASTs() {
    // check that lower bounds were not evaluated yet
    assert(lowerBounds == null);
    return lowerBoundASTs;
}
 
Example #28
Source File: CoreReflectionFactory.java    From dragonwell8_jdk with GNU General Public License v2.0 4 votes vote down vote up
public WildcardType makeWildcard(FieldTypeSignature[] ubs,
                                 FieldTypeSignature[] lbs) {
    return WildcardTypeImpl.make(ubs, lbs, this);
}
 
Example #29
Source File: WildcardTypeImpl.java    From jdk8u60 with GNU General Public License v2.0 4 votes vote down vote up
/**
 * Returns an array of <tt>Type</tt> objects representing the  upper
 * bound(s) of this type variable.  Note that if no upper bound is
 * explicitly declared, the upper bound is <tt>Object</tt>.
 *
 * <p>For each upper bound B :
 * <ul>
 *  <li>if B is a parameterized type or a type variable, it is created,
 *  (see {@link #ParameterizedType} for the details of the creation
 *  process for parameterized types).
 *  <li>Otherwise, B is resolved.
 * </ul>
 *
 * @return an array of Types representing the upper bound(s) of this
 *     type variable
 * @throws <tt>TypeNotPresentException</tt> if any of the
 *     bounds refers to a non-existent type declaration
 * @throws <tt>MalformedParameterizedTypeException</tt> if any of the
 *     bounds refer to a parameterized type that cannot be instantiated
 *     for any reason
 */
public Type[] getUpperBounds() {
    // lazily initialize bounds if necessary
    if (upperBounds == null) {
        FieldTypeSignature[] fts = getUpperBoundASTs(); // get AST

        // 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?
    }
    return upperBounds.clone(); // return cached bounds
}
 
Example #30
Source File: WildcardTypeImpl.java    From openjdk-jdk8u-backup with GNU General Public License v2.0 4 votes vote down vote up
/**
 * Returns an array of <tt>Type</tt> objects representing the  upper
 * bound(s) of this type variable.  Note that if no upper bound is
 * explicitly declared, the upper bound is <tt>Object</tt>.
 *
 * <p>For each upper bound B :
 * <ul>
 *  <li>if B is a parameterized type or a type variable, it is created,
 *  (see {@link #ParameterizedType} for the details of the creation
 *  process for parameterized types).
 *  <li>Otherwise, B is resolved.
 * </ul>
 *
 * @return an array of Types representing the upper bound(s) of this
 *     type variable
 * @throws <tt>TypeNotPresentException</tt> if any of the
 *     bounds refers to a non-existent type declaration
 * @throws <tt>MalformedParameterizedTypeException</tt> if any of the
 *     bounds refer to a parameterized type that cannot be instantiated
 *     for any reason
 */
public Type[] getUpperBounds() {
    // lazily initialize bounds if necessary
    if (upperBounds == null) {
        FieldTypeSignature[] fts = getUpperBoundASTs(); // get AST

        // 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?
    }
    return upperBounds.clone(); // return cached bounds
}