Bug 94092

Summary: ASTParser#createASTs(..) restores wrong bindings from capture keys
Product: [Eclipse Project] JDT Reporter: Markus Keller <markus.kell.r>
Component: CoreAssignee: Jerome Lanneluc <jerome_lanneluc>
Status: VERIFIED FIXED QA Contact:
Severity: normal    
Priority: P3    
Version: 3.1   
Target Milestone: 3.1 RC1   
Hardware: PC   
OS: Windows XP   
Whiteboard:

Description Markus Keller CLA 2005-05-09 05:55:37 EDT
N20050508-0010

ASTParser#createASTs(..) restores wrong bindings from keys when multiple capture
bindings are to be restored at once.

In the example below, take the binding of the reference to 'list_wildcard' and
the binding of type argument of 'list_wildcard'. Their keys are:
- Ljava/util/List<Lgeneric/TestCaptureAssignments;!Ljava/util/List;*166;>;
- Lgeneric/TestCaptureAssignments;!Ljava/util/List;*166;

The restored binding for the first key is a ParameterizedTypeBinding 
List<TestCaptureAssignments> with a different key:
- Ljava/util/List<Lgeneric/TestCaptureAssignments;>;

package generic;
import java.util.List;
public class TestCaptureAssignments {
	Object o= null;
	List<?> list_wildcard;
	void use() {
		o= list_wildcard;
	}
}

To reproduce, you can also run the refactoring test
org.eclipse.jdt.ui.tests.typeconstraints.TypeEnvironmentTests with constant
BUG_93102_core_restore_capture_binding set to false and the above version of
resources/TypeEnvironment/TestProject/generic/TestCaptureAssignments.java
Comment 1 Jerome Lanneluc CLA 2005-05-17 09:04:45 EDT
Changed the binding key for parameterized types to put the capture's source type
first. Adapted BindingKeyParser and its subclasses to this change.

Added regression test BatchASTCreationTests#test064()
Comment 2 David Audel CLA 2005-05-27 05:51:44 EDT
Verified in i20050527-0010