aboutsummaryrefslogtreecommitdiff
path: root/website/features/NonNull.html
diff options
context:
space:
mode:
authorReinier Zwitserloot <reinier@zwitserloot.com>2017-05-08 21:28:02 +0200
committerReinier Zwitserloot <reinier@zwitserloot.com>2017-05-29 21:02:54 +0200
commit8b7a7cbc813653a3248d6cf3a7779e220957bc85 (patch)
treeb9acfb9d68c6866acc3cfb9ee59d72ff43f1ebc3 /website/features/NonNull.html
parent72fd50b9f1db1ab6bfc1753ba6a1e686a2f0f22c (diff)
downloadlombok-8b7a7cbc813653a3248d6cf3a7779e220957bc85.tar.gz
lombok-8b7a7cbc813653a3248d6cf3a7779e220957bc85.tar.bz2
lombok-8b7a7cbc813653a3248d6cf3a7779e220957bc85.zip
The great rename: the old ‘website’ is now ‘website-old’, and ‘website2’ is now ‘website’.
Diffstat (limited to 'website/features/NonNull.html')
-rw-r--r--website/features/NonNull.html86
1 files changed, 0 insertions, 86 deletions
diff --git a/website/features/NonNull.html b/website/features/NonNull.html
deleted file mode 100644
index c322309e..00000000
--- a/website/features/NonNull.html
+++ /dev/null
@@ -1,86 +0,0 @@
-<!DOCTYPE html>
-<html><head>
- <meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
- <link rel="stylesheet" type="text/css" href="../logi/reset.css" />
- <link rel="stylesheet" type="text/css" href="features.css" />
- <link rel="shortcut icon" href="../favicon.ico" type="image/x-icon" />
- <meta name="description" content="Spice up your java" />
- <title>@NonNull</title>
-</head><body><div id="pepper">
- <div class="minimumHeight"></div>
- <div class="meat">
- <div class="header"><a href="../index.html">Project Lombok</a></div>
- <h1>@NonNull</h1>
- <div class="byline">or: How I learned to stop worrying and love the NullPointerException.</div>
- <div class="overview">
- <h3>Overview</h3>
- <p>
- <em>NEW in Lombok 0.11.10: </em>You can use <code>@NonNull</code> on the parameter of a method or constructor to have lombok generate a null-check statement for you.<br />
- </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="Data.html"><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.
- </p><p>
- If a null-check is already present at the top, no additional null-check will be generated.
- </p>
- </div>
- <div class="snippets">
- <div class="pre">
- <h3>With Lombok</h3>
- <div class="snippet">@HTML_PRE@</div>
- </div>
- <div class="sep"></div>
- <div class="post">
- <h3>Vanilla Java</h3>
- <div class="snippet">@HTML_POST@</div>
- </div>
- </div>
- <div style="clear: left;"></div>
- <div class="overview confKeys">
- <h3>Supported configuration keys:</h3>
- <dl>
- <dt><code>lombok.nonNull.exceptionType</code> = [<code>NullPointerException</code> | <code>IllegalArgumentException</code>] (default: <code>NullPointerException</code>).
- <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.</dd>
- <dt><code>lombok.nonNull.flagUsage</code> = [<code>warning</code> | <code>error</code>] (default: not set)</dt>
- <dd>Lombok will flag any usage of <code>@NonNull</code> as a warning or error if configured.</dd>
- </dl>
- </div>
- <div class="overview">
- <h3>Small print</h3><div class="smallprint">
- <p>
- Lombok's detection scheme for already existing null-checks consists of scanning for if statements that look just like lombok's own. Any 'throws' statement as
- the 'then' part of the if statement, whether in braces or not, counts. The conditional of the if statement <em>must</em> look exactly like <code>PARAMNAME == null</code>.
- The first statement in your method that is not such a null-check stops the process of inspecting for null-checks.
- </p><p>
- While <code>@Data</code> and other method-generating lombok annotations will trigger on any annotation named <code>@NonNull</code> regardless of casing or package name,
- this feature only triggers on lombok's own <code>@NonNull</code> annotation from the <code>lombok</code> package.
- </p><p>
- A <code>@NonNull</code> on a primitive parameter results in a warning. No null-check will be generated.
- </p><p>
- A <code>@NonNull</code> on a parameter of an abstract method used to generate a warning; starting with version 1.16.8, this is no longer the case, to acknowledge the notion that <code>@NonNull</code> also has a
- documentary role. For the same reason, you can annotate a method as <code>@NonNull</code>; this is allowed, generates no warning, and does not generate any code.
- </p>
- </div>
- </div>
- <div class="footer">
- <a href="index.html">Back to features</a> | <a href="val.html">Previous feature (val)</a> | <a href="Cleanup.html">Next feature (@Cleanup)</a><br />
- <a href="../credits.html" class="creditsLink">credits</a> | <span class="copyright">Copyright &copy; 2009-2016 The Project Lombok Authors, licensed under the <a href="http://www.opensource.org/licenses/mit-license.php">MIT license</a>.</span>
- </div>
- <div style="clear: both;"></div>
- </div>
-</div>
-<script type="text/javascript">
- var gaJsHost = (("https:" == document.location.protocol) ? "https://ssl." : "http://www.");
- document.write(unescape("%3Cscript src='" + gaJsHost + "google-analytics.com/ga.js' type='text/javascript'%3E%3C/script%3E"));
-</script>
-<script type="text/javascript">
- try {
- var pageTracker = _gat._getTracker("UA-9884254-1");
- pageTracker._trackPageview();
- } catch(err) {}
-</script>
-</body></html>