Bug 94206

Summary: CCE in BindingKeyResolver when restoring array type of method type parameter
Product: [Eclipse Project] JDT Reporter: Markus Keller <markus.kell.r>
Component: CoreAssignee: Jerome Lanneluc <jerome_lanneluc>
Status: VERIFIED FIXED QA Contact:
Severity: major    
Priority: P3 CC: dirk_baeumer, philippe_mulet
Version: 3.1   
Target Milestone: 3.1 M7   
Hardware: PC   
OS: Windows XP   
Whiteboard:

Description Markus Keller CLA 2005-05-09 18:13:42 EDT
N20050509-0010

In java.util.List<E>, consider
    <T> T[] toArray(T[] a);

The key for T[] is
    [Ljava/util/List;.toArray<T:Ljava/lang/Object;>([TT;)[TT;:TT;

Resolving this key to a binding via ASTParser.createASTs(..) fails with the CCE
below. To reproduce, you can use the ASTView (View Menu > Resolve Binding Key...).

java.lang.ClassCastException:
org/eclipse/jdt/internal/compiler/lookup/ArrayBinding incompatible with
org/eclipse/jdt/internal/compiler/lookup/ReferenceBinding
	at
org.eclipse.jdt.internal.core.util.BindingKeyResolver.consumeMethod(BindingKeyResolver.java)
	at
org.eclipse.jdt.internal.core.util.BindingKeyParser.parseMethod(BindingKeyParser.java:666)
	at
org.eclipse.jdt.internal.core.util.BindingKeyParser.parse(BindingKeyParser.java:560)
	at
org.eclipse.jdt.internal.core.util.BindingKeyParser.parse(BindingKeyParser.java:511)
	at
org.eclipse.jdt.internal.core.util.BindingKeyResolver.getCompilerBinding(BindingKeyResolver.java:418)
	at
org.eclipse.jdt.core.dom.CompilationUnitResolver.resolve(CompilationUnitResolver.java:734)
	at
org.eclipse.jdt.core.dom.CompilationUnitResolver.resolve(CompilationUnitResolver.java:460)
	at org.eclipse.jdt.core.dom.ASTParser.createASTs(ASTParser.java:646)
	at
org.eclipse.jdt.astview.views.ASTView.performResolveBindingKey(ASTView.java:1123)
	at org.eclipse.jdt.astview.views.ASTView$13.run(ASTView.java:808)
	at org.eclipse.jface.action.Action.runWithEvent(Action.java:996)
Comment 1 Dirk Baeumer CLA 2005-05-11 04:20:38 EDT
Philippe, this bug cause a problem in Infer Type Arguments. Can you have a look
at it early in the RC1 fix pass ?
Comment 2 Jerome Lanneluc CLA 2005-05-11 09:53:28 EDT
Changed BindingKeyParser to have a new semantic action comsumeKey() called at
the end of the parse and changed BindingKeyResolver to create the array binding
only in this semantic action.

Added regression test BatchASTCreationTest#test062()
Comment 3 Frederic Fusier CLA 2005-05-12 11:25:35 EDT
D:\usr\OTI\workspaces\tests\M7\junit
Comment 4 Frederic Fusier CLA 2005-05-12 11:30:58 EDT
Oooops, sorry, forgot previous comment.
I wanted to say...Verified for 3.1 M7 using build I20050509-2010 + jdt.core HEAD.