Details
-
Bug
-
Resolution: Fixed
-
P3
-
9
-
b53
-
Verified
Backports
Issue | Fix Version | Assignee | Priority | Status | Resolution | Resolved In Build |
---|---|---|---|---|---|---|
JDK-8085348 | emb-9 | Dan Smith | P3 | Resolved | Fixed | team |
JDK-8046236 | 8u20 | Dan Smith | P3 | Resolved | Won't Fix |
Description
E.g.,
[CAP extends String] contained by [? extends alpha]
becomes
String <: alpha
Here's an example that should compile but does not:
interface I<X1,X2> {}
class C<T> implements I<T,T> {}
<X> void m(I<? extends X, X> arg) {}
void test(C<?> arg) {
m(arg);
}
Here's an example that should not compile, but does (see also
static class D<T> {
void inject(T arg) {}
static <T> D<T> make(Class<? extends T> c) { return new D<T>(); }
}
void test(Object o) {
D.make(o.getClass()).inject(o);
}
javac behavior appears to be the same in 6, 7, and 8.
The offending implementation code is in 'visitWildcardType', which maps 's' to its capture var upper bound.
IMPORTANT: fixing this bug will break the build of jax-ws. So
Attachments
Issue Links
- backported by
-
JDK-8046236 Inference should not map capture variables to their upper bounds
- Resolved
-
JDK-8085348 Inference should not map capture variables to their upper bounds
- Resolved
- blocks
-
JDK-8047797 Incorrect error: incompatible types: cannot infer type-variable(s) T#1,CAP#1,T#2
- Resolved
- duplicates
-
JDK-8028774 javac, inference don't seem to deal with target types in a consistent way
- Resolved
-
JDK-8043914 Inference failure involving capture inference variable
- Resolved
-
JDK-8067858 Method hiding regression
- Resolved
- is blocked by
-
JDK-8039210 Fix type error in DefaultResourceInjector
- Resolved
-
JDK-8042338 Refactor Types.upperBound to treat wildcards and variables separately
- Closed
- relates to
-
JDK-8016196 Inference: define supertype parameterization for wildcard-parameterized types
- Open
-
JDK-8046762 Revert some inference fixes in JDK-8033718
- Resolved
-
JDK-8152894 Incorrect raw type warning for method reference
- Resolved
-
JDK-8075520 Varargs access check mishandles capture variables
- Closed
-
JDK-8159680 Inference failure with unchecked subtyping and arrays
- Closed
-
JDK-8170885 18.4: Avoid inferring capture variables during resolution
- Open
-
JDK-6893625 Generics case does not compile
- Open
-
JDK-8012039 enum type variable not within its bound
- Open
-
JDK-8160244 skip capture conversion before subtyping if types are parameterizations of the same class or interface
- Open
-
JDK-8166437 Regression in javac - inferring generic types in Guava
- Resolved
-
JDK-8051402 javac, type containment should accept that CAP <= ? extends CAP and CAP <= ? super CAP
- Resolved
-
JDK-8143396 type inference regression
- Resolved
-
JDK-8055681 Javac unable to resolve method
- Closed
-
JDK-8033718 Inference ignores capture variable as upper bound
- Closed
-
JDK-8075793 Source incompatibility for inference using -source 7
- Closed
-
JDK-8133118 Incompatible static wildcard bounds
- Closed
-
JDK-8133916 Regression in inference for array type with wildcard
- Closed