Question

i've read in the eclipse help that it is possible to "Delete getters and setters together with a field". I somehow cannot manage to get it work. Does somebody use this feature and could give me a hint what i'm doing wrong? In the eclipse help file the following is written: "When you delete a field from within a view, Eclipse can propose deleting its Getter and Setter methods. If you use a name prefix or suffix for fields, be sure to specify this in the Java > Code Style preference page." The way i understand it, eclipse should somehow ask me if i want to delete the getter and setter methods for a field that i just removed without any special configuration. This seems not to work. Thanks in advance for help.

kukudas

Was it helpful?

Solution

This doesn't seem to work from the source editor, however, try deleting a field from the Outline View of the class - there it does offer to delete the getter / setter too.

Outline view is available in the JDT under Window: Show View. This also works from the package explorer.

OTHER TIPS

Little off topic, but get rid of all your getter/setters. Use http://projectlombok.org/ in stead. It works great in eclipse. To answer your question, it works from the Outline View as someone has suggested. It is because the getter/setter method is linked to the field in the outline view.

Licensed under: CC-BY-SA with attribution
Not affiliated with StackOverflow
scroll top