mirror of
https://gitflic.ru/project/openide/openide.git
synced 2026-09-06 21:55:38 +07:00
suggested by bvh in IJ-CR-192061 (cherry picked from commit ab89de66f82fca75b4f607ee1532a1538c00b1c0) IJ-CR-192061 GitOrigin-RevId: 623cd03c11a02b7ea8a1e845450ccf6d2acbe729
19 lines
675 B
HTML
19 lines
675 B
HTML
<html>
|
|
<body>
|
|
Reports fields of type <code>java.lang.LazyConstant</code> that are not <code>final</code>.
|
|
<p>
|
|
Per <a href="https://openjdk.org/jeps/526">JEP 526: Lazy Constants</a>, lazy constants must be stored in a <code>final</code> field to enable constant-folding optimizations by the JVM.
|
|
</p>
|
|
<p>Correct usage:</p>
|
|
<pre><code>
|
|
private final LazyConstant<Logger> logger = LazyConstant.of(() -> Logger.create(OrderController.class));
|
|
</code></pre>
|
|
<p>Incorrect usage (will be reported):</p>
|
|
<pre><code>
|
|
private LazyConstant<String> x = LazyConstant.of(() -> "expensive string");
|
|
</code></pre>
|
|
|
|
<p><small>New in 2026.1</small></p>
|
|
</body>
|
|
</html>
|