mirror of
https://gitflic.ru/project/openide/openide.git
synced 2026-08-26 15:27:45 +07:00
GitOrigin-RevId: 8b2b63fc6db476ca0c2cfe5cadd84db6c4236d0f
24 lines
758 B
HTML
24 lines
758 B
HTML
<html>
|
|
<body>
|
|
Reports <code>null</code> checks that can be replaced with a call to a static method from <code>Objects</code> or <code>Stream</code>.
|
|
<p><b>Example:</b></p>
|
|
<pre><code>
|
|
if (message == null) {
|
|
application.messageStorage().save(new EmptyMessage());
|
|
} else {
|
|
application.messageStorage().save(message);
|
|
}
|
|
</code></pre>
|
|
<p>After the quick-fix is applied:</p>
|
|
<pre><code>
|
|
application.messageStorage()
|
|
.save(Objects.requireNonNullElseGet(message, () -> new EmptyMessage()));
|
|
</code></pre>
|
|
<!-- tooltip end -->
|
|
<p>
|
|
Use the <b>Don't warn if the replacement is longer than the original</b> option to ignore the cases when the replacement is longer than the
|
|
original code.
|
|
</p>
|
|
<p><small>New in 2017.3</small></p>
|
|
</body>
|
|
</html> |