简体   繁体   中英

Eclipse generate getters and setters does not encapsulate

When I do quick fix on a field in eclipse I can generate a getter and setter for the field. This also makes the field private und subsequently transforms all access for this field in all source files to use the getter and setter. This is the case for a single field.

However if I do contextmenu > Source > Generate Getters and Setters... (the option to use when you want to affect all fields) it does not make the beforementioned change and all access to the fields in the source code is left as is.

Am I overlooking something?

The quick fix is not going to this menu. The menu that the quick fix call is accessible from Context Menu -> Refactor -> Encapsulate Field

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM