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

Collapse All | Expand All

(-)src/org/eclipse/jdt/core/tests/compiler/regression/MethodVerifyTest.java (+39 lines)
Lines 7381-7384 Link Here
7381
		"SUCCESSSUCCESS"
7381
		"SUCCESSSUCCESS"
7382
	);
7382
	);
7383
}
7383
}
7384
// https://bugs.eclipse.org/bugs/show_bug.cgi?id=174445
7385
public void test122() {
7386
	this.runNegativeTest(
7387
		new String[] {
7388
			"X.java",
7389
			"public class X {\n" + 
7390
			"  enum Enum1 {\n" + 
7391
			"    value;\n" + 
7392
			"  }\n" + 
7393
			"  enum Enum2 {\n" + 
7394
			"    value;\n" + 
7395
			"  }\n" + 
7396
			"  static abstract class A<T> {\n" + 
7397
			"    abstract <U extends T> U foo();\n" + 
7398
			"  }\n" + 
7399
			"  static class B extends A<Enum<?>> {\n" + 
7400
			"    @Override\n" + 
7401
			"    Enum<?> foo() {\n" + 
7402
			"      return Enum1.value;\n" + 
7403
			"    }  \n" + 
7404
			"  }\n" + 
7405
			"  public static void main(String[] args) {\n" + 
7406
			"    A<Enum<?>> a = new B();\n" + 
7407
			"    Enum2 value = a.foo();\n" + 
7408
			"  }\n" + 
7409
			"}"
7410
		},
7411
		"----------\n" + 
7412
		"1. WARNING in X.java (at line 13)\n" + 
7413
		"	Enum<?> foo() {\n" + 
7414
		"	^^^^\n" + 
7415
		"Type safety: The return type Enum<?> for foo() from the type X.B needs unchecked conversion to conform to Enum<E> from the type X.A<Enum<?>>\n" + 
7416
		"----------\n" + 
7417
		"2. WARNING in X.java (at line 13)\n" + 
7418
		"	Enum<?> foo() {\n" + 
7419
		"	^^^^\n" + 
7420
		"Type safety: The return type Enum<?> for foo() from the type X.B needs unchecked conversion to conform to U from the type X.A<T>\n" + 
7421
		"----------\n");
7384
}
7422
}
7423
}

Return to bug 174445