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

Collapse All | Expand All

(-)compiler/org/eclipse/jdt/internal/compiler/lookup/ParameterizedTypeBinding.java (-16 / +21 lines)
Lines 362-390 Link Here
362
	 * LY<TT;>;
362
	 * LY<TT;>;
363
	 */
363
	 */
364
	public char[] genericTypeSignature() {
364
	public char[] genericTypeSignature() {
365
	    if (this.genericTypeSignature == null) {
365
		if (this.genericTypeSignature == null) {
366
		    StringBuffer sig = new StringBuffer(10);
366
			StringBuffer sig = new StringBuffer(10);
367
			if (this.isMemberType() && this.enclosingType().isParameterizedType()) {
367
			if (this.isMemberType() && this.enclosingType().isParameterizedType()) {
368
			    char[] typeSig = this.enclosingType().genericTypeSignature();
368
				char[] typeSig = this.enclosingType().genericTypeSignature();
369
			    for (int i = 0; i < typeSig.length-1; i++) sig.append(typeSig[i]); // copy all but trailing semicolon
369
				sig.append(typeSig, 0, typeSig.length-1);
370
			    sig.append('.').append(this.sourceName());
370
				if (CharOperation.lastIndexOf('>', typeSig) != -1) {
371
					sig.append('.');
372
				} else {
373
					sig.append('$');
374
				}
375
				sig.append(this.sourceName());
371
			} else {
376
			} else {
372
			    char[] typeSig = this.type.signature();
377
				char[] typeSig = this.type.signature();
373
			    for (int i = 0; i < typeSig.length-1; i++) sig.append(typeSig[i]); // copy all but trailing semicolon
378
				sig.append(typeSig, 0, typeSig.length-1);
374
			}	   	    
379
			}
375
			if (this.arguments != null) {
380
			if (this.arguments != null) {
376
			    sig.append('<');
381
				sig.append('<');
377
			    for (int i = 0, length = this.arguments.length; i < length; i++) {
382
				for (int i = 0, length = this.arguments.length; i < length; i++) {
378
			        sig.append(this.arguments[i].genericTypeSignature());
383
					sig.append(this.arguments[i].genericTypeSignature());
379
			    }
384
				}
380
			    sig.append('>');
385
				sig.append('>');
381
			}
386
			}
382
			sig.append(';');
387
			sig.append(';');
383
			int sigLength = sig.length();
388
			int sigLength = sig.length();
384
			this.genericTypeSignature = new char[sigLength];
389
			this.genericTypeSignature = new char[sigLength];
385
			sig.getChars(0, sigLength, this.genericTypeSignature, 0);			
390
			sig.getChars(0, sigLength, this.genericTypeSignature, 0);
386
	    }
391
		}
387
		return this.genericTypeSignature;	    
392
		return this.genericTypeSignature;
388
	}
393
	}
389
	
394
	
390
	/**
395
	/**
(-)src/org/eclipse/jdt/core/tests/compiler/regression/GenericTypeTest.java (-1 / +19 lines)
Lines 32-38 Link Here
32
	// All specified tests which does not belong to the class are skipped...
32
	// All specified tests which does not belong to the class are skipped...
33
	static {
33
	static {
34
//		TESTS_NAMES = new String[] { "test0788" };
34
//		TESTS_NAMES = new String[] { "test0788" };
35
//		TESTS_NUMBERS = new int[] { 1054 };
35
//		TESTS_NUMBERS = new int[] { 1142 };
36
//		TESTS_RANGE = new int[] { 1097, -1 };
36
//		TESTS_RANGE = new int[] { 1097, -1 };
37
	}
37
	}
38
	public static Test suite() {
38
	public static Test suite() {
Lines 38019-38022 Link Here
38019
		"Cycle detected: the type X cannot extend/implement itself or one of its own member types\n" + 
38019
		"Cycle detected: the type X cannot extend/implement itself or one of its own member types\n" + 
38020
		"----------\n");
38020
		"----------\n");
38021
}
38021
}
38022
//https://bugs.eclipse.org/bugs/show_bug.cgi?id=189158
38023
public void test1142() {
38024
	this.runConformTest(
38025
		new String[] {
38026
			"X.java",
38027
			"import java.lang.ref.Reference;\n" +
38028
			"public class X<T> {\n" + 
38029
			"	static class Rather {\n" + 
38030
			"		static class Deeply {}\n" + 
38031
			"	}\n" + 
38032
			"	Reference<X.Rather.Deeply> x;\n" + 
38033
			"	public static void main(String[] args) throws Exception {\n" + 
38034
			"		System.out.println(X.class.getDeclaredField(\"x\").getGenericType());\n" + 
38035
			"	}\n" + 
38036
			"}",
38037
		},
38038
		"java.lang.ref.Reference<X$Rather$Deeply>");
38039
}
38022
}
38040
}

Return to bug 189158