Bug 94092 - ASTParser#createASTs(..) restores wrong bindings from capture keys
Summary: ASTParser#createASTs(..) restores wrong bindings from capture keys
Status: VERIFIED FIXED
Alias: None
Product: JDT
Classification: Eclipse Project
Component: Core (show other bugs)
Version: 3.1   Edit
Hardware: PC Windows XP
: P3 normal (vote)
Target Milestone: 3.1 RC1   Edit
Assignee: Jerome Lanneluc CLA
QA Contact:
URL:
Whiteboard:
Keywords:
Depends on:
Blocks:
 
Reported: 2005-05-09 05:55 EDT by Markus Keller CLA
Modified: 2005-05-27 05:51 EDT (History)
0 users

See Also:


Attachments

Note You need to log in before you can comment on or make changes to this bug.
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