src/share/classes/com/sun/tools/javac/comp/Infer.java

changeset 1826
9851071b551a
parent 1800
c8acc254b6d7
child 1853
831467c4c6a7
     1.1 --- a/src/share/classes/com/sun/tools/javac/comp/Infer.java	Tue Jun 18 18:57:52 2013 +0100
     1.2 +++ b/src/share/classes/com/sun/tools/javac/comp/Infer.java	Tue Jun 18 19:02:48 2013 +0100
     1.3 @@ -952,8 +952,9 @@
     1.4              Type solve(UndetVar uv, InferenceContext inferenceContext) {
     1.5                  Infer infer = inferenceContext.infer();
     1.6                  List<Type> lobounds = filterBounds(uv, inferenceContext);
     1.7 -                Type owntype = infer.types.lub(lobounds);
     1.8 -                if (owntype.hasTag(ERROR)) {
     1.9 +                //note: lobounds should have at least one element
    1.10 +                Type owntype = lobounds.tail.tail == null  ? lobounds.head : infer.types.lub(lobounds);
    1.11 +                if (owntype.isPrimitive() || owntype.hasTag(ERROR)) {
    1.12                      throw infer.inferenceException
    1.13                          .setMessage("no.unique.minimal.instance.exists",
    1.14                                      uv.qtype, lobounds);
    1.15 @@ -971,8 +972,9 @@
    1.16              Type solve(UndetVar uv, InferenceContext inferenceContext) {
    1.17                  Infer infer = inferenceContext.infer();
    1.18                  List<Type> hibounds = filterBounds(uv, inferenceContext);
    1.19 -                Type owntype = infer.types.glb(hibounds);
    1.20 -                if (owntype.isErroneous()) {
    1.21 +                //note: lobounds should have at least one element
    1.22 +                Type owntype = hibounds.tail.tail == null  ? hibounds.head : infer.types.glb(hibounds);
    1.23 +                if (owntype.isPrimitive() || owntype.hasTag(ERROR)) {
    1.24                      throw infer.inferenceException
    1.25                          .setMessage("no.unique.maximal.instance.exists",
    1.26                                      uv.qtype, hibounds);
    1.27 @@ -1100,10 +1102,11 @@
    1.28                              }
    1.29                          }
    1.30                          //no progress
    1.31 -                        throw inferenceException;
    1.32 +                        throw inferenceException.setMessage();
    1.33                      }
    1.34                  }
    1.35                  catch (InferenceException ex) {
    1.36 +                    //did we fail because of interdependent ivars?
    1.37                      inferenceContext.rollback();
    1.38                      instantiateAsUninferredVars(varsToSolve, inferenceContext);
    1.39                      checkWithinBounds(inferenceContext, warn);

mercurial