blob: dde9c35eb693dfd8344e9e099d0b5c0c8ed961d1 (
plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
|
<!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>
|