I have this piece of code in my Java program:
I also have a code check xml which checks the format of my Java code. The xml contains the following check which prevents me fromm using the this keyword:
Is there any way I can edit my program to work without using this?
Campbell Ritchie wrote:Since the usual convention is that what you wrote originally is a good form for a constructor or setXX method, the XML check is incorrect and (I think) ought to be changed.
I agree with this. you should change your configuration so that that warning no longer appears. It is bad advice.
Norm Radder wrote:What about the general case for referencing class fields?
In your given code snippet there are no class fields. There is a field with package private access modifier. You might wanted to write "static String aVar ...".