mirror of
https://github.com/tiennm99/lombok.git
synced 2026-06-09 16:14:33 +00:00
84 lines
3.4 KiB
HTML
84 lines
3.4 KiB
HTML
<!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>EXPERIMENTAL – @var</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>@var</h1>
|
||
<div class="byline">Modifiable local variables with a type inferred by assigning value.</div>
|
||
<div class="since">
|
||
<h3>Since</h3>
|
||
<p>
|
||
@var was introduced as experimental feature in lombok v1.16.12.
|
||
</p>
|
||
</div>
|
||
<div class="experimental">
|
||
<h3>Experimental</h3>
|
||
<p>
|
||
Experimental because:
|
||
<ul>
|
||
<li>This feature is very controversial.</li>
|
||
<li>There is <a href="http://openjdk.java.net/jeps/286">JEP 286</a> that should make the @var obsolete.</li>
|
||
</ul>Current status: <em>uncertain</em> - Currently we feel this feature cannot move out of experimental status.
|
||
</div>
|
||
<div class="overview">
|
||
<h3>Overview</h3>
|
||
<p>
|
||
The <code>@var</code> has the same mission as the <a href="../val.html">@val</a> annotation but modifable.
|
||
</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.val.flagUsage</code> = [<code>allow</code>] (default: not set)</dt>
|
||
<dd><strong>Lombok will flag any usage of <code>var</code> as an error if not configured.</strong></dd>
|
||
</dl>
|
||
</div>
|
||
<div class="overview">
|
||
<h3>Small print</h3><div class="smallprint">
|
||
<p>
|
||
For compound types, the most common superclass is inferred, not any shared interfaces. For example, <code>bool ? new HashSet() : new ArrayList()</code>
|
||
is an expression with a compound type: The result is both <code>AbstractCollection</code> as well as <code>Serializable</code>. The type inferred will be
|
||
<code>AbstractCollection</code>, as that is a class, whereas <code>Serializable</code> is an interface.
|
||
</p><p>
|
||
In ambiguous cases, <code>java.lang.Object</code> is inferred.
|
||
</p>
|
||
</div>
|
||
</div>
|
||
<div class="footer">
|
||
<a href="index.html">Back to experimental features</a> | <span class="disabled">Previous feature</span> | <a href="Accessors.html">Next feature (@Accessors)</a><br />
|
||
<a href="../../credits.html" class="creditsLink">credits</a> | <span class="copyright">Copyright © 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>
|