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

Collapse All | Expand All

(-)model/org/eclipse/jdt/internal/core/BinaryMethod.java (-3 / +28 lines)
Lines 28-37 Link Here
28
/* package */ class BinaryMethod extends BinaryMember implements IMethod {
28
/* package */ class BinaryMethod extends BinaryMember implements IMethod {
29
	/**
29
	/**
30
	 * The parameter type signatures of the method - stored locally
30
	 * The parameter type signatures of the method - stored locally
31
	 * to perform equality test. <code>null</code> indicates no
31
	 * to perform equality test. <code>CharOperation.NO_STRINGS</code> indicates no
32
	 * parameters.
32
	 * parameters.
33
	 */
33
	 */
34
	protected String[] parameterTypes;
34
	protected String[] parameterTypes;
35
	protected String [] erasedParamaterTypes; // lazily initialized via call to getErasedParameterTypes
36
	
35
	/**
37
	/**
36
	 * The parameter names for the method.
38
	 * The parameter names for the method.
37
	 */
39
	 */
Lines 52-58 Link Here
52
}
54
}
53
public boolean equals(Object o) {
55
public boolean equals(Object o) {
54
	if (!(o instanceof BinaryMethod)) return false;
56
	if (!(o instanceof BinaryMethod)) return false;
55
	return super.equals(o) && Util.equalArraysOrNull(this.parameterTypes, ((BinaryMethod)o).parameterTypes);
57
	return super.equals(o) && Util.equalArraysOrNull(getErasedParameterTypes(), ((BinaryMethod)o).getErasedParameterTypes());
56
}
58
}
57
public IAnnotation[] getAnnotations() throws JavaModelException {
59
public IAnnotation[] getAnnotations() throws JavaModelException {
58
	IBinaryMethod info = (IBinaryMethod) getElementInfo();
60
	IBinaryMethod info = (IBinaryMethod) getElementInfo();
Lines 372-377 Link Here
372
	return this.parameterTypes;
374
	return this.parameterTypes;
373
}
375
}
374
376
377
// https://bugs.eclipse.org/bugs/show_bug.cgi?id=299384
378
private String [] getErasedParameterTypes() {
379
	if (this.erasedParamaterTypes == null) {
380
		int paramCount = this.parameterTypes.length;
381
		String [] erasedTypes = new String [paramCount];
382
		boolean erasureNeeded = false;
383
		for (int i = 0; i < paramCount; i++) {
384
			String parameterType = this.parameterTypes[i];
385
			if (parameterType.indexOf(Signature.C_GENERIC_START, 0) >= 0) {
386
				erasedTypes[i] = new String(Signature.getTypeErasure(parameterType.toCharArray()));
387
				erasureNeeded = true;
388
			} else {
389
				erasedTypes[i] = parameterType;
390
			}
391
		}
392
		this.erasedParamaterTypes = erasureNeeded ? erasedTypes : this.parameterTypes;
393
	}
394
	return this.erasedParamaterTypes;
395
}
396
private String getErasedParameterType(int index) {
397
	return getErasedParameterTypes()[index];
398
}
399
375
public ITypeParameter getTypeParameter(String typeParameterName) {
400
public ITypeParameter getTypeParameter(String typeParameterName) {
376
	return new TypeParameter(this, typeParameterName);
401
	return new TypeParameter(this, typeParameterName);
377
}
402
}
Lines 446-452 Link Here
446
public int hashCode() {
471
public int hashCode() {
447
   int hash = super.hashCode();
472
   int hash = super.hashCode();
448
	for (int i = 0, length = this.parameterTypes.length; i < length; i++) {
473
	for (int i = 0, length = this.parameterTypes.length; i < length; i++) {
449
	    hash = Util.combineHashCodes(hash, this.parameterTypes[i].hashCode());
474
	    hash = Util.combineHashCodes(hash, getErasedParameterType(i).hashCode());
450
	}
475
	}
451
	return hash;
476
	return hash;
452
}
477
}
(-)src/org/eclipse/jdt/core/tests/model/ResolveTests.java (-2 / +2 lines)
Lines 2610-2616 Link Here
2610
	);
2610
	);
2611
}
2611
}
2612
// https://bugs.eclipse.org/bugs/show_bug.cgi?id=299384
2612
// https://bugs.eclipse.org/bugs/show_bug.cgi?id=299384
2613
public void _testCodeSelectInHybrid1415Projects() throws CoreException, IOException {
2613
public void testCodeSelectInHybrid1415Projects() throws CoreException, IOException {
2614
	String jarName = "bug299384.jar";
2614
	String jarName = "bug299384.jar";
2615
	String srcName = "bug299384_src.zip";
2615
	String srcName = "bug299384_src.zip";
2616
	try {
2616
	try {
Lines 2641-2647 Link Here
2641
2641
2642
		assertElementsEqual(
2642
		assertElementsEqual(
2643
			"Unexpected elements",
2643
			"Unexpected elements",
2644
			"TestSuite(java.lang.Class<? extends TestCase>) [in TestSuite [in TestSuite.class [in <default> [in bug299384.jar [in Resolve]]]]]",
2644
			"TestSuite(java.lang.Class) [in TestSuite [in TestSuite.class [in <default> [in bug299384.jar [in Resolve]]]]]",
2645
			elements
2645
			elements
2646
		);
2646
		);
2647
	} finally {
2647
	} finally {

Return to bug 299384