Some Eclipse Foundation services are deprecated, or will be soon. Please ensure you've read this important communication.

Bug 387670

Summary: [pull up] Pull up refactoring loses Javadoc when destination type is an interface
Product: [Eclipse Project] JDT Reporter: Hans-Peter Störr <yu4cheem>
Component: UIAssignee: JDT-UI-Inbox <jdt-ui-inbox>
Status: CLOSED DUPLICATE QA Contact:
Severity: normal    
Priority: P3 CC: deepakazad
Version: 3.8   
Target Milestone: ---   
Hardware: PC   
OS: Windows 7   
Whiteboard:

Description Hans-Peter Störr CLA 2012-08-21 04:42:12 EDT
The pull up refactoring on classes works fine, but if I do a pull up refactoring to declare a method in an interface, the Javadoc of the method is lost. For example I invoke the refactoring on method bla in this:

public interface A {
}

public class B implements A {
  
  /** The javadoc */
  public List<String> bla() {
    return Collections.emptyList();
  }

}

I would expect the following declaration to appear in A :

  /** The javadoc */
  List<String> bla();

What really appears is this:

  public abstract List<String> bla();

The modifiers public abstract are unnecessary and should not be present; the Javadoc should be there and List should be imported. (Currently it is not imported such that the refactored code does not even compile.)


If you pull up the method to a superclass but set the action to "declare abstract in destination" you get similar problems (except that the public abstract modifiers are really needed in this case.)


As an aside note, the Javadoc comment of B.bla might be changed to something like the usual

  /* (non-Javadoc)
   * @see de.unilog.cpc.authentication.da.jdbc.A#bla()
   */

as well such that we do not introduce duplication of the comments. But I do not have a strong opinion on that.
Comment 1 Deepak Azad CLA 2012-08-21 23:39:39 EDT

*** This bug has been marked as a duplicate of bug 326832 ***