Bug 374271

Summary: [pull up] pull up into generic parent from concrete subclass should change concrete to generic types
Product: [Eclipse Project] JDT Reporter: jules <jules>
Component: UIAssignee: JDT-UI-Inbox <jdt-ui-inbox>
Status: ASSIGNED --- QA Contact:
Severity: enhancement    
Priority: P3 CC: deepakazad
Version: 3.8   
Target Milestone: ---   
Hardware: PC   
OS: Windows 7   
Whiteboard:

Description jules CLA 2012-03-14 12:23:22 EDT
Build Identifier: Version: Indigo Service Release 2 Build id: 20120216-1857

If I have a class that has a generic parent, e.g.:

public interface Parent<T> { }
public class Subclass implements Parent<String> { }

(or similarly with extending a generic class) and I execute the 'pull up' refactoring on a method that uses the concrete type (i.e. String in the example above) in its signature, it seems reasonable that it should change to the appropriate generic type. So if I have:

public class Parent<T> { }
public class Subclass extends Parent<String> { 
   public String getValue() { ... }
}

and I execute a pull up on getValue(), moving it to Parent, the result should be:

public class Parent<T> { 
   public T getValue() { ... }
}
public class Subclass extends Parent<String> { }

as long as making this change does not cause any compiler errors.  This should probably only be an option, and not compulsory behaviour.

Reproducible: Always