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 Project: javaide   Author: tranleduy2000   File: ConstructorRepository.java    License: 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 #2
Source Project: TencentKona-8   Author: Tencent   File: ConstructorRepository.java    License: 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 Project: jdk8u60   Author: chenghanpeng   File: ConstructorRepository.java    License: 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 Project: java-n-IDE-for-Android   Author: shenghuntianlang   File: ConstructorRepository.java    License: 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 Project: jdk8u-jdk   Author: lambdalab-mirror   File: ConstructorRepository.java    License: 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 Project: openjdk-jdk8u   Author: AdoptOpenJDK   File: ConstructorRepository.java    License: 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 Project: openjdk-jdk8u-backup   Author: AdoptOpenJDK   File: ConstructorRepository.java    License: 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 #8
Source Project: openjdk-jdk8u-backup   Author: AdoptOpenJDK   File: TypeVariableImpl.java    License: 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 #9
Source Project: dragonwell8_jdk   Author: alibaba   File: TypeVariableImpl.java    License: 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 #10
Source Project: dragonwell8_jdk   Author: alibaba   File: WildcardTypeImpl.java    License: 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 Project: Bytecoder   Author: mirkosertic   File: TypeVariableImpl.java    License: 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 #12
Source Project: jdk8u-jdk   Author: lambdalab-mirror   File: TypeVariableImpl.java    License: 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 #13
Source Project: openjdk-jdk9   Author: AdoptOpenJDK   File: ConstructorRepository.java    License: 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 #14
Source Project: openjdk-jdk8u-backup   Author: AdoptOpenJDK   File: TypeVariableImpl.java    License: 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 Project: TencentKona-8   Author: Tencent   File: TypeVariableImpl.java    License: 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 Project: jdk8u-jdk   Author: lambdalab-mirror   File: WildcardTypeImpl.java    License: 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 Project: openjdk-jdk9   Author: AdoptOpenJDK   File: TypeVariableImpl.java    License: 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 Project: javaide   Author: tranleduy2000   File: TypeVariableImpl.java    License: 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 #19
Source Project: Bytecoder   Author: mirkosertic   File: WildcardTypeImpl.java    License: 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 #20
Source Project: Bytecoder   Author: mirkosertic   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 #21
Source Project: jdk8u60   Author: chenghanpeng   File: TypeVariableImpl.java    License: 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 #22
Source Project: javaide   Author: tranleduy2000   File: WildcardTypeImpl.java    License: 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 #23
Source Project: java-n-IDE-for-Android   Author: shenghuntianlang   File: TypeVariableImpl.java    License: 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 Project: openjdk-jdk8u   Author: AdoptOpenJDK   File: TypeVariableImpl.java    License: 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 #25
Source Project: openjdk-jdk8u   Author: AdoptOpenJDK   File: WildcardTypeImpl.java    License: 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 #26
Source Project: dragonwell8_jdk   Author: alibaba   File: CoreReflectionFactory.java    License: GNU General Public License v2.0 4 votes vote down vote up
public TypeVariable<?> makeTypeVariable(String name,
                                        FieldTypeSignature[] bounds){
    return TypeVariableImpl.make(getDecl(), name, bounds, this);
}
 
Example #27
Source Project: dragonwell8_jdk   Author: alibaba   File: CoreReflectionFactory.java    License: 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 #28
Source Project: javaide   Author: tranleduy2000   File: CoreReflectionFactory.java    License: GNU General Public License v3.0 4 votes vote down vote up
public WildcardType makeWildcard(FieldTypeSignature[] ubs,
                                 FieldTypeSignature[] lbs) {
    return WildcardTypeImpl.make(ubs, lbs, this);
}
 
Example #29
Source Project: dragonwell8_jdk   Author: alibaba   File: TypeVariableImpl.java    License: 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>
 *
 * @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
 * @return an array of Types representing the upper bound(s) of this
 *     type variable
*/
public Type[] getBounds() {
    // lazily initialize bounds if necessary
    if (bounds == null) {
        FieldTypeSignature[] fts = getBoundASTs(); // 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
        bounds = ts;
        // could throw away bound ASTs here; thread safety?
    }
    return bounds.clone(); // return cached bounds
}
 
Example #30
Source Project: dragonwell8_jdk   Author: alibaba   File: WildcardTypeImpl.java    License: 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
}