Menu

#1310 False negative for NP_METHOD_RETURN_RELAXING_ANNOTATION

3.0.1
closed-fixed
None
5
2014-11-09
2014-10-07
No

When an interface returns @Nonnull, an implementation should not be able to override this with @Nullable.

FindBugs version: 3.0.0
JDK/JRE version: Java 8

public interface CustomInterface {
    @Nonnull
    public Object getObject();
}

public class ConcreteClass implements CustomInterface {

    @Override
    @Nullable // Return relaxes nullness
    public Object getObject() {
        return null;
    }
}

Discussion

  • Andrey Loskutov

    Andrey Loskutov - 2014-11-09
    • status: open --> open-accepted
    • assigned_to: Andrey Loskutov
    • Group: 3.x --> 3.0.1
     
  • Andrey Loskutov

    Andrey Loskutov - 2014-11-09

    Yep. We catch only @CheckForNull here, not @Nullable.

     
  • Andrey Loskutov

    Andrey Loskutov - 2014-11-09
    • status: open-accepted --> closed-fixed
     

Log in to post a comment.