Steps to reproduce:
1. Expand the attached .tgz file.
2. Edit build.xml and point findbugs-home
at a FindBugs installation.
3. ant findbugs
.
4. Produces findbugs.xml
with one bug reported.
The 'bug' is supposedly an unconfirmed cast on line 5 of Renderer.java. FindBugs claims that value
is an Enum
, and therefore we can't call a method from Displayable
without an implied cast.
However, the generics in the definition of the type param T
at the beginning of the class state that T extends Enum<T> & Displayable
, and therefore the value
passed into the method in question must be both an Enum
and a Displayable
-- therefore calling the method from Displayable
is safe.
By comparison, doing exactly the same thing with FindBugs 1.3.9 does not produce any bug warnings.
Java Versions: reproduced with both 1.7.0_45 and 1.6.0_65
OS: Mac OS X 10.8.5
Reproduced as a low priority warning, correct?
Yes, that's right -- as with [#1242], not a very common scenario, but I felt worth logging given the change in behaviour from 1.3.9.
Thanks William,
David
Related
Bugs:
#1242