Bug 82159

Summary: [compiler][1.5] Eclipse vs. javac: Differences when creating generic inner types
Product: [Eclipse Project] JDT Reporter: Markus Keller <markus.kell.r>
Component: CoreAssignee: Philipe Mulet <philippe_mulet>
Status: VERIFIED FIXED QA Contact:
Severity: minor    
Priority: P3    
Version: 3.1   
Target Milestone: 3.1 M5   
Hardware: PC   
OS: Windows XP   
Whiteboard:

Description Markus Keller CLA 2005-01-04 12:38:47 EST
I20041221-0800

Eclipse and javac have differences when creating generic inner types. Compiler
outputs inlined in the example below. Maybe related to bug 78934.

class Outer<A> {
  class Inner<B> { }

  void method() {
    Outer<String>.Inner<Integer> a= new Outer<String>().new Inner<Integer>();
    Inner<Integer> b= new Outer<A>().new Inner<Integer>();
    Inner<Integer> c= new Inner<Integer>();
    //OK for javac and eclipse

    Outer<String>.Inner<Integer> d= new Outer<String>.Inner<Integer>();
    //eclipse: OK
    //javac: error: '(' or '[' expected

    Outer<A>.Inner<Integer> e= new Outer<A>().new Inner<Integer>();
    Outer<A>.Inner<Integer> f= new Inner<Integer>();
    e= b;
    f= c;
    //javac: OK
    //eclipse: Type mismatch: cannot convert from Outer<A>.Inner<Integer> to
Outer<A>.Inner<Integer>

  }
}

class External {
  void m() {
    Outer<String>.Inner<Integer> x= new Outer<String>().new Inner<Integer>();
    //OK for javac and eclipse
  }
}
Comment 1 Philipe Mulet CLA 2005-01-07 12:58:50 EST
Unexpected type mismatch was due to missing identity check in
QualifiedParameterizedTypeReference (param->generic).

Was also missing detection of invalid construct: new X<A>.Y<B>().

Added regression tests: GenericTypeTest#test446-451.
Fixed
Comment 2 Jerome Lanneluc CLA 2005-02-15 05:32:49 EST
Verified in I20050214