When configuring Eclipse 4.2.0 to perform a null analysis (configured to use @javax.annotation.Nonnull
etc.), the following code will generate the warning
Null type safety: The expression of type int needs unchecked conversion to conform to '@Nonnull Integer'
class C
{
static void foo(int i)
{
bar(i); // Warning
}
static void bar(@javax.annotation.Nonnull Integer i)
{
}
}
How am I supposed to fix this (without using @SuppressWarnings("null")
)? It seems that the analyzer does not know that boxed primitives cannot be null
.