How to disable Eclipse code replacement for "setters"?

Asked

Viewed 169 times

3

When I create a class in eclipse with a type attribute

public class MinhaClasse{
    private String variavel;
}

The eclipse underlines the word "variable" in yellow and if I right-click on it, it allows getters and setters to be generated for that variable.

The problem is that it also replaces references in other methods of type code

variavel = x;

for

setVariavel(x);

I know it doesn’t happen when you use it shift+alt+s and asks to create getters and setters for attributes, but it is much less convenient

It is possible to configure Eclipse not to do this setters?

ps. edited to make the problem clearer

2 answers

2

Simply that, when opening the window to define the names of the methods (this after you have right-clicked, or CTRL+1 above the field - in your example variavel), you mark the option keep field reference

SS

0

Window / Preferences -> Java / Debug

There are 4 Checkboxes related to Hot Code Replace. Disabling all of them will solve your problem

Browser other questions tagged

You are not signed in. Login or sign up in order to post.