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

changeset 2422
4ee06c77b51b
parent 2420
1aeb322cf646
child 2428
ce1d9dd2e9eb
equal deleted inserted replaced
2421:b060e7c2f5cc 2422:4ee06c77b51b
133 if (w.isSuperBound()) 133 if (w.isSuperBound())
134 return w.bound == null ? syms.objectType : w.bound.bound; 134 return w.bound == null ? syms.objectType : w.bound.bound;
135 else 135 else
136 return wildUpperBound(w.type); 136 return wildUpperBound(w.type);
137 } 137 }
138 else return t; 138 else return t.unannotatedType();
139 } 139 }
140 140
141 /** 141 /**
142 * Get a capture variable's upper bound, returning other types unchanged. 142 * Get a capture variable's upper bound, returning other types unchanged.
143 * @param t a type 143 * @param t a type
145 public Type cvarUpperBound(Type t) { 145 public Type cvarUpperBound(Type t) {
146 if (t.hasTag(TYPEVAR)) { 146 if (t.hasTag(TYPEVAR)) {
147 TypeVar v = (TypeVar) t.unannotatedType(); 147 TypeVar v = (TypeVar) t.unannotatedType();
148 return v.isCaptured() ? cvarUpperBound(v.bound) : v; 148 return v.isCaptured() ? cvarUpperBound(v.bound) : v;
149 } 149 }
150 else return t; 150 else return t.unannotatedType();
151 } 151 }
152 152
153 /** 153 /**
154 * Get a wildcard's lower bound, returning non-wildcards unchanged. 154 * Get a wildcard's lower bound, returning non-wildcards unchanged.
155 * @param t a type argument, either a wildcard or a type 155 * @param t a type argument, either a wildcard or a type
156 */ 156 */
157 public Type wildLowerBound(Type t) { 157 public Type wildLowerBound(Type t) {
158 if (t.hasTag(WILDCARD)) { 158 if (t.hasTag(WILDCARD)) {
159 WildcardType w = (WildcardType) t; 159 WildcardType w = (WildcardType) t.unannotatedType();
160 return w.isExtendsBound() ? syms.botType : wildLowerBound(w.type); 160 return w.isExtendsBound() ? syms.botType : wildLowerBound(w.type);
161 } 161 }
162 else return t; 162 else return t.unannotatedType();
163 } 163 }
164 164
165 /** 165 /**
166 * Get a capture variable's lower bound, returning other types unchanged. 166 * Get a capture variable's lower bound, returning other types unchanged.
167 * @param t a type 167 * @param t a type
168 */ 168 */
169 public Type cvarLowerBound(Type t) { 169 public Type cvarLowerBound(Type t) {
170 if (t.hasTag(TYPEVAR) && ((TypeVar) t).isCaptured()) { 170 if (t.hasTag(TYPEVAR)) {
171 return cvarLowerBound(t.getLowerBound()); 171 TypeVar v = (TypeVar) t.unannotatedType();
172 } 172 return v.isCaptured() ? cvarLowerBound(v.getLowerBound()) : v;
173 else return t; 173 }
174 else return t.unannotatedType();
174 } 175 }
175 // </editor-fold> 176 // </editor-fold>
176 177
177 // <editor-fold defaultstate="collapsed" desc="isUnbounded"> 178 // <editor-fold defaultstate="collapsed" desc="isUnbounded">
178 /** 179 /**

mercurial