mirror of
https://gitflic.ru/project/openide/openide.git
synced 2026-02-05 16:36:56 +07:00
[java] Update inspection description
GitOrigin-RevId: b74ce5e0a81dec057cc35df07fc1fee411adf0e7
This commit is contained in:
committed by
intellij-monorepo-bot
parent
859ec40299
commit
e321d26a2d
@@ -1,4 +1,4 @@
|
||||
// Copyright 2000-2018 JetBrains s.r.o. Use of this source code is governed by the Apache 2.0 license that can be found in the LICENSE file.
|
||||
// Copyright 2000-2021 JetBrains s.r.o. Use of this source code is governed by the Apache 2.0 license that can be found in the LICENSE file.
|
||||
package com.intellij.codeInsight.daemon.impl.quickfix;
|
||||
|
||||
import com.intellij.codeInsight.BlockUtils;
|
||||
@@ -11,7 +11,7 @@ import com.intellij.psi.*;
|
||||
import com.intellij.psi.impl.PsiImplUtil;
|
||||
import com.intellij.psi.util.PsiTreeUtil;
|
||||
import com.intellij.util.ObjectUtils;
|
||||
import com.siyeh.ig.controlflow.SwitchStatementWithTooFewBranchesInspection.UnwrapSwitchStatementFix;
|
||||
import com.siyeh.ig.controlflow.MinimumSwitchBranchesInspection.UnwrapSwitchStatementFix;
|
||||
import com.siyeh.ig.psiutils.BreakConverter;
|
||||
import com.siyeh.ig.psiutils.CommentTracker;
|
||||
import org.jetbrains.annotations.Nls;
|
||||
|
||||
@@ -1,7 +1,7 @@
|
||||
<html>
|
||||
<body>
|
||||
Reports all fields, methods or classes, found in the specified inspection
|
||||
scope, that may have a <b><font color="#000080">final</font></b> modifier added to their declarations. <br> <br>
|
||||
Reports all fields, methods or classes, found in the specified inspection scope, that may have a <code>final</code> modifier added to their
|
||||
declarations.
|
||||
<!-- tooltip end -->
|
||||
Use check boxes in the inspection options below, to define which declarations are to be reported.
|
||||
</body>
|
||||
|
||||
@@ -1,10 +1,9 @@
|
||||
<html>
|
||||
<body>
|
||||
Reports non-short-circuit operations consuming an infinite stream. Such operations can only be completed by throwing an exception.
|
||||
<!-- tooltip end -->
|
||||
<p>Example:</p>
|
||||
<p><code>
|
||||
<pre>
|
||||
Stream.iterate(0, i -> i + 1).collect(Collectors.toList())
|
||||
</code></p>
|
||||
</pre>
|
||||
</body>
|
||||
</html>
|
||||
@@ -1,7 +1,24 @@
|
||||
<html>
|
||||
<body>
|
||||
Reports enhanced <b>switch</b> statements and expressions which can be replaced with a traditional <b>switch</b> statement.
|
||||
|
||||
Reports enhanced <code>switch</code> statements and expressions, and suggest replacing them with a traditional <code>switch</code>
|
||||
statement.
|
||||
<p>Example:</p>
|
||||
<pre>
|
||||
switch (condition) {
|
||||
case foo -> throw null;
|
||||
default -> b = true;
|
||||
}
|
||||
</pre>
|
||||
<p>After the quick-fix is applied the result looks like:</p>
|
||||
<pre>
|
||||
switch (condition) {
|
||||
case foo:
|
||||
throw null;
|
||||
default ->
|
||||
bar = true;
|
||||
break;
|
||||
}
|
||||
</pre>
|
||||
<!-- tooltip end -->
|
||||
<p><small>New in 2019.1</small></p>
|
||||
</body>
|
||||
|
||||
@@ -1,11 +1,16 @@
|
||||
<html>
|
||||
<body>
|
||||
Reports if trivial lambda expression is used where there's an alternative method which behaves the same way, but
|
||||
accepts a concrete value instead of a lambda.
|
||||
<p>
|
||||
For example, <code>Optional.orElseGet(() -> null)</code> can be replaced with <code>Optional.orElse(null)</code>.
|
||||
</p>
|
||||
Reports if trivial lambda expression is used where there's an alternative method which behaves the same way, but accepts a concrete value
|
||||
instead of a lambda.
|
||||
<p>Example:</p>
|
||||
<pre>
|
||||
Optional.orElseGet(() -> null)
|
||||
</pre>
|
||||
<p>After the quick-fix is applied the result looks like:</p>
|
||||
<pre>
|
||||
Optional.orElse(null)
|
||||
</pre>
|
||||
<!-- tooltip end -->
|
||||
<p><small>New in 2017.1</small></p>
|
||||
<small>New in 2017.1</small>
|
||||
</body>
|
||||
</html>
|
||||
@@ -1,12 +1,14 @@
|
||||
<html>
|
||||
<body>
|
||||
Reports long numeric literals without underscores.
|
||||
<p>
|
||||
Underscores make long numeric literals easier to read.
|
||||
</p>
|
||||
<p>
|
||||
The quick-fix adds underscores to the literal, for example, <code>1000000</code> becomes <code>1_000_000</code>.
|
||||
</p>
|
||||
Reports long numeric literals without underscores, and suggests adding them. Underscores make long numeric literals easier to read.
|
||||
<p>Example:</p>
|
||||
<pre>
|
||||
1000000
|
||||
</pre>
|
||||
<p>After the quick fix is applied the result looks like:</p>
|
||||
<pre>
|
||||
1_000_000
|
||||
</pre>
|
||||
<!-- tooltip end -->
|
||||
<p>This inspection only applies to language level 7 or higher.</p>
|
||||
<p><small>New in 2020.2</small></p>
|
||||
|
||||
@@ -1,6 +1,6 @@
|
||||
<html>
|
||||
<body>
|
||||
Reports common usage patterns of <code>java.util.Map</code> that could be replaced with Java 8 methods:
|
||||
Reports common usage patterns of <code>java.util.Map</code>, and suggests replacing them with:
|
||||
<code>getOrDefault()</code>, <code>computeIfAbsent()</code>, <code>putIfAbsent()</code>, <code>merge()</code>, or <code>replaceAll()</code>.
|
||||
<p>Examples:</p>
|
||||
<ul>
|
||||
@@ -34,19 +34,18 @@ Reports common usage patterns of <code>java.util.Map</code> that could be replac
|
||||
}
|
||||
</pre>
|
||||
</li>
|
||||
|
||||
</ul>
|
||||
<p>Note that the replacement with <code>computeIfAbsent()</code> or <code>merge()</code> might work incorrectly for some <code>Map</code>
|
||||
implementations if the code extracted to the lambda expression modifies the same <code>Map</code>. By default,
|
||||
the warning doesn’t appear if this code might have side effects. If necessary, enable the last checkbox to always show the warning.</p>
|
||||
<p>Also, due to different handling of the <code>null</code> value in old methods like <code>put()</code> and newer methods like
|
||||
<code>computeIfAbsent()</code> or <code>merge()</code>, semantics might change if storing the <code>null</code> value into given
|
||||
<code>Map</code> is important. The inspection won't suggest the replacement when the value is statically known to be nullable,
|
||||
but for values with unknown nullability the replacement is still suggested. In these cases, we recommended suppressing the warning
|
||||
and adding an explanatory comment.
|
||||
implementations if the code extracted to the lambda expression modifies the same <code>Map</code>. By default,
|
||||
the warning doesn’t appear if this code might have side effects. If necessary, enable the last checkbox to always show the warning.</p>
|
||||
<p>Also, due to different handling of the <code>null</code> value in old methods like <code>put()</code> and newer methods like
|
||||
<code>computeIfAbsent()</code> or <code>merge()</code>, semantics might change if storing the <code>null</code> value into given
|
||||
<code>Map</code> is important. The inspection won't suggest the replacement when the value is statically known to be nullable,
|
||||
but for values with unknown nullability the replacement is still suggested. In these cases, we recommended suppressing the warning
|
||||
and adding an explanatory comment.
|
||||
</p>
|
||||
<!-- tooltip end -->
|
||||
<p>This inspection works only if the language level of the project or module is 8 or higher</p>
|
||||
<p><small>New in 2016.3</small></p>
|
||||
<p>This inspection works only if the language level of the project or module is 8 or higher.</p>
|
||||
<small>New in 2016.3</small>
|
||||
</body>
|
||||
</html>
|
||||
@@ -1,8 +1,8 @@
|
||||
<html>
|
||||
<body>
|
||||
The inspection detects situations when a service is loaded with <code>java.util.ServiceLoader</code>
|
||||
but it isn't declared with <code>uses</code> clause in the <code>module-info.java</code> file.
|
||||
<p>
|
||||
<small>New in 2018.1</small>
|
||||
The inspection detects situations when a service is loaded with <code>java.util.ServiceLoader</code> but it isn't declared with the
|
||||
<code>uses</code> clause in the <code>module-info.java</code> file.
|
||||
<!-- tooltip end -->
|
||||
<small>New in 2018.1</small>
|
||||
</body>
|
||||
</html>
|
||||
@@ -1,9 +1,17 @@
|
||||
<html>
|
||||
<body>
|
||||
Reports conditions like <code>if(Optional.isPresent())</code> which could be rewritten in functional style.
|
||||
Reports conditions like <code>if(Optional.isPresent())</code> which could be rewritten in functional style. Functional style is shorter and
|
||||
easier to read.
|
||||
<p>Example:</p>
|
||||
<pre>
|
||||
if (str.isPresent()) str.get().trim();
|
||||
</pre>
|
||||
<p>After the quick fix is applied the result looks like:</p>
|
||||
<pre>
|
||||
str.ifPresent(String::trim);
|
||||
</pre>
|
||||
<!-- tooltip end -->
|
||||
<p>
|
||||
<p>This inspection only reports if the language level of the project or module is 8 or higher</p>
|
||||
<p>This inspection only reports if the language level of the project or module is 8 or higher.</p>
|
||||
<small>New in 2016.3</small>
|
||||
</body>
|
||||
</html>
|
||||
@@ -1,7 +1,20 @@
|
||||
<html>
|
||||
<body>
|
||||
Inspection reports unnecessary close of resource in the end of try-with-resources block
|
||||
Inspection reports unnecessary close of resource in the end of try-with-resources block, and suggests removing it.
|
||||
<p>Example:</p>
|
||||
<pre>
|
||||
try(MyAutoCloseable ac = new MyAutoCloseable()) {
|
||||
foo();
|
||||
ac.close();
|
||||
}
|
||||
</pre>
|
||||
<p>After the quick-fix is applied the result looks like:</p>
|
||||
<pre>
|
||||
try(MyAutoCloseable ac = new MyAutoCloseable()) {
|
||||
foo();
|
||||
}
|
||||
</pre>
|
||||
<!-- tooltip end -->
|
||||
<p><small>New in 2018.1</small></p>
|
||||
<small>New in 2018.1</small>
|
||||
</body>
|
||||
</html>
|
||||
@@ -1,9 +1,17 @@
|
||||
<html>
|
||||
<body>
|
||||
Reports collectors which could be simplified. In particular some cascaded <code>groupingBy</code> collectors
|
||||
could be expressed with simpler <code>toMap</code> collector which also will likely be more performant.
|
||||
Reports collectors, and suggests simplifying them. In particular some cascaded <code>groupingBy</code> collectors could be expressed with
|
||||
simpler <code>toMap</code> collector which also will likely be more performant.
|
||||
<p>Example:</p>
|
||||
<pre>
|
||||
Collectors.groupingByConcurrent(String::length, Collectors.collectingAndThen(Collectors.maxBy(String::compareTo), Optional::get));
|
||||
</pre>
|
||||
<p>After the quick-fix is applied the result looks like:</p>
|
||||
<pre>
|
||||
Collectors.toConcurrentMap(String::length, Function.identity(), BinaryOperator.maxBy(String::compareTo));
|
||||
</pre>
|
||||
<!-- tooltip end -->
|
||||
<p>This inspection only reports if the language level of the project or module is 8 or higher </p>
|
||||
<p>This inspection only reports if the language level of the project or module is 8 or higher.</p>
|
||||
<p><small>New in 2017.1</small></p>
|
||||
</body>
|
||||
</html>
|
||||
@@ -1,7 +1,13 @@
|
||||
<html>
|
||||
<body>
|
||||
Reports when a non-generic-array manipulation method like <code>Arrays.fill()</code> is called with mismatched argument types.
|
||||
Such a call will not do anything useful and is likely a mistake.
|
||||
Reports when a non-generic-array manipulation method like <code>Arrays.fill()</code> is called with mismatched argument types. Such a call
|
||||
will not do anything useful and is likely a mistake.
|
||||
<p>Example:</p>
|
||||
<pre>
|
||||
int foo(String[] strings) {
|
||||
return Arrays.binarySearch(strings, 1);
|
||||
}
|
||||
</pre>
|
||||
<!-- tooltip end -->
|
||||
<p><small>New in 2017.2</small></p>
|
||||
</body>
|
||||
|
||||
Reference in New Issue
Block a user