#1139 False positive when overriding @Nullable parameter

closed-fixed
5
2014-08-18
2012-11-23
No

1. Guava's Function interface declares apply() takes a single @Nullable parameter.
2. I implement this interface but declare the parameter @Nonnull (essentially overriding the annotation)
3. The Findbugs warning message changes from "id must be nonnull but is marked as nullable" to "x0 must be nonnull but is marked as nullable" where "id" is the parameter found in my implementation and "x0" does not exist.

I believe this is a false-positive. We should be able to override @Nullable with @Nonnull without this lingering warning.

Discussion

  • William Pugh

    William Pugh - 2012-11-25

    I can't replicate this. See the attached sourcefile.
    Can you supply a sourcefile that demonstrates the problem?

     
  • William Pugh

    William Pugh - 2012-11-25
    • assigned_to: nobody --> wpugh
    • labels: --> false positive
    • status: open --> pending-works-for-me
     
  • William Pugh

    William Pugh - 2012-11-25

    problem doesn't manifest itself in this file

     
  • Gili Tzabari

    Gili Tzabari - 2012-11-26

    Testcase

     
  • Gili Tzabari

    Gili Tzabari - 2012-11-26

    Please open the attached testcase in Netbeans (I used 7.3 nightly build but older versions should work too) and run Source -> Inspect -> Findbugs.

    PS: The problem seems to be linked to the use of Generics. Your testcase (using raw types) doesn't trigger the bug.

     
  • Gili Tzabari

    Gili Tzabari - 2012-11-26
    • status: pending-works-for-me --> open-works-for-me
     
  • William Pugh

    William Pugh - 2012-11-26

    Fixed. the problem had to do the interaction of bridge methods and annotations.

     
  • William Pugh

    William Pugh - 2012-11-26
    • status: open-works-for-me --> closed-fixed
     
  • Mikhail Skotnikov

    Hi!
    Is it possible to release new maven artifacts which will include this fix?
    Currently the latest ones are:
    com.google.code.findbugs findbugs 2.0.1 30-Jul-2012

    And it is referred by: org.codehaus.mojo findbugs-maven-plugin 2.5.2 31-Jul-2012

     

Log in to post a comment.

Get latest updates about Open Source Projects, Conferences and News.

Sign up for the SourceForge newsletter:





No, thanks