Every time I see myself putting this.
before variables that are class attributes in non-static methods.
Does eclipse have any option that applies this to all source files?
Every time I see myself putting this.
before variables that are class attributes in non-static methods.
Does eclipse have any option that applies this to all source files?
You can set this in Window-> Preferences-> Java-> Code Style-> Clean Up .
Create a new profile, or edit the current profile.
Go to the Member Accesses tab.
Check: Use 'this' qualifies for field accesses ; then just Always .
All this, just go to the Source-> Clean Up menu.
It can also be set to automatically correct when saving the class through Save Actions ( Window-> Preferences-> Java-> Editor-> Save Actions ).
Enable the checkbox Additional actions and select Configure ... .
In the Member Accesses tab, select Use 'this' qualifier for field accesses and enable Always .NOTE: It can also be configured for methods.
Click OK, close the preferences screen and it will already be active when saving the files.
If you want to avoid typing this.
before each variable, simply use ctrl + espaço
that the variables belonging to the this.
scope will appear for you to choose (autocomplete feature).