JDK-8048543 : JLS8 18.5.3: inference variable seems to be instantiated unexpectedly
  • Type: Bug
  • Component: tools
  • Sub-Component: javac
  • Affected Version: 8,9
  • Priority: P4
  • Status: Closed
  • Resolution: Fixed
  • Submitted: 2014-06-27
  • Updated: 2022-07-22
  • Resolved: 2016-07-06
The Version table provides details related to the release that this issue/RFE will be addressed.

Unresolved : Release in which this issue/RFE will be addressed.
Resolved: Release in which this issue/RFE has been resolved.
Fixed : Release in which this issue/RFE has been fixed. The release containing this fix may be available for download as an Early Access Release or a General Availability Release.

To download the current JDK release, click here.
JDK 9
9 b127Fixed
Related Reports
Blocks :  
Blocks :  
Description
Let's consider following code:

public class Test12 {
    interface Iface<A1 extends A2, A2> {
        String m(A1 t);
    }

    public void run() {
        Iface<? super Integer, Number> i = (Integer a) -> a.toString();
    }
}

It fails with following error:

Error:(7, 44) java: incompatible types: Test12.Iface<java.lang.Integer,java.lang.Integer> cannot be converted to Test12.Iface<? super java.lang.Integer,java.lang.Number>

While it should compile successfully since only A1 should be instantiated as a result of reduction in jls-18.5.3-220-A:
Integer = A1

While A2 should remain unchanged as Number according to jls-18.5.3-220-B.


It looks like resolution takes place along with reduction in jls-18.5.3-210 in javac.
Comments
URL: http://hg.openjdk.java.net/jdk9/jdk9/langtools/rev/ddc91de2ee61 User: amurillo Date: 2016-07-08 20:16:38 +0000
08-07-2016

URL: http://hg.openjdk.java.net/jdk9/dev/langtools/rev/ddc91de2ee61 User: vromero Date: 2016-07-06 22:41:16 +0000
06-07-2016

These tests fail on JDK9b28 as well, for this reason tck-red-9 label is added; priority is raised to P2 accordingly. Report: http://baloo.ru.oracle.com/jenkins/job/nightly_compiler_solaris_jck9/21//artifact/java-test-work/jtReport/html/kfl_newfailures.html
11-09-2014

The priority has been raised from P4 to P3 because it's a conformance issues.
09-09-2014

Following JCK tests fail on jdk8b132 because of this issue (JCK8a): lang/INFR/infr065/infr06501m02/infr06501m02.html lang/INFR/infr065/infr06501m03/infr06501m03.html lang/INFR/infr065/infr06501m04/infr06501m04.html lang/INFR/infr065/infr06501m12/infr06501m12.html lang/INFR/infr065/infr06501m13/infr06501m13.html lang/INFR/infr065/infr06501m14/infr06501m14.html lang/INFR/infr065/infr06502m003/infr06502m003.html lang/INFR/infr065/infr06502m103/infr06502m103.html
15-08-2014