mirror of
https://gitflic.ru/project/openide/openide.git
synced 2026-08-27 11:07:43 +07:00
GitOrigin-RevId: 8b2b63fc6db476ca0c2cfe5cadd84db6c4236d0f
26 lines
907 B
HTML
26 lines
907 B
HTML
<html>
|
|
<body>
|
|
Reports anonymous classes which could be transformed to a constructor or a factory method call with a lambda expression argument.
|
|
<p>The following classes are reported by this inspection:
|
|
<ul>
|
|
<li>Anonymous classes extending <code>ThreadLocal</code> which have an <code>initialValue()</code> method (can be replaced with <code>ThreadLocal.withInitial</code>)</li>
|
|
<li>Anonymous classes extending <code>Thread</code> which have a <code>run()</code> method (can be replaced with <code>new Thread(Runnable)</code></li>
|
|
</ul>
|
|
<p>Example:</p>
|
|
<pre><code>
|
|
<b>new</b> Thread() {
|
|
@Override
|
|
<b>public void</b> run() {
|
|
System.out.println("Hello from thread!");
|
|
}
|
|
}.start();
|
|
</code></pre>
|
|
<p>After the quick-fix is applied:</p>
|
|
<pre><code>
|
|
<b>new</b> Thread(() -> {
|
|
System.out.println("Hello from thread!");
|
|
}).start();
|
|
</code></pre>
|
|
<!-- tooltip end -->
|
|
</body>
|
|
</html> |