aboutsummaryrefslogtreecommitdiff
path: root/website
diff options
context:
space:
mode:
authorReinier Zwitserloot <reinier@zwitserloot.com>2018-06-04 23:55:13 +0200
committerReinier Zwitserloot <reinier@zwitserloot.com>2018-06-04 23:55:13 +0200
commita0b901c3c04d0377f495a9da853196a3b0433eae (patch)
tree58e3e3ca4b3954e4e5eedd856cfc44d02381fa2b /website
parent198efc1b279060beba836663b802923b8d53b2ec (diff)
downloadlombok-a0b901c3c04d0377f495a9da853196a3b0433eae.tar.gz
lombok-a0b901c3c04d0377f495a9da853196a3b0433eae.tar.bz2
lombok-a0b901c3c04d0377f495a9da853196a3b0433eae.zip
`@NonNull` now uses a slightly longer exception message.
Diffstat (limited to 'website')
-rw-r--r--website/templates/features/NonNull.html4
-rw-r--r--website/usageExamples/NonNullExample_post.jpage2
2 files changed, 3 insertions, 3 deletions
diff --git a/website/templates/features/NonNull.html b/website/templates/features/NonNull.html
index 28d083d0..3d99a3c7 100644
--- a/website/templates/features/NonNull.html
+++ b/website/templates/features/NonNull.html
@@ -11,7 +11,7 @@
</p><p>
Lombok has always treated any annotation 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>. Now, however, using lombok's own <code>@lombok.NonNull</code> on a parameter results in the insertion of just the null-check statement inside your own method or constructor.
</p><p>
- The null-check looks like <code>if (param == null) throw new NullPointerException("param");</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.
+ 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.
</p><p>
If a null-check is already present at the top, no additional null-check will be generated.
</p>
@@ -23,7 +23,7 @@
<dt>
<code>lombok.nonNull.exceptionType</code> = [<code>NullPointerException</code> | <code>IllegalArgumentException</code>] (default: <code>NullPointerException</code>).
</dt><dd>
- When lombok generates a null-check <code>if</code> statement, by default, a <code>java.lang.NullPointerException</code> will be thrown with the field name as the exception message. However, you can use <code>IllegalArgumentException</code> in this configuration key to have lombok throw that exception, with '<em>fieldName</em> is null' as exception message.
+ When lombok generates a null-check <code>if</code> statement, by default, a <code>java.lang.NullPointerException</code> will be thrown with '<em>field name</em> is marked @NonNull but is null' as the exception message. However, you can use <code>IllegalArgumentException</code> in this configuration key to have lombok throw that exception with this message instead.
</dd><dt>
<code>lombok.nonNull.flagUsage</code> = [<code>warning</code> | <code>error</code>] (default: not set)
</dt><dd>
diff --git a/website/usageExamples/NonNullExample_post.jpage b/website/usageExamples/NonNullExample_post.jpage
index 24175e06..bb67b3f6 100644
--- a/website/usageExamples/NonNullExample_post.jpage
+++ b/website/usageExamples/NonNullExample_post.jpage
@@ -6,7 +6,7 @@ public class NonNullExample extends Something {
public NonNullExample(@NonNull Person person) {
super("Hello");
if (person == null) {
- throw new NullPointerException("person");
+ throw new NullPointerException("person is marked @NonNull but is null");
}
this.name = person.getName();
}