Bug 541651 - [hovering] Use field to show Javadoc for undocumented getter/setter
Summary: [hovering] Use field to show Javadoc for undocumented getter/setter
Status: ASSIGNED
Alias: None
Product: JDT
Classification: Eclipse Project
Component: Text (show other bugs)
Version: 4.10   Edit
Hardware: All All
: P3 enhancement (vote)
Target Milestone: ---   Edit
Assignee: JDT-Text-Inbox CLA
QA Contact:
URL:
Whiteboard:
Keywords: helpwanted
Depends on:
Blocks:
 
Reported: 2018-11-28 12:06 EST by Steffen Brüntjen CLA
Modified: 2018-11-29 07:55 EST (History)
1 user (show)

See Also:


Attachments

Note You need to log in before you can comment on or make changes to this bug.
Description Steffen Brüntjen CLA 2018-11-28 12:06:28 EST
While the Eclipse Javadoc popup on private members, their getters and their setters is extremely helpful, it's very reasonable to not add documentation in three places. That is so, because copying documentation is an additional expenditure itself and changes would have to be applied in all these places. So here's what I'd like to propose. Let's say we have this class:


class Human {

    /** Name of the human */
    private String name;

    public String getName() {
        return name;
    }

    public void setName(String name) {
        this.name = name;
    }

}


When showing the Javadoc popup for one of the getters or setters, Eclipse could  show the original object member documentation in the case there's no existing documentation on the method.

One easy solution, albeit not the best one would be to implicitly add this Javadoc:


For getters:

/**
 * @return {@link #name}
 */


For setters:

/**
 * @param name {@link #name}
 */


This is an almost static replacement for empty Javadoc. The only dynamic part here is #name. A more sophisticated solution would be to show the complete original Javadoc.
Comment 1 Dani Megert CLA 2018-11-29 06:18:35 EST
Hint: When generating getters and setters you can also choose to add the comments.
Comment 2 Steffen Brüntjen CLA 2018-11-29 07:55:59 EST
Yep, I know that, but
  - changes would have to be applied in all these places and
  - that's boilerplate code which makes classes larger

Thanks!