Bug 107105 [1.5][compiler] method override check does not detect differences in additional type bounds
I20050811-1530 + jdt.core v_606 Ecipse compiles these classes without error, although the methods in B and C don't override the one from A: import java.io.Serializable; class A { <S extends Number & Serializable & Runnable > void foo2(S s) { } } class B extends A { @Override // should error <S extends Number & Runnable> void foo2(S s) { } } class C extends A { @Override // should error <S extends Number & Runnable & Cloneable> void foo2(S s) { } } class D extends A { @Override // correct <S extends Number & Runnable & Serializable> void foo2(S s) { } }
org.eclipse.jdt.ui.tests/ui/org/eclipse/jdt/ui/tests/core/OverrideTest.java
buf.append("package override.test;\n");
		buf.append("class C<T> {\n");
		buf.append("    public T id (T x) { return x; }\n");
		buf.append("}\n");
		buf.append("interface I<T> {\n");
		buf.append("    public T id(T x);\n");
		buf.append("}\n");
		buf.append("class D extends C<String> implements I<Integer> {\n");
		buf.append("    public String id(String x) { return x; }\n");
		buf.append("    public Integer id(Integer x) { return x; }\n");
		buf.append("}\n");
		ICompilationUnit cu= fPackage.createCompilationUnit("C.java", buf.toString(), false, null);
		
		CompilationUnit astRoot= createAST(cu);
		IProblem[] problems= astRoot.getProblems();
		assertEquals(1, problems.length);
		assertEquals(IProblem.MethodNameClash, problems[0].getID());
		
		TypeDeclaration c= (TypeDeclaration) astRoot.types().get(0);
		IMethodBinding cid= c.getMethods()[0].resolveBinding();
		
		TypeDeclaration i= (TypeDeclaration) astRoot.types().get(1);
		IMethodBinding iid= i.getMethods()[0].resolveBinding();
		
		TypeDeclaration d= (TypeDeclaration) astRoot.types().get(2);
		IMethodBinding didString= d.getMethods()[0].resolveBinding();
		IMethodBinding didInteger= d.getMethods()[1].resolveBinding();
		
		assertEquals(cid, Bindings.findMethodDefininition(didString, true).getMethodDeclaration());
		assertEquals(iid, Bindings.findMethodDefininition(didInteger, true).getMethodDeclaration());