2021-04-28 16:49:39 +02:00
While ``++null++`` is technically a valid ``++Boolean++`` value, that fact, and the distinction between ``++Boolean++`` and ``++boolean++`` is easy to forget. So returning ``++null++`` from a ``++Boolean++`` method is likely to cause problems with callers' code.
2021-04-28 18:08:03 +02:00
2021-04-28 16:49:39 +02:00
== Noncompliant Code Example
2022-02-04 17:28:24 +01:00
[source,java]
2021-04-28 16:49:39 +02:00
----
public Boolean isUsable() {
// ...
return null; // Noncompliant
}
----
2021-04-28 18:08:03 +02:00
2021-04-28 16:49:39 +02:00
== See
2022-04-07 08:53:59 -05:00
* https://cwe.mitre.org/data/definitions/476[MITRE, CWE-476] - NULL Pointer Dereference
2021-04-28 16:49:39 +02:00
* https://wiki.sei.cmu.edu/confluence/x/aDdGBQ[CERT, EXP01-J.] - Do not use a null in a case where an object is required
2021-04-28 18:08:03 +02:00
2021-09-20 15:38:42 +02:00
ifdef::env-github,rspecator-view[]
'''
== Implementation Specification
(visible only on this page)
include::message.adoc[]
endif::env-github,rspecator-view[]