Steps to reproduce:
1. Expand the attached .tgz file.
2. Edit build.xml and point
findbugs-home at a FindBugs installation.
findbugs.xml with one bug reported.
The 'bug' is supposedly an unconfirmed cast on line 6 of Child.java. FindBugs claims that the returned value of the superclass method is
Interim, and therefore cannot be assigned to a variable of type
Something without a cast.
However, the generics in the definition of the method in the superclass state that the return type is
T, and in
Child this type parameter has been specified as
Something -- therefore the value returned by the superclass method must be a
By comparison, doing exactly the same thing with FindBugs 1.3.9 does not produce any bug warnings.
Interestingly, changing the definition of the
T type parameter in
Parent.java to be more general, as per the commented-out line at the beginning of the file, causes the bug warning to go away.
Java Versions: reproduced with both 1.7.0_45 and 1.6.0_65
OS: Mac OS X 10.8.5