Bug 220111 - [1.5][compiler] Type mismatch errors on identical types; code compiles with javac
Summary: [1.5][compiler] Type mismatch errors on identical types; code compiles with j...
Status: VERIFIED FIXED
Alias: None
Product: JDT
Classification: Eclipse Project
Component: Core (show other bugs)
Version: 3.3.1   Edit
Hardware: PC Windows XP
: P3 normal (vote)
Target Milestone: 3.4 M6   Edit
Assignee: Philipe Mulet CLA
QA Contact:
URL:
Whiteboard:
Keywords:
Depends on:
Blocks:
 
Reported: 2008-02-24 16:15 EST by Trevor Robinson CLA
Modified: 2008-03-25 12:51 EDT (History)
2 users (show)

See Also:


Attachments
Tarball of source code that fails to compile (78.47 KB, application/x-gzip)
2008-02-24 16:15 EST, Trevor Robinson CLA
no flags Details

Note You need to log in before you can comment on or make changes to this bug.
Description Trevor Robinson CLA 2008-02-24 16:15:00 EST
Created attachment 90589 [details]
Tarball of source code that fails to compile

Build ID: M20071023-1652

Steps To Reproduce:
Untar the attached code, create a Java project for it, and note the type mismatch compile errors indicating identical types:

The method put(Sequence.Pos, Parser<Token,NodeType>.Table.State<Token>) in the type HashMap<Sequence.Pos,Parser<Token,NodeType>.Table.State<Token>> is not applicable for the arguments (Sequence.Pos, Parser<Token,NodeType>.Table.State<Token>)	sbp/src/edu/berkeley/sbp	Parser.java	line 467
Type mismatch: cannot convert from element type edu.berkeley.sbp.Parser<Token,NodeType>.Table.State<Token> to edu.berkeley.sbp.Parser<Token,NodeType>.Table.State<Token>	sbp/src/edu/berkeley/sbp	Parser.java	line 206
Type mismatch: cannot convert from element type edu.berkeley.sbp.Parser<Token,NodeType>.Table.State<Token> to edu.berkeley.sbp.Parser<Token,NodeType>.Table.State<Token>	sbp/src/edu/berkeley/sbp	Parser.java	line 240
Type mismatch: cannot convert from Parser<Token,NodeType>.Table.State<Token> to Parser<Token,NodeType>.Table.State<Token>	sbp/src/edu/berkeley/sbp	Parser.java	line 194
Type mismatch: cannot convert from Parser<Token,NodeType>.Table.State<Token> to Parser<Token,NodeType>.Table.State<Token>	sbp/src/edu/berkeley/sbp	Parser.java	line 197
Type mismatch: cannot convert from Parser<Token,NodeType>.Table.State<Token> to Parser<Token,NodeType>.Table.State<Token>	sbp/src/edu/berkeley/sbp	Parser.java	line 455

This code compiles without error under javac (JDK 1.6.0_04).

More information:
The project that fails to compile is SBP: the Scannerless Boolean Parser (http://research.cs.berkeley.edu/project/sbp/).

The latest snapshot is available using darcs: 'darcs get http://research.cs.berkeley.edu/project/sbp/edu.berkeley.sbp/'.

The license is BSD, so I'm attaching the tarball of the version the demonstrates this bug.
Comment 1 Philipe Mulet CLA 2008-02-25 13:06:23 EST
Karice - is the BSD licensed source code ok for me to look at ?
Comment 2 Philipe Mulet CLA 2008-02-25 18:19:12 EST
Got legal clearance to look at source code.
Comment 3 Philipe Mulet CLA 2008-02-25 18:42:50 EST
Simplified testcase:

public class X<Token, NodeType> {
  class Table {
    State<Token> s;
    Table() {
      this.s = new State<Token>();
    }
    class State<T> {
    }
  }
}

This should compile with no error.

Problem comes from ParameterizedSingleTypeReference which fails to convert X<Token,NodeType>.Table 
into a parameterized type.

Added GenericTypeTest#test1293-1294
Comment 4 Philipe Mulet CLA 2008-02-27 10:47:57 EST
Patch combined with https://bugs.eclipse.org/bugs/attachment.cgi?id=90846
Also added GenericTypeTest#test1296-1298
Released for 3.4M6.
Fixed
Comment 5 Philipe Mulet CLA 2008-02-28 07:35:16 EST
Released fix in 3.3.x maintenance branch (post 3.3.2)
Comment 6 Frederic Fusier CLA 2008-03-25 12:51:53 EDT
Verified for 3.4M6 using I20080324-1300.