In the above example PMD - FieldDeclarationsShouldBeAtStartOfClass will say that onSomeViewClick needs to be declared at the top of the class above the constructor etc.
However for readability purposes it is much better place below where the variable is used and treated like a method block.
Is there any configurable fields for FieldDeclarationsShouldBeAtStartOfClass to allow the above to be valid? Or do I have a case to put this forward as a feature?
If you would like to refer to this comment somewhere else in this project, copy and paste the following link:
I can see your point. We could add a flag to ignore field declarations, that instantiate an anonymous class, like in your example. Would this work?
Other options, that come into mind are: suppressing (e.g. via @SuppressWarnings).
If you would like to refer to this comment somewhere else in this project, copy and paste the following link:
In the above example PMD - FieldDeclarationsShouldBeAtStartOfClass will say that onSomeViewClick needs to be declared at the top of the class above the constructor etc.
However for readability purposes it is much better place below where the variable is used and treated like a method block.
Is there any configurable fields for FieldDeclarationsShouldBeAtStartOfClass to allow the above to be valid? Or do I have a case to put this forward as a feature?
Any feedback?
I can see your point. We could add a flag to ignore field declarations, that instantiate an anonymous class, like in your example. Would this work?
Other options, that come into mind are: suppressing (e.g. via @SuppressWarnings).
I've implemented it as feature [#1244].
Related
Issues:
#1244