< prev index next >

src/java.base/share/classes/sun/reflect/generics/repository/ClassRepository.java

Print this page




  46     private volatile Type superclass;
  47 
  48     /** The generic superinterface info.  Lazily initialized. */
  49     private volatile Type[] superInterfaces;
  50 
  51  // private, to enforce use of static factory
  52     private ClassRepository(String rawSig, GenericsFactory f) {
  53         super(rawSig, f);
  54     }
  55 
  56     protected ClassSignature parse(String s) {
  57         return SignatureParser.make().parseClassSig(s);
  58     }
  59 
  60     /**
  61      * Static factory method.
  62      * @param rawSig - the generic signature of the reflective object
  63      * that this repository is servicing
  64      * @param f - a factory that will provide instances of reflective
  65      * objects when this repository converts its AST
  66      * @return a <tt>ClassRepository</tt> that manages the generic type
  67      * information represented in the signature <tt>rawSig</tt>
  68      */
  69     public static ClassRepository make(String rawSig, GenericsFactory f) {
  70         return new ClassRepository(rawSig, f);
  71     }
  72 
  73  /*
  74  * When queried for a particular piece of type information, the
  75  * general pattern is to consult the corresponding cached value.
  76  * If the corresponding field is non-null, it is returned.
  77  * If not, it is created lazily. This is done by selecting the appropriate
  78  * part of the tree and transforming it into a reflective object
  79  * using a visitor, which is created by feeding it the factory
  80  * with which the repository was created.
  81  */
  82 
  83     public Type getSuperclass() {
  84         Type value = superclass;
  85         if (value == null) {
  86             value = computeSuperclass();
  87             superclass = value;




  46     private volatile Type superclass;
  47 
  48     /** The generic superinterface info.  Lazily initialized. */
  49     private volatile Type[] superInterfaces;
  50 
  51  // private, to enforce use of static factory
  52     private ClassRepository(String rawSig, GenericsFactory f) {
  53         super(rawSig, f);
  54     }
  55 
  56     protected ClassSignature parse(String s) {
  57         return SignatureParser.make().parseClassSig(s);
  58     }
  59 
  60     /**
  61      * Static factory method.
  62      * @param rawSig - the generic signature of the reflective object
  63      * that this repository is servicing
  64      * @param f - a factory that will provide instances of reflective
  65      * objects when this repository converts its AST
  66      * @return a {@code ClassRepository} that manages the generic type
  67      * information represented in the signature {@code rawSig}
  68      */
  69     public static ClassRepository make(String rawSig, GenericsFactory f) {
  70         return new ClassRepository(rawSig, f);
  71     }
  72 
  73  /*
  74  * When queried for a particular piece of type information, the
  75  * general pattern is to consult the corresponding cached value.
  76  * If the corresponding field is non-null, it is returned.
  77  * If not, it is created lazily. This is done by selecting the appropriate
  78  * part of the tree and transforming it into a reflective object
  79  * using a visitor, which is created by feeding it the factory
  80  * with which the repository was created.
  81  */
  82 
  83     public Type getSuperclass() {
  84         Type value = superclass;
  85         if (value == null) {
  86             value = computeSuperclass();
  87             superclass = value;


< prev index next >