View | Details | Raw Unified | Return to bug 307885
Collapse All | Expand All

(-)compiler/org/eclipse/jdt/internal/compiler/problem/ProblemReporter.java (-1 / +6 lines)
Lines 2141-2147 Link Here
2141
public void illegalInstanceOfGenericType(TypeBinding checkedType, ASTNode location) {
2141
public void illegalInstanceOfGenericType(TypeBinding checkedType, ASTNode location) {
2142
	TypeBinding erasedType = checkedType.leafComponentType().erasure();
2142
	TypeBinding erasedType = checkedType.leafComponentType().erasure();
2143
	StringBuffer recommendedFormBuffer = new StringBuffer(10);
2143
	StringBuffer recommendedFormBuffer = new StringBuffer(10);
2144
	recommendedFormBuffer.append(erasedType.sourceName());
2144
	if (erasedType instanceof ReferenceBinding) {
2145
		ReferenceBinding referenceBinding = (ReferenceBinding) erasedType;
2146
		recommendedFormBuffer.append(referenceBinding.qualifiedSourceName());
2147
	} else {
2148
		recommendedFormBuffer.append(erasedType.sourceName());
2149
	}
2145
	int count = erasedType.typeVariables().length;
2150
	int count = erasedType.typeVariables().length;
2146
	if (count > 0) {
2151
	if (count > 0) {
2147
		recommendedFormBuffer.append('<');
2152
		recommendedFormBuffer.append('<');
(-)src/org/eclipse/jdt/core/tests/compiler/regression/GenericTypeTest.java (-1 / +28 lines)
Lines 31-37 Link Here
31
	// All specified tests which does not belong to the class are skipped...
31
	// All specified tests which does not belong to the class are skipped...
32
	static {
32
	static {
33
//		TESTS_NAMES = new String[] { "test1245" };
33
//		TESTS_NAMES = new String[] { "test1245" };
34
//		TESTS_NUMBERS = new int[] { 1455 };
34
//		TESTS_NUMBERS = new int[] { 1460 };
35
//		TESTS_RANGE = new int[] { 1097, -1 };
35
//		TESTS_RANGE = new int[] { 1097, -1 };
36
	}
36
	}
37
	public static Test suite() {
37
	public static Test suite() {
Lines 50153-50156 Link Here
50153
		"Type safety: Unchecked invocation someMethod() of the generic method someMethod() of type Bug268798\n" + 
50153
		"Type safety: Unchecked invocation someMethod() of the generic method someMethod() of type Bug268798\n" + 
50154
		"----------\n");
50154
		"----------\n");
50155
}
50155
}
50156
//https://bugs.eclipse.org/bugs/show_bug.cgi?id=307885
50157
public void test1460() {
50158
	this.runNegativeTest(
50159
		new String[] {
50160
			"Test.java",
50161
			"class Test<A> {\n" + 
50162
			"    interface MyInt<K> {\n" + 
50163
			"        K getKey();\n" + 
50164
			"    }\n" + 
50165
			"    class MyEntry implements MyInt<A> {\n" + 
50166
			"        public A getKey() { return null; }\n" + 
50167
			"        @Override\n" + 
50168
			"        public boolean equals(Object o) {\n" + 
50169
			"            if(!(o instanceof MyEntry))\n" + 
50170
			"                return false;\n" + 
50171
			"            return true;\n" + 
50172
			"        }\n" + 
50173
			"    }\n" + 
50174
			"}"
50175
		},
50176
		"----------\n" + 
50177
		"1. ERROR in Test.java (at line 9)\n" + 
50178
		"	if(!(o instanceof MyEntry))\n" + 
50179
		"	    ^^^^^^^^^^^^^^^^^^^^^^\n" + 
50180
		"Cannot perform instanceof check against parameterized type Test<A>.MyEntry. Use the form Test.MyEntry instead since further generic type information will be erased at runtime\n" + 
50181
		"----------\n");
50182
}
50156
}
50183
}

Return to bug 307885