View | Details | Raw Unified | Return to bug 149573 | Differences between
and this patch

Collapse All | Expand All

(-)compiler/org/eclipse/jdt/internal/compiler/lookup/ParameterizedTypeBinding.java (-1 / +1 lines)
Lines 97-103 Link Here
97
		for (int i = 0; i < length; i++) {
97
		for (int i = 0; i < length; i++) {
98
			TypeBinding argument = originalArguments[i];
98
			TypeBinding argument = originalArguments[i];
99
			if (argument.kind() == Binding.WILDCARD_TYPE && ((WildcardBinding)argument).otherBounds == null) { // no capture for intersection types
99
			if (argument.kind() == Binding.WILDCARD_TYPE && ((WildcardBinding)argument).otherBounds == null) { // no capture for intersection types
100
				capturedArguments[i] = new CaptureBinding((WildcardBinding) argument, contextType, position);
100
				capturedArguments[i] = new CaptureBinding((WildcardBinding) argument, contextType, position, this.environment.nextCaptureID());
101
			} else {
101
			} else {
102
				capturedArguments[i] = argument;
102
				capturedArguments[i] = argument;
103
			}
103
			}
(-)compiler/org/eclipse/jdt/internal/compiler/lookup/LookupEnvironment.java (+4 lines)
Lines 62-67 Link Here
62
	private SimpleLookupTable uniqueRawTypeBindings;
62
	private SimpleLookupTable uniqueRawTypeBindings;
63
	private SimpleLookupTable uniqueWildcardBindings;
63
	private SimpleLookupTable uniqueWildcardBindings;
64
	private SimpleLookupTable uniqueParameterizedGenericMethodBindings;
64
	private SimpleLookupTable uniqueParameterizedGenericMethodBindings;
65
	private int captureID = 1;
65
	
66
	
66
	public CompilationUnitDeclaration unitBeingCompleted = null; // only set while completing units
67
	public CompilationUnitDeclaration unitBeingCompleted = null; // only set while completing units
67
68
Lines 1148-1153 Link Here
1148
			: new MethodVerifier15(this); // covariance only if sourceLevel is >= 1.5
1149
			: new MethodVerifier15(this); // covariance only if sourceLevel is >= 1.5
1149
	return verifier;
1150
	return verifier;
1150
}
1151
}
1152
public int nextCaptureID() {
1153
	return this.captureID++;
1154
}
1151
public void reset() {
1155
public void reset() {
1152
	this.defaultPackage = new PackageBinding(this); // assume the default package always exists
1156
	this.defaultPackage = new PackageBinding(this); // assume the default package always exists
1153
	this.defaultImports = null;
1157
	this.defaultImports = null;
(-)compiler/org/eclipse/jdt/internal/compiler/lookup/TypeConstants.java (-1 / +2 lines)
Lines 43-49 Link Here
43
    char[] WILDCARD_MINUS = { '-' };
43
    char[] WILDCARD_MINUS = { '-' };
44
    char[] WILDCARD_STAR = { '*' };
44
    char[] WILDCARD_STAR = { '*' };
45
    char[] WILDCARD_PLUS = { '+' };
45
    char[] WILDCARD_PLUS = { '+' };
46
    char[] WILDCARD_CAPTURE_NAME = "capture-of ".toCharArray(); //$NON-NLS-1$
46
    char[] WILDCARD_CAPTURE_NAME_PREFIX = "capture$".toCharArray(); //$NON-NLS-1$
47
    char[] WILDCARD_CAPTURE_NAME_SUFFIX = "-of ".toCharArray(); //$NON-NLS-1$
47
	char[] WILDCARD_CAPTURE = { '!' };
48
	char[] WILDCARD_CAPTURE = { '!' };
48
	char[] BYTE = "byte".toCharArray(); //$NON-NLS-1$
49
	char[] BYTE = "byte".toCharArray(); //$NON-NLS-1$
49
	char[] SHORT = "short".toCharArray(); //$NON-NLS-1$
50
	char[] SHORT = "short".toCharArray(); //$NON-NLS-1$
(-)compiler/org/eclipse/jdt/internal/compiler/lookup/CaptureBinding.java (-7 / +40 lines)
Lines 18-35 Link Here
18
	
18
	
19
	public TypeBinding lowerBound;
19
	public TypeBinding lowerBound;
20
	public WildcardBinding wildcard;
20
	public WildcardBinding wildcard;
21
	public int captureID;
21
	
22
	
22
	/* information to compute unique binding key */
23
	/* information to compute unique binding key */
23
	public ReferenceBinding sourceType;
24
	public ReferenceBinding sourceType;
24
	public int position;
25
	public int position;
25
	
26
	
26
	public CaptureBinding(WildcardBinding wildcard, ReferenceBinding sourceType, int position) {
27
	public CaptureBinding(WildcardBinding wildcard, ReferenceBinding sourceType, int position, int captureID) {
27
		super(TypeConstants.WILDCARD_CAPTURE_NAME, null, 0);
28
		super(TypeConstants.WILDCARD_CAPTURE_NAME_PREFIX, null, 0);
28
		this.wildcard = wildcard;
29
		this.wildcard = wildcard;
29
		this.modifiers = ClassFileConstants.AccPublic | ExtraCompilerModifiers.AccGenericSignature; // treat capture as public
30
		this.modifiers = ClassFileConstants.AccPublic | ExtraCompilerModifiers.AccGenericSignature; // treat capture as public
30
		this.fPackage = wildcard.fPackage;
31
		this.fPackage = wildcard.fPackage;
31
		this.sourceType = sourceType;
32
		this.sourceType = sourceType;
32
		this.position = position;
33
		this.position = position;
34
		this.captureID = captureID;
33
	}
35
	}
34
36
35
	/*
37
	/*
Lines 54-61 Link Here
54
	}	
56
	}	
55
57
56
	public String debugName() {
58
	public String debugName() {
59
57
		if (this.wildcard != null) {
60
		if (this.wildcard != null) {
58
			return String.valueOf(TypeConstants.WILDCARD_CAPTURE_NAME) + this.wildcard.debugName();
61
			StringBuffer buffer = new StringBuffer(10);
62
			buffer
63
				.append(TypeConstants.WILDCARD_CAPTURE_NAME_PREFIX)
64
				.append(this.captureID)
65
				.append(TypeConstants.WILDCARD_CAPTURE_NAME_SUFFIX)
66
				.append(this.wildcard.debugName());
67
			return buffer.toString();
59
		}
68
		}
60
		return super.debugName();
69
		return super.debugName();
61
	}
70
	}
Lines 156-176 Link Here
156
165
157
	public char[] readableName() {
166
	public char[] readableName() {
158
		if (this.wildcard != null) {
167
		if (this.wildcard != null) {
159
			return CharOperation.concat(TypeConstants.WILDCARD_CAPTURE_NAME, this.wildcard.readableName());
168
			StringBuffer buffer = new StringBuffer(10);
169
			buffer
170
				.append(TypeConstants.WILDCARD_CAPTURE_NAME_PREFIX)
171
				.append(this.captureID)
172
				.append(TypeConstants.WILDCARD_CAPTURE_NAME_SUFFIX)
173
				.append(this.wildcard.readableName());
174
			int length = buffer.length();
175
			char[] name = new char[length];
176
			buffer.getChars(0, length, name, 0);
177
			return name;
160
		}
178
		}
161
		return super.readableName();
179
		return super.readableName();
162
	}
180
	}
163
	
181
	
164
	public char[] shortReadableName() {
182
	public char[] shortReadableName() {
165
		if (this.wildcard != null) {
183
		if (this.wildcard != null) {
166
			return CharOperation.concat(TypeConstants.WILDCARD_CAPTURE_NAME, this.wildcard.shortReadableName());
184
			StringBuffer buffer = new StringBuffer(10);
185
			buffer
186
				.append(TypeConstants.WILDCARD_CAPTURE_NAME_PREFIX)
187
				.append(this.captureID)
188
				.append(TypeConstants.WILDCARD_CAPTURE_NAME_SUFFIX)
189
				.append(this.wildcard.shortReadableName());
190
			int length = buffer.length();
191
			char[] name = new char[length];
192
			buffer.getChars(0, length, name, 0);
193
			return name;
167
		}
194
		}
168
		return super.shortReadableName();
195
		return super.shortReadableName();		
169
	}
196
	}
170
	
197
	
171
	public String toString() {
198
	public String toString() {
172
		if (this.wildcard != null) {
199
		if (this.wildcard != null) {
173
			return String.valueOf(TypeConstants.WILDCARD_CAPTURE_NAME) + this.wildcard.toString();
200
			StringBuffer buffer = new StringBuffer(10);
201
			buffer
202
				.append(TypeConstants.WILDCARD_CAPTURE_NAME_PREFIX)
203
				.append(this.captureID)
204
				.append(TypeConstants.WILDCARD_CAPTURE_NAME_SUFFIX)
205
				.append(this.wildcard);
206
			return buffer.toString();
174
		}
207
		}
175
		return super.toString();
208
		return super.toString();
176
	}		
209
	}		

Return to bug 149573