
Inline adoc files when they are included exactly once. Also fix language tags because this inlining gives us better information on what language the code is written in.
57 lines
995 B
Plaintext
57 lines
995 B
Plaintext
== Why is this an issue?
|
|
|
|
By definition, primitive types are not Objects and so they can't be ``++null++``. Adding ``++@CheckForNull++`` or ``++@Nullable++`` on primitive types adds confusion and is useless.
|
|
|
|
|
|
This rule raises an issue when ``++@CheckForNull++`` or ``++@Nullable++`` is set on a method returning a primitive type: byte, short, int, long, float, double, boolean, char.
|
|
|
|
|
|
=== Noncompliant code example
|
|
|
|
[source,java]
|
|
----
|
|
@CheckForNull
|
|
boolean isFoo() {
|
|
...
|
|
}
|
|
----
|
|
|
|
|
|
=== Compliant solution
|
|
|
|
[source,java]
|
|
----
|
|
boolean isFoo() {
|
|
...
|
|
}
|
|
----
|
|
|
|
|
|
|
|
ifdef::env-github,rspecator-view[]
|
|
|
|
'''
|
|
== Implementation Specification
|
|
(visible only on this page)
|
|
|
|
=== Message
|
|
|
|
"XXX" annotation should not be used on primitive types
|
|
|
|
|
|
=== Highlighting
|
|
|
|
Primitive type
|
|
|
|
|
|
'''
|
|
== Comments And Links
|
|
(visible only on this page)
|
|
|
|
=== on 13 Jun 2018, 17:30:29 Alexandre Gigleux wrote:
|
|
@CheckForNull = javax.annotation.Nullable
|
|
|
|
@Nullable = javax.annotation.CheckForNull
|
|
|
|
endif::env-github,rspecator-view[]
|