langtools/src/share/classes/com/sun/tools/javac/code/Types.java
changeset 2218 a8ec0baae870
parent 1993 9b37ef07ba64
child 2221 cd6557bcaa0a
--- a/langtools/src/share/classes/com/sun/tools/javac/code/Types.java	Mon Mar 02 15:11:29 2009 -0800
+++ b/langtools/src/share/classes/com/sun/tools/javac/code/Types.java	Thu Mar 05 17:24:08 2009 +0000
@@ -1010,8 +1010,8 @@
                                 && !disjointTypes(aHigh.allparams(), lowSub.allparams())
                                 && !disjointTypes(aLow.allparams(), highSub.allparams())
                                 && !disjointTypes(aLow.allparams(), lowSub.allparams())) {
-                                if (upcast ? giveWarning(a, highSub) || giveWarning(a, lowSub)
-                                           : giveWarning(highSub, a) || giveWarning(lowSub, a))
+                                if (upcast ? giveWarning(a, b) :
+                                    giveWarning(b, a))
                                     warnStack.head.warnUnchecked();
                                 return true;
                             }
@@ -3224,9 +3224,11 @@
     }
 
     private boolean giveWarning(Type from, Type to) {
-        // To and from are (possibly different) parameterizations
-        // of the same class or interface
-        return to.isParameterized() && !containsType(to.allparams(), from.allparams());
+        Type subFrom = asSub(from, to.tsym);
+        return to.isParameterized() &&
+                (!(isUnbounded(to) ||
+                isSubtype(from, to) ||
+                ((subFrom != null) && isSameType(subFrom, to))));
     }
 
     private List<Type> superClosure(Type t, Type s) {