#222 Unused field reported if only used in calculation

release_3.3
closed
Rick Giles
5
2012-10-10
2004-03-19
Brad Dompe
No

I have the following variable:
private static final long MILLIS_IN_ONE_DAY =
86400000L;

This is used twice in a public method as part of two
calculations:
long daysPassedSinceStart = (nowMillis - start) /
MILLIS_IN_ONE_DAY;

If I add "long test= MILLIS_IN_ONE_DAY;" anywhere in
the code, the error goes away.

The fact that it's only used in an equation seems to be
why Checkstyle misses it. I tried a few other
possibilities: removed 'static', removed 'final', changed it
to an 'int', changed the math to '+'. None of those
corrected it, so I don't think they're the cause.

Discussion

  • Rick Giles
    Rick Giles
    2004-03-20

    Logged In: YES
    user_id=539926

    This is a duplicate of bug 908339 and is fixed in the
    current CVS.