Menu

#1125 Nonnull should not be applied to scalars

closed-fixed
5
2012-11-13
2012-10-26
Anonymous
No

We use a custom @FieldsAreNonnullByDefault annotation at the package level, but this causes FindBugs (at least in the Eclipse plugin) to warn about uninitialized scalar fields such as int, boolean, etc. FindBugs should ignore all scalar fields, parameters, and method return values when checking the nullness annotations.

You can trigger the same warning by adding @Nonnull to any scalar declaration.

import javax.annotation.Nonnull;

public class IgnoreNonnullForScalarTypes
{
@Nonnull
private int scalar;
}

The workaround now is to add @Nullable to scalar declarations which is misleading.

Discussion

  • William Pugh

    William Pugh - 2012-11-13
    • status: open --> open-fixed
     
  • William Pugh

    William Pugh - 2012-11-13

    thanks.

     
  • William Pugh

    William Pugh - 2012-11-13
    • status: open-fixed --> closed-fixed
     

Log in to post a comment.

MongoDB Logo MongoDB