#556 New check: AvoidModifiersForTypes

open
nobody
None
5
2012-10-10
2011-01-12
Roman Ivanov
No

Disallow some set of modifiers for specified Java types.
Example: it hard to imagine common problems for such cases but in our case is a
static for ULCComponents is not allowed(http://ulc-community.canoo.com/snipsnap/space/Good+Practices) .

Only 4 types according to Java Spec: static, final, transient, volatile.
So we could have settings like this:
Static - "ULC*"
Final - ""
Transient - ""
Volatile - ""

Algorithm:
We detect variable/field declaration, detect modifier, check modifier's RegExp against Java Type, if match - fire error.

Discussion