< prev index next >

src/jdk.compiler/share/classes/com/sun/tools/javac/code/Types.java

Print this page

 104 
 105     // <editor-fold defaultstate="collapsed" desc="Instantiating">
 106     public static Types instance(Context context) {
 107         Types instance = context.get(typesKey);
 108         if (instance == null)
 109             instance = new Types(context);
 110         return instance;
 111     }
 112 
 113     @SuppressWarnings("this-escape")
 114     protected Types(Context context) {
 115         context.put(typesKey, this);
 116         syms = Symtab.instance(context);
 117         names = Names.instance(context);
 118         Source source = Source.instance(context);
 119         chk = Check.instance(context);
 120         enter = Enter.instance(context);
 121         capturedName = names.fromString("<captured wildcard>");
 122         messages = JavacMessages.instance(context);
 123         diags = JCDiagnostic.Factory.instance(context);
 124         noWarnings = new Warner(null);





 125         Options options = Options.instance(context);
 126         dumpStacktraceOnError = options.isSet("dev") || options.isSet(DOE);
 127     }
 128     // </editor-fold>
 129 
 130     // <editor-fold defaultstate="collapsed" desc="bounds">
 131     /**
 132      * Get a wildcard's upper bound, returning non-wildcards unchanged.
 133      * @param t a type argument, either a wildcard or a type
 134      */
 135     public Type wildUpperBound(Type t) {
 136         if (t.hasTag(WILDCARD)) {
 137             WildcardType w = (WildcardType) t;
 138             if (w.isSuperBound())
 139                 return w.bound == null ? syms.objectType : w.bound.getUpperBound();
 140             else
 141                 return wildUpperBound(w.type);
 142         }
 143         else return t;
 144     }

 104 
 105     // <editor-fold defaultstate="collapsed" desc="Instantiating">
 106     public static Types instance(Context context) {
 107         Types instance = context.get(typesKey);
 108         if (instance == null)
 109             instance = new Types(context);
 110         return instance;
 111     }
 112 
 113     @SuppressWarnings("this-escape")
 114     protected Types(Context context) {
 115         context.put(typesKey, this);
 116         syms = Symtab.instance(context);
 117         names = Names.instance(context);
 118         Source source = Source.instance(context);
 119         chk = Check.instance(context);
 120         enter = Enter.instance(context);
 121         capturedName = names.fromString("<captured wildcard>");
 122         messages = JavacMessages.instance(context);
 123         diags = JCDiagnostic.Factory.instance(context);
 124         noWarnings = new Warner(null) {
 125             @Override
 126             public String toString() {
 127                 return "NO_WARNINGS";
 128             }
 129         };
 130         Options options = Options.instance(context);
 131         dumpStacktraceOnError = options.isSet("dev") || options.isSet(DOE);
 132     }
 133     // </editor-fold>
 134 
 135     // <editor-fold defaultstate="collapsed" desc="bounds">
 136     /**
 137      * Get a wildcard's upper bound, returning non-wildcards unchanged.
 138      * @param t a type argument, either a wildcard or a type
 139      */
 140     public Type wildUpperBound(Type t) {
 141         if (t.hasTag(WILDCARD)) {
 142             WildcardType w = (WildcardType) t;
 143             if (w.isSuperBound())
 144                 return w.bound == null ? syms.objectType : w.bound.getUpperBound();
 145             else
 146                 return wildUpperBound(w.type);
 147         }
 148         else return t;
 149     }
< prev index next >