diff options
author | Reinier Zwitserloot <reinier@zwitserloot.com> | 2022-01-21 00:58:27 +0100 |
---|---|---|
committer | GitHub <noreply@github.com> | 2022-01-21 00:58:27 +0100 |
commit | 2613f58b531315e36c407013c059a82023c750f2 (patch) | |
tree | 27ede83a4fca30337351a4e3a17126973d688578 /website/templates/features | |
parent | 7eff9d31b047c9155b117dcf0d0430f64b342129 (diff) | |
parent | c387bf3a920975622dd7fc5431f388dd1fd4c952 (diff) | |
download | lombok-2613f58b531315e36c407013c059a82023c750f2.tar.gz lombok-2613f58b531315e36c407013c059a82023c750f2.tar.bz2 lombok-2613f58b531315e36c407013c059a82023c750f2.zip |
Merge pull request #3090 from sparhidev/master
Documentation updated to address #3073
Diffstat (limited to 'website/templates/features')
-rw-r--r-- | website/templates/features/NonNull.html | 2 |
1 files changed, 1 insertions, 1 deletions
diff --git a/website/templates/features/NonNull.html b/website/templates/features/NonNull.html index 57aa62fe..cccc69fa 100644 --- a/website/templates/features/NonNull.html +++ b/website/templates/features/NonNull.html @@ -11,7 +11,7 @@ </p><p> Lombok has always treated various annotations generally named <code>@NonNull</code> on a field as a signal to generate a null-check if lombok generates an entire method or constructor for you, via for example <a href="/features/Data"><code>@Data</code></a>. However, using lombok's own <code>@lombok.NonNull</code> on a parameter or record component results in the insertion of the null-check at the top of that method. </p><p> - The null-check looks like <code>if (param == null) throw new NullPointerException("param is marked @NonNull but is null");</code> and will be inserted at the very top of your method. For constructors, the null-check will be inserted immediately following any explicit <code>this()</code> or <code>super()</code> calls. For record components, the null-check will be inserted in the 'compact constructor' (the one that has no argument list at all), which will be generated if you have no constructor. If you have written out the record constructor in long form (with parameters matching your components exactly), then nothing happens - you'd have to annotate the parameters of this long-form constructor instead. + The null-check looks like <code>if (param == null) throw new NullPointerException("param is marked non-null but is null");</code> and will be inserted at the very top of your method. For constructors, the null-check will be inserted immediately following any explicit <code>this()</code> or <code>super()</code> calls. For record components, the null-check will be inserted in the 'compact constructor' (the one that has no argument list at all), which will be generated if you have no constructor. If you have written out the record constructor in long form (with parameters matching your components exactly), then nothing happens - you'd have to annotate the parameters of this long-form constructor instead. </p><p> If a null-check is already present at the top, no additional null-check will be generated. </p> |