Skip to content

Commit 0f73bcb

Browse files
committed
Refer to "helpful NullPointerException" message for throw-null-literal.ql
1 parent f40fe71 commit 0f73bcb

File tree

1 file changed

+4
-0
lines changed

1 file changed

+4
-0
lines changed

codeql-custom-queries-java/queries/api-misuse/throw-null-literal.ql

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -5,6 +5,10 @@
55
* For clarity it would be better to explicitly create a `NullPointerException`
66
* and possibly provide a meaningful message to its constructor.
77
*
8+
* The "helpful `NullPointerException`" feature ([JEP-358](https://openjdk.org/jeps/358))
9+
* makes it even clearer that `throw null` is not the intended usage:
10+
* > NullPointerException: Cannot throw exception because "null" is null
11+
*
812
* See also Error Prone pattern [ThrowNull](https://errorprone.info/bugpattern/ThrowNull).
913
*
1014
* @kind problem

0 commit comments

Comments
 (0)