#351 OneMethodPrivateField checks static attributes

open
nobody
None
1
2012-10-10
2005-03-13
No

OneMethodPrivateField is most of the time nonsensical
for static fields. For instance, a standard idiom for
singletons is to store at creation time the only
instance in a private static final variable, and have
getInstance() return that variable.

OneMethodPrivateField rational is correct for
instance variables, but not for static variables,
as static variables might be fruitfully reused. There
is such thing as C's "local static variable" in Java,
so we have to use global static variables.

At least an option to exclude static attributes would
be very useful.

Discussion

  • Oleg Sukhodolsky

    Logged In: YES
    user_id=746148

    the check works as designed. Thus transform this bug to RFE

     
  • Oleg Sukhodolsky

    Logged In: YES
    user_id=746148

    Usage checks were moved to contrib section thus I lower the
    priority for this RFE.

     

Log in to post a comment.