JDK-7013577 : Java source compiles on ECLIPSE but fails on JDK 1.5 / 1.6
  • Type: Bug
  • Component: tools
  • Sub-Component: javac
  • Affected Version: 6u23
  • Priority: P2
  • Status: Closed
  • Resolution: Duplicate
  • OS: solaris_10
  • CPU: sparc
  • Submitted: 2011-01-20
  • Updated: 2011-01-22
  • Resolved: 2011-01-21
Related Reports
Duplicate :  
Description
Java source compile on ECLOPSE but failiing on the latest
JDK for 1.5 and 1.6. The code does compile on JDK 7

Source code

public class Test2
{
   public static <T> void method( X<T> x, T t ) {}

   public void testCompile()
   {
       method( new X<Gen<String>>(), new Gen() );  //generates error in javac, not in Eclipse
   }

   private class Gen<T> {}
   private class X<T> extends Gen<T> {}
}

cores2-da-sparc-2-a:/cores_data/pool-1/data4/3-2695544290 23 % /usr/jdk/jdk1.6.0_21/bin/java -version
java version "1.6.0_21"
Java(TM) SE Runtime Environment (build 1.6.0_21-b06)
Java HotSpot(TM) Server VM (build 17.0-b16, mixed mode)

cores2-da-sparc-2-a:/cores_data/pool-1/data4/3-2695544290 25 % /usr/jdk/jdk1.6.0_21/bin/javac Test2.java
Test2.java:7: <T>method(Test2.X<T>,T) in Test2 cannot be applied to (Test2.X<Test2.Gen<java.lang.String>>,Test2.Gen)
               method( new X<Gen<String>>(), new Gen() );  //generates error in javac, not in Eclipse
               ^
1 error
This escalated CR is being worked via CR 6718364

Comments
EVALUATION This is essentially a duplicate of 6718364 which has been fixed in JDK 7 b34. The underlying cause is a bug in the implementation of Types.isSubtypeUnchecked, which is missing an important case (one of the two types could be an UNDETVAR).
21-01-2011