JDK-8148711 : regression in generalized target type inference
  • Type: Bug
  • Component: tools
  • Sub-Component: javac
  • Affected Version: 6,7
  • Priority: P3
  • Status: Closed
  • Resolution: Duplicate
  • OS: linux
  • CPU: x86_64
  • Submitted: 2016-01-16
  • Updated: 2016-03-06
  • Resolved: 2016-03-01
Related Reports
Duplicate :  
Description
FULL PRODUCT VERSION :
java full version "9-ea+100-2016-01-06-195905.javare.4235.nc"

ADDITIONAL OS VERSION INFORMATION :
x86_64 GNU/Linux

A DESCRIPTION OF THE PROBLEM :
Generalized target type inference should allow the attached code to compile. The JDK 8 javac accepts it, but it is rejected by JDK 9.

This regression bisects to the fix for JDK-8078093 [1][2]. It may be related to JDK-8147493 [3], which is another type inference regression involving unchecked calls that was introduced by the fix for 8078093.

[1] http://hg.openjdk.java.net/jdk9/dev/langtools/rev/286fc9270404
[2] https://bugs.openjdk.java.net/browse/JDK-8078093
[3] https://bugs.openjdk.java.net/browse/JDK-8147493

REGRESSION.  Last worked in version 8u66

ADDITIONAL REGRESSION INFORMATION: 
java full version "1.8.0_66-ea-b02"

STEPS TO FOLLOW TO REPRODUCE THE PROBLEM :
javac Test.java

EXPECTED VERSUS ACTUAL BEHAVIOR :
EXPECTED -
I expected the code to compile.
ACTUAL -
The code does not compile.

ERROR MESSAGES/STACK TRACES THAT OCCUR :
Test.java:8: error: incompatible types: Object cannot be converted to String
    h(g(raw, f(null)));
              ^
Note: Some messages have been simplified; recompile with -Xdiags:verbose to get full output
1 error

REPRODUCIBILITY :
This bug can be reproduced always.

---------- BEGIN SOURCE ----------
abstract class Test {

  abstract <A> A f(A t);
  abstract <B> Class<B> g(Class<B> x, String y);
  abstract <C> void h(C t);

  void g(Class raw) {
    h(g(raw, f(null)));
  }
}
---------- END SOURCE ----------


Comments
Closing this incident as closed/Duplicate.
06-03-2016

Test Result: ######### OS: Windows 7 64 bit, Ubuntu 64 bit JDK 9ea-b103 : Pass Ubuntu Linux 64 bit: ################# abhijit@abhijit-VirtualBox:/media/sf_ora/java$ /media/sf_ora/java/jdk-9/bin/java -version java version "9-ea" Java(TM) SE Runtime Environment (build 9-ea+103-2016-01-27-190945.javare.4341.nc) Java HotSpot(TM) 64-Bit Server VM (build 9-ea+103-2016-01-27-190945.javare.4341.nc, mixed mode) abhijit@abhijit-VirtualBox:/media/sf_ora/java$ /media/sf_ora/java/jdk-9/bin/javac ../tools/JI9028659.java Note: ../tools/JI9028659.java uses unchecked or unsafe operations. Note: Recompile with -Xlint:unchecked for details. abhijit@abhijit-VirtualBox:/media/sf_ora/java$ Windows 7 64 bit: ############### c:\Abhijit\tools>java -version java version "9-ea" Java(TM) SE Runtime Environment (build 9-ea+103-2016-01-27-183833.javare.4341.nc) Java HotSpot(TM) 64-Bit Server VM (build 9-ea+103-2016-01-27-183833.javare.4341.nc, mixed mode) c:\Abhijit\tools>javac JI9028659.java Note: JI9028659.java uses unchecked or unsafe operations. Note: Recompile with -Xlint:unchecked for details. c:\Abhijit\tools>
01-02-2016

Test Result: ########## OS: Ubuntu 64 bit, Windows 7 64 bit JDK: 6uXX : Fail 7uXX : Fail 8uXX : Pass 9ea b94: Fail Getting different result from the different JDK build. ################################################## Output: ###### 6u45: ******* abhijit@abhijit-VirtualBox:/media/sf_ora/java$ /media/sf_ora/java/jdk1.6.0_45/bin/javac ../tools/JI9028659.java ../tools/JI9028659.java:8: cannot find symbol symbol : method g(java.lang.Class,java.lang.Object) location: class JI9028659 h(g(raw, f(null))); ^ 1 error 7u80,7u85: ************** abhijit@abhijit-VirtualBox:/media/sf_ora/java$ /media/sf_ora/java/jdk1.7.0_85/bin/javac ../tools/JI9028659.java ../tools/JI9028659.java:8: error: no suitable method found for g(Class,Object) h(g(raw, f(null))); ^ method JI9028659.g(Class) is not applicable (actual and formal argument lists differ in length) method JI9028659.<B>g(Class<B>,String) is not applicable (no instance(s) of type variable(s) B exist so that argument type Object conforms to formal parameter type String) where B is a type-variable: B extends Object declared in method <B>g(Class<B>,String) 1 error 8uXX (All version): ****************** abhijit@abhijit-VirtualBox:/media/sf_ora/java$ /media/sf_ora/java/jdk1.8.0/bin/javac ../tools/JI9028659.java Note: ../tools/JI9028659.java uses unchecked or unsafe operations. Note: Recompile with -Xlint:unchecked for details. abhijit@abhijit-VirtualBox:/media/sf_ora/java$ /media/sf_ora/java/jdk1.8.0_51/bin/javac ../tools/JI9028659.java Note: ../tools/JI9028659.java uses unchecked or unsafe operations. Note: Recompile with -Xlint:unchecked for details. abhijit@abhijit-VirtualBox:/media/sf_ora/java$ /media/sf_ora/java/jdk1.8.0_65/bin/javac ../tools/JI9028659.java Note: ../tools/JI9028659.java uses unchecked or unsafe operations. Note: Recompile with -Xlint:unchecked for details. abhijit@abhijit-VirtualBox:/media/sf_ora/java$ /media/sf_ora/java/jdk1.8.0_66/bin/javac ../tools/JI9028659.java Note: ../tools/JI9028659.java uses unchecked or unsafe operations. Note: Recompile with -Xlint:unchecked for details. abhijit@abhijit-VirtualBox:/media/sf_ora/java$ /media/sf_ora/java/jdk1.8.0_72/bin/javac ../tools/JI9028659.java Note: ../tools/JI9028659.java uses unchecked or unsafe operations. Note: Recompile with -Xlint:unchecked for details. 9ea: ****** abhijit@abhijit-VirtualBox:/media/sf_ora/java$ /media/sf_ora/java/jdk1.9.0/bin/javac ../tools/JI9028659.java ../tools/JI9028659.java:8: error: incompatible types: Object cannot be converted to String h(g(raw, f(null))); ^ Note: Some messages have been simplified; recompile with -Xdiags:verbose to get full output 1 error abhijit@abhijit-VirtualBox:/media/sf_ora/java$
01-02-2016