Community
Participate
Working Groups
Build Identifier: 20100218-1602 My team would like to use this rule, but to exclude references to outer class fields from inner classes. The feeling is that in general they like the this. usage, but in the inner class case having to do NameOfOuterEnclosingClass.this. just feels too long. Maybe it goes against the spirit of the rule, but an option to exclude this case would be nice. Reproducible: Always
Markus, would you support this in the UI if done ?
I wouldn't do that. We already have too many preferences, and it's hard to justify that having "this." everywhere is acceptable but "OuterType.this" is too long. If you need the qualifier to make sure that you don't confuse fields with local variables, then this is even more important in inner types (where the fields and variables can even come from multiple enclosing methods & types). If you're compiling against 1.5 or higher, you can use the quick fix to add @SuppressWarnings("unqualified-field-access") to inner types. And I'm sure you know about the "Java > Editor > Syntax Coloring" and "Java > Code Style" preferences (e.g. an "f" prefix for fields saves a lot of characters).
That's fair. I wanted to submit my team's feedback to my suggesting that we enable this check and see what you guys thought.
Then closing as WONTFIX. Core won't provide an option if it doesn't show up in the UI.