Details
-
Enhancement
-
Resolution: Fixed
-
P3
-
7
-
b72
-
generic, x86
-
generic, linux
-
Verified
Backports
Issue | Fix Version | Assignee | Priority | Status | Resolution | Resolved In Build |
---|---|---|---|---|---|---|
JDK-8047379 | OpenJDK6 | Ivan Krylov | P3 | Closed | Fixed |
Description
-----------------------------------------------------------------------------
public class GenericTest {
public static interface Interface<T> { }
public static class IntegerInterface implements Interface<Integer> { }
public static <I extends Interface<T>, T> T getGenericValue(I test) {
return null;
}
public static void testSet(Integer test) { }
public static void main(String args[]) {
Integer test = getGenericValue(new IntegerInterface());
testSet(getGenericValue(new IntegerInterface())); //flagged as an error
}
}
---------------------------------------------------------------------------------------
Produces the following compilation error:
---------------------------------------------------------------------------------------
GenericTest.java:15: testSet(java.lang.Integer) in GenericTest cannot be applied to (java.lang.Object)
testSet(getGenericValue(new IntegerInterface())); //flagged as an error
^
1 error
---------------------------------------------------------------------------------------
On:
java version "1.7.0-ea"
Java(TM) SE Runtime Environment (build 1.7.0-ea-b22)
Java HotSpot(TM) Server VM (build 11.0-b08, mixed mode)
But not on:
java version "1.6.0_05-ea"
Java(TM) SE Runtime Environment (build 1.6.0_05-ea-b04)
Java HotSpot(TM) Tiered VM (build 1.6.0_05-ea-b04, mixed mode)
Attachments
Issue Links
- backported by
-
JDK-8047379 Inference of formal type parameter (unused in formal parameters) is not performed
- Closed
- duplicates
-
JDK-6862521 closed/javax/swing/JTable/sorting/UnitTest.java test fails with invalid inferred types.
- Closed
- relates to
-
JDK-6569074 Type inference fails with bounded type parameters
- Closed
-
JDK-6278587 Compiler fails to infer correct type for under-constrained type variables
- Closed
-
JDK-6638712 Inference with wildcard types causes selection of inapplicable method
- Closed
-
JDK-6785112 Umbrella: issues with generic method type-inference
- Closed
-
JDK-6369608 inference: Inferred types not substituted in bounds of unconstrained type variables
- Closed
-
JDK-6707034 javac accepts method invocation with actuals that are not subtypes of the formal
- Closed
-
JDK-7034548 Statement with generics fails to compile in one line, compiles in two lines
- Closed
-
JDK-7086586 Inference producing null type argument
- Closed
-
JDK-6811943 inference: javac 1.6 & Eclipse infer more types than JLS (umbrella CR)
- Closed
-
JDK-6640435 inference: propagate >> and == constraints to help uninferred type vars
- Closed