java – Are there any Eclipse features that include "this." before every variable where this is implied?

Question:

Every time I find myself putting this. before variables that are class attributes in non-static methods.

Does eclipse have any option that applies this to all source code files?

Answer:

You can set this in Window->Preferences->Java->Code Style->Clean Up .

Create a new profile, or edit the current one.

Go to the Member Accesses tab.

Check: Use 'this' qualifies for field accesses ; then just check Always .

Once all that is done, just go to the Source->Clean Up menu.

Scroll to Top