2080 bounds.put(ib, newBounds); |
2080 bounds.put(ib, newBounds); |
2081 } |
2081 } |
2082 |
2082 |
2083 /** add a bound of a given kind - this might trigger listener notification */ |
2083 /** add a bound of a given kind - this might trigger listener notification */ |
2084 public final void addBound(InferenceBound ib, Type bound, Types types) { |
2084 public final void addBound(InferenceBound ib, Type bound, Types types) { |
|
2085 // Per JDK-8075793: in pre-8 sources, follow legacy javac behavior |
|
2086 // when capture variables are inferred as bounds: for lower bounds, |
|
2087 // map to the capture variable's upper bound; for upper bounds, |
|
2088 // if the capture variable has a lower bound, map to that type |
|
2089 if (types.mapCapturesToBounds) { |
|
2090 switch (ib) { |
|
2091 case LOWER: |
|
2092 bound = types.cvarUpperBound(bound); |
|
2093 break; |
|
2094 case UPPER: |
|
2095 Type altBound = types.cvarLowerBound(bound); |
|
2096 if (!altBound.hasTag(TypeTag.BOT)) bound = altBound; |
|
2097 break; |
|
2098 } |
|
2099 } |
2085 addBound(ib, bound, types, false); |
2100 addBound(ib, bound, types, false); |
2086 } |
2101 } |
2087 |
2102 |
2088 @SuppressWarnings("fallthrough") |
2103 @SuppressWarnings("fallthrough") |
2089 private void addBound(InferenceBound ib, Type bound, Types types, boolean update) { |
2104 private void addBound(InferenceBound ib, Type bound, Types types, boolean update) { |