Project: JDT
Bug 41903 bug in "Use SuperType Where Possible" [refactoring]
Reported: 2003-08-24 15:44:50 | Status: resolved fixed

When I try to apply "Use SuperType Where Possible" to the program below (trying to replace references to type "FastEcho" with references to type "Echo"), I get a popup "The refactoring does not change any source code." However, the declaration of variable f in class "Hello" can be given type "Echo". - Frank Echo.java: public interface Echo { public String echo(String s); } FastEcho.java: public class FastEcho extends SuperEcho { } Goodbye.java: public class Goodbye { static public void use(FastEcho f) { System.out.println(f.echo("Goodbye world.")); } } Hello.java: public class Hello { public static void main(String[] args) { System.out.println("Hello"); FastEcho f = new FastEcho(); System.out.println( f.echo("World.") ); // Goodbye.use(f); } } SlowEcho.java: public class SlowEcho extends SuperEcho { public String echo(String s){ try { Thread.sleep(5000); } catch (InterruptedException e) { e.printStackTrace(); } return s; } } SuperEcho.java: public class SuperEcho implements Echo { public String echo(String s){ return s; } }

Files changed in fix:
org.eclipse.jdt.ui.tests.refactoring/test cases/org/eclipse/jdt/ui/tests/refactoring/ExtractInterfaceTests.java org.eclipse.jdt.ui/core refactoring/org/eclipse/jdt/internal/corext/refactoring/structure/ChangeTypeRefactoring.java org.eclipse.jdt.ui/core refactoring/org/eclipse/jdt/internal/corext/refactoring/structure/ExtractInterfaceUtil.java org.eclipse.jdt.ui/core refactoring/org/eclipse/jdt/internal/corext/refactoring/typeconstraints/ConstraintVariable.java org.eclipse.jdt.ui/core refactoring/org/eclipse/jdt/internal/corext/refactoring/typeconstraints/FullConstraintCreator.java org.eclipse.jdt.ui/core refactoring/org/eclipse/jdt/internal/corext/refactoring/typeconstraints/ITypeConstraintFactory.java org.eclipse.jdt.ui/core refactoring/org/eclipse/jdt/internal/corext/refactoring/typeconstraints/TypeBindings.java org.eclipse.jdt.ui/core refactoring/org/eclipse/jdt/internal/corext/refactoring/typeconstraints/TypeConstraintFactory.java