rspec/rules/S4682/java/rule.adoc

34 lines
663 B
Plaintext

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
----
@CheckForNull
boolean isFoo() {
...
}
----
== Compliant Solution
----
boolean isFoo() {
...
}
----
ifdef::env-github,rspecator-view[]
'''
== Comments And Links
(visible only on this page)
include::comments-and-links.adoc[]
endif::env-github,rspecator-view[]