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

changeset 299
22872b24d38c
parent 240
8c55d5b0ed71
child 341
85fecace920b
equal deleted inserted replaced
298:3ac205ad1f05 299:22872b24d38c
340 if (t == s) 340 if (t == s)
341 return true; 341 return true;
342 342
343 if (s.tag >= firstPartialTag) 343 if (s.tag >= firstPartialTag)
344 return isSuperType(s, t); 344 return isSuperType(s, t);
345
346 if (s.isCompound()) {
347 for (Type s2 : interfaces(s).prepend(supertype(s))) {
348 if (!isSubtype(t, s2, capture))
349 return false;
350 }
351 return true;
352 }
345 353
346 Type lower = lowerBound(s); 354 Type lower = lowerBound(s);
347 if (s != lower) 355 if (s != lower)
348 return isSubtype(capture ? capture(t) : t, lower, false); 356 return isSubtype(capture ? capture(t) : t, lower, false);
349 357
2868 * Capture conversion is not applied recursively. 2876 * Capture conversion is not applied recursively.
2869 */ 2877 */
2870 /** 2878 /**
2871 * Capture conversion as specified by JLS 3rd Ed. 2879 * Capture conversion as specified by JLS 3rd Ed.
2872 */ 2880 */
2881
2882 public List<Type> capture(List<Type> ts) {
2883 List<Type> buf = List.nil();
2884 for (Type t : ts) {
2885 buf = buf.prepend(capture(t));
2886 }
2887 return buf.reverse();
2888 }
2873 public Type capture(Type t) { 2889 public Type capture(Type t) {
2874 if (t.tag != CLASS) 2890 if (t.tag != CLASS)
2875 return t; 2891 return t;
2876 ClassType cls = (ClassType)t; 2892 ClassType cls = (ClassType)t;
2877 if (cls.isRaw() || !cls.isParameterized()) 2893 if (cls.isRaw() || !cls.isParameterized())

mercurial