langtools/src/share/classes/com/sun/tools/javac/comp/Infer.java
changeset 18395 d56a5fbf0b32
parent 18008 6d75e3886bac
child 18646 e628560a86d1
--- a/langtools/src/share/classes/com/sun/tools/javac/comp/Infer.java	Tue Jun 18 18:57:52 2013 +0100
+++ b/langtools/src/share/classes/com/sun/tools/javac/comp/Infer.java	Tue Jun 18 19:02:48 2013 +0100
@@ -952,8 +952,9 @@
             Type solve(UndetVar uv, InferenceContext inferenceContext) {
                 Infer infer = inferenceContext.infer();
                 List<Type> lobounds = filterBounds(uv, inferenceContext);
-                Type owntype = infer.types.lub(lobounds);
-                if (owntype.hasTag(ERROR)) {
+                //note: lobounds should have at least one element
+                Type owntype = lobounds.tail.tail == null  ? lobounds.head : infer.types.lub(lobounds);
+                if (owntype.isPrimitive() || owntype.hasTag(ERROR)) {
                     throw infer.inferenceException
                         .setMessage("no.unique.minimal.instance.exists",
                                     uv.qtype, lobounds);
@@ -971,8 +972,9 @@
             Type solve(UndetVar uv, InferenceContext inferenceContext) {
                 Infer infer = inferenceContext.infer();
                 List<Type> hibounds = filterBounds(uv, inferenceContext);
-                Type owntype = infer.types.glb(hibounds);
-                if (owntype.isErroneous()) {
+                //note: lobounds should have at least one element
+                Type owntype = hibounds.tail.tail == null  ? hibounds.head : infer.types.glb(hibounds);
+                if (owntype.isPrimitive() || owntype.hasTag(ERROR)) {
                     throw infer.inferenceException
                         .setMessage("no.unique.maximal.instance.exists",
                                     uv.qtype, hibounds);
@@ -1100,10 +1102,11 @@
                             }
                         }
                         //no progress
-                        throw inferenceException;
+                        throw inferenceException.setMessage();
                     }
                 }
                 catch (InferenceException ex) {
+                    //did we fail because of interdependent ivars?
                     inferenceContext.rollback();
                     instantiateAsUninferredVars(varsToSolve, inferenceContext);
                     checkWithinBounds(inferenceContext, warn);