Bug 122906 [quick fix] add unimplemented method does not consider name conflicts
Version: 3.2.0 Build id: I20060105-0800 Having: package ibm.util; public class Properties {} package ibm.util; import java.util.Properties; public interface F { public void b(Properties p); public void g(ibm.util.Properties p); } package ibm.util; public class Test implements F { } Then applying quick fix 'add unimplemented methods' results in: package ibm.util; import java.util.Properties; public class Test implements F { public void b(Properties p) {} public void g(Properties p) {} } But should be: package ibm.util; import java.util.Properties; public class Test implements F { public void b(Properties p) {} public void g(ibm.util.Properties p) {} } or: package ibm.util; import ibm.util.Properties; public class Test implements F { public void b(java.util.Properties p) {} public void g(Properties p) {} }
org.eclipse.jdt.ui.tests/ui/org/eclipse/jdt/ui/tests/core/AddImportTest.java
buf.append("\n");		
		buf.append("public class E<X> {\n");
		buf.append("    public static <T> E<T> bar(T t) { return null; }\n");
		buf.append("    public void foo(E<?> e) {\n");
		buf.append("        bar(e);\n");
		buf.append("    }\n");
		buf.append("}\n");
		ICompilationUnit cu= pack1.createCompilationUnit("E.java", buf.toString(), false, null);
		ASTParser parser= ASTParser.newParser(AST.JLS3);
		parser.setSource(cu);
		parser.setResolveBindings(true);
		CompilationUnit astRoot= (CompilationUnit) parser.createAST(null);
		
		String str= "bar(e)";
		MethodInvocation inv= (MethodInvocation) NodeFinder.perform(astRoot, buf.indexOf(str), str.length());
		ITypeBinding binding= inv.resolveTypeBinding();
		
		NewImportRewrite rewrite= NewImportRewrite.create(astRoot, true);
		
		String string= rewrite.addImport(binding);
		assertEquals("E<?>", string);
		
		Type resNode= rewrite.addImport(binding, astRoot.getAST());
		assertEquals("E<?>", ASTNodes.asString(resNode));
		
		if (!BUG_120082) {
			String signature= new BindingKey(binding.getKey()).internalToSignature();
			
			Type resNode2= rewrite.addImportFromSignature(signature, astRoot.getAST());
			assertEquals("E<?>", ASTNodes.asString(resNode2));