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

Collapse All | Expand All

(-)model/org/eclipse/jdt/core/Signature.java (-1 / +13 lines)
Lines 2495-2500 Link Here
2495
	}
2495
	}
2496
	int p = start + 1;
2496
	int p = start + 1;
2497
	int checkpoint = buffer.length();
2497
	int checkpoint = buffer.length();
2498
	int innerTypeStart = -1;
2499
	boolean inAnonymousType = false;
2498
	while (true) {
2500
	while (true) {
2499
		if (p >= string.length) {
2501
		if (p >= string.length) {
2500
			throw new IllegalArgumentException();
2502
			throw new IllegalArgumentException();
Lines 2527-2532 Link Here
2527
				}
2529
				}
2528
				break;
2530
				break;
2529
			 case C_DOLLAR :
2531
			 case C_DOLLAR :
2532
			 	innerTypeStart = buffer.length();
2533
			 	inAnonymousType = false;
2530
			 	if (resolved) {
2534
			 	if (resolved) {
2531
					// once we hit "$" there are no more package prefixes
2535
					// once we hit "$" there are no more package prefixes
2532
					removePackageQualifiers = false;
2536
					removePackageQualifiers = false;
Lines 2540-2546 Link Here
2540
			 	}
2544
			 	}
2541
			 	break;
2545
			 	break;
2542
			 default :
2546
			 default :
2543
				buffer.append(c);
2547
				if (innerTypeStart != -1 && !inAnonymousType && Character.isDigit(c)) {
2548
					inAnonymousType = true;
2549
					buffer.setLength(innerTypeStart); // remove '.'
2550
					buffer.insert(0, "new "); //$NON-NLS-1$
2551
					buffer.append("(){}"); //$NON-NLS-1$
2552
				}
2553
			 	if (!inAnonymousType)
2554
					buffer.append(c);
2555
				innerTypeStart = -1;
2544
		}
2556
		}
2545
		p++;
2557
		p++;
2546
	}
2558
	}
(-)src/org/eclipse/jdt/core/tests/model/SignatureTests.java (+23 lines)
Lines 813-818 Link Here
813
	assertEquals("Signature#toQualifiedName is not correct3", "",
813
	assertEquals("Signature#toQualifiedName is not correct3", "",
814
			Signature.toQualifiedName(new String[0]));
814
			Signature.toQualifiedName(new String[0]));
815
}
815
}
816
817
/*
818
 * Ensures that the toString() signature of an anonymous type is correct
819
 * (regression test for bug 180713 Anonymous type rendered as number in hover)
820
 */
821
public void testToStringAnonymousType() {
822
	assertEquals(
823
		"Signature#toString is not correct", 
824
		"new X(){}",
825
		Signature.toString("LX$123;"));
826
}
827
816
/**
828
/**
817
 * @see Signature#toString(String)
829
 * @see Signature#toString(String)
818
 */
830
 */
Lines 1031-1036 Link Here
1031
		Signature.toString("Lx.y.A$Inner;"));
1043
		Signature.toString("Lx.y.A$Inner;"));
1032
}
1044
}
1033
1045
1046
/*
1047
 * Ensures that the toString() signature of a member type with a number in its name is correct
1048
 * (regression test for bug 180713 Anonymous type rendered as number in hover)
1049
 */
1050
public void testToStringInnerType2() {
1051
	assertEquals(
1052
		"Signature#toString is not correct", 
1053
		"X.Y1",
1054
		Signature.toString("LX$Y1;"));
1055
}
1056
1034
/**
1057
/**
1035
 * @see Signature#getTypeSignatureKind(String)
1058
 * @see Signature#getTypeSignatureKind(String)
1036
 */
1059
 */

Return to bug 180713