diff --git a/java/java-impl/src/com/intellij/codeInspection/ObviousNullCheckInspection.java b/java/java-impl/src/com/intellij/codeInspection/ObviousNullCheckInspection.java
index c2b2c50467c9..8f578901310d 100644
--- a/java/java-impl/src/com/intellij/codeInspection/ObviousNullCheckInspection.java
+++ b/java/java-impl/src/com/intellij/codeInspection/ObviousNullCheckInspection.java
@@ -39,9 +39,9 @@ public class ObviousNullCheckInspection extends AbstractBaseJavaLocalInspectionT
String explanation = getObviouslyNonNullExplanation(nullArg);
if (explanation == null) return;
if(nullCheckParameter.myNull) {
- holder.registerProblem(nullArg, InspectionsBundle.message("inspection.useless.null.check.always.fail.message", explanation));
+ holder.registerProblem(nullArg, InspectionsBundle.message("inspection.redundant.null.check.always.fail.message", explanation));
} else {
- holder.registerProblem(nullArg, InspectionsBundle.message("inspection.useless.null.check.message", explanation),
+ holder.registerProblem(nullArg, InspectionsBundle.message("inspection.redundant.null.check.message", explanation),
new RemoveNullCheckFix());
}
}
@@ -110,7 +110,7 @@ public class ObviousNullCheckInspection extends AbstractBaseJavaLocalInspectionT
@NotNull
@Override
public String getFamilyName() {
- return InspectionsBundle.message("inspection.useless.null.check.fix.family.name");
+ return InspectionsBundle.message("inspection.redundant.null.check.fix.family.name");
}
@Override
diff --git a/java/java-impl/src/com/intellij/codeInspection/RedundantStreamOptionalCallInspection.java b/java/java-impl/src/com/intellij/codeInspection/RedundantStreamOptionalCallInspection.java
index 71006e105a34..dacc78e2b27d 100644
--- a/java/java-impl/src/com/intellij/codeInspection/RedundantStreamOptionalCallInspection.java
+++ b/java/java-impl/src/com/intellij/codeInspection/RedundantStreamOptionalCallInspection.java
@@ -155,8 +155,10 @@ public class RedundantStreamOptionalCallInspection extends AbstractBaseJavaLocal
if ("toSet".equals(furtherCallName) || "toCollection".equals(furtherCallName)) {
additionalFix = new CollectToOrderedSetFix();
}
- register(call, InspectionsBundle.message("inspection.redundant.stream.optional.call.explanation.sorted", furtherCallName),
- additionalFix);
+ String message = "sorted".equals(furtherCallName) ?
+ InspectionsBundle.message("inspection.redundant.stream.optional.call.explanation.sorted.twice") :
+ InspectionsBundle.message("inspection.redundant.stream.optional.call.explanation.sorted", furtherCallName);
+ register(call, message, additionalFix);
}
}
break;
diff --git a/java/java-impl/src/inspectionDescriptions/InvalidComparatorMethodReference.html b/java/java-impl/src/inspectionDescriptions/InvalidComparatorMethodReference.html
index 3a1edb31bccf..8dfe0e1cf438 100644
--- a/java/java-impl/src/inspectionDescriptions/InvalidComparatorMethodReference.html
+++ b/java/java-impl/src/inspectionDescriptions/InvalidComparatorMethodReference.html
@@ -3,7 +3,7 @@
Reports method references mapped to Comparator interface which don't fulfill its contract.
Some method references like Integer::max can be mapped to Comparator interface.
-However using them as Comparator is useless and result might be unpredictable.
+However using them as Comparator is meaningless and result might be unpredictable.
New in 2016.3
diff --git a/java/java-impl/src/inspectionDescriptions/RedundantStreamOptionalCall.html b/java/java-impl/src/inspectionDescriptions/RedundantStreamOptionalCall.html
index b69803728d8c..fee813212113 100644
--- a/java/java-impl/src/inspectionDescriptions/RedundantStreamOptionalCall.html
+++ b/java/java-impl/src/inspectionDescriptions/RedundantStreamOptionalCall.html
@@ -1,11 +1,11 @@
-Reports useless Stream or Optional calls like map(x -> x) or filter(x -> true),
-useless sorted or distinct.
+Reports redundant Stream or Optional calls like map(x -> x) or filter(x -> true),
+redundant sorted or distinct.
Note that a mapping operation in code like streamOfIntegers.map(Integer::valueOf) works as requireNonNull
check:
- if stream contains a null, it will throw NullPointerException, thus it's not absolutely useless. Uncheck the
- "Report useless boxing in Stream.map" checkbox if you don't want such cases to be reported.
+ if stream contains a null, it will throw NullPointerException, thus it's not absolutely redundant. Uncheck the
+ "Report redundant boxing in Stream.map" checkbox if you don't want such cases to be reported.
This inspection only reports if the project or module is configured to use a language level of 8 or higher.
New in 2017.1
diff --git a/java/java-tests/testData/inspection/obviousNotNull/ObviousNullCheck.java b/java/java-tests/testData/inspection/obviousNotNull/ObviousNullCheck.java
index 728a4c7ec1dd..74cbcfb063dd 100644
--- a/java/java-tests/testData/inspection/obviousNotNull/ObviousNullCheck.java
+++ b/java/java-tests/testData/inspection/obviousNotNull/ObviousNullCheck.java
@@ -7,21 +7,21 @@ abstract class ObviousNullCheck {
abstract String getBar();
void test(String param) {
- assertNotNull(5 + 6);
+ assertNotNull(5 + 6);
assertNull("Null!", param);
assertNull(param, "Null!");
Objects.requireNonNull(null);
- Objects.requireNonNull("xyz", "xyz");
- Objects.requireNonNull((getFoo() + getBar()));
- Objects.requireNonNull(new ArrayList(), "new returned null");
- Objects.requireNonNull(this);
+ Objects.requireNonNull("xyz", "xyz");
+ Objects.requireNonNull((getFoo() + getBar()));
+ Objects.requireNonNull(new ArrayList(), "new returned null");
+ Objects.requireNonNull(this);
- String s = Objects.requireNonNull(" x ");
+ String s = Objects.requireNonNull(" x ");
String s1 = trim(" x ");
- System.out.println(inferred("foo"));
+ System.out.println(inferred("foo"));
}
@Contract(value="null -> fail", pure=true)
diff --git a/java/java-tests/testData/inspection/obviousNotNull/afterNonNull.java b/java/java-tests/testData/inspection/obviousNotNull/afterNonNull.java
index 878157ab796d..6a849fdefc89 100644
--- a/java/java-tests/testData/inspection/obviousNotNull/afterNonNull.java
+++ b/java/java-tests/testData/inspection/obviousNotNull/afterNonNull.java
@@ -1,4 +1,4 @@
-// "Remove useless null-check" "true"
+// "Remove redundant null-check" "true"
import java.util.*;
public class Test {
diff --git a/java/java-tests/testData/inspection/obviousNotNull/afterNonNullAssign.java b/java/java-tests/testData/inspection/obviousNotNull/afterNonNullAssign.java
index 99625e308c0d..a1f7fbc8c74a 100644
--- a/java/java-tests/testData/inspection/obviousNotNull/afterNonNullAssign.java
+++ b/java/java-tests/testData/inspection/obviousNotNull/afterNonNullAssign.java
@@ -1,4 +1,4 @@
-// "Remove useless null-check" "true"
+// "Remove redundant null-check" "true"
import java.util.*;
public class Test {
diff --git a/java/java-tests/testData/inspection/obviousNotNull/afterNonNullSideEffect.java b/java/java-tests/testData/inspection/obviousNotNull/afterNonNullSideEffect.java
index 496a8f6fa186..fa7eda0dfd2a 100644
--- a/java/java-tests/testData/inspection/obviousNotNull/afterNonNullSideEffect.java
+++ b/java/java-tests/testData/inspection/obviousNotNull/afterNonNullSideEffect.java
@@ -1,4 +1,4 @@
-// "Remove useless null-check" "true"
+// "Remove redundant null-check" "true"
import java.util.*;
public class Test {
diff --git a/java/java-tests/testData/inspection/obviousNotNull/beforeNonNull.java b/java/java-tests/testData/inspection/obviousNotNull/beforeNonNull.java
index 952a7b0f6f5b..67900e1331e0 100644
--- a/java/java-tests/testData/inspection/obviousNotNull/beforeNonNull.java
+++ b/java/java-tests/testData/inspection/obviousNotNull/beforeNonNull.java
@@ -1,4 +1,4 @@
-// "Remove useless null-check" "true"
+// "Remove redundant null-check" "true"
import java.util.*;
public class Test {
diff --git a/java/java-tests/testData/inspection/obviousNotNull/beforeNonNullAssign.java b/java/java-tests/testData/inspection/obviousNotNull/beforeNonNullAssign.java
index 327ff32656cc..7cdf0d713174 100644
--- a/java/java-tests/testData/inspection/obviousNotNull/beforeNonNullAssign.java
+++ b/java/java-tests/testData/inspection/obviousNotNull/beforeNonNullAssign.java
@@ -1,4 +1,4 @@
-// "Remove useless null-check" "true"
+// "Remove redundant null-check" "true"
import java.util.*;
public class Test {
diff --git a/java/java-tests/testData/inspection/obviousNotNull/beforeNonNullSideEffect.java b/java/java-tests/testData/inspection/obviousNotNull/beforeNonNullSideEffect.java
index e68189f6172c..9c144b1a769e 100644
--- a/java/java-tests/testData/inspection/obviousNotNull/beforeNonNullSideEffect.java
+++ b/java/java-tests/testData/inspection/obviousNotNull/beforeNonNullSideEffect.java
@@ -1,4 +1,4 @@
-// "Remove useless null-check" "true"
+// "Remove redundant null-check" "true"
import java.util.*;
public class Test {
diff --git a/java/java-tests/testData/inspection/redundantStreamOptionalCall/RedundantStreamOptionalCall.java b/java/java-tests/testData/inspection/redundantStreamOptionalCall/RedundantStreamOptionalCall.java
index 4cc799f0a0f3..8e79455deb3d 100644
--- a/java/java-tests/testData/inspection/redundantStreamOptionalCall/RedundantStreamOptionalCall.java
+++ b/java/java-tests/testData/inspection/redundantStreamOptionalCall/RedundantStreamOptionalCall.java
@@ -3,12 +3,12 @@ import java.util.stream.*;
public class RedundantStreamOptionalCall {
public void test() {
- List list = Stream.of(1, 2, 3).sorted(Comparator.reverseOrder())
+ List list = Stream.of(1, 2, 3).sorted(Comparator.reverseOrder())
.filter(x -> x > 0).sorted().collect(Collectors.toList());
- if(Stream.of(1, 2, 3).sorted().filter(x -> x > 0).allMatch(x -> x < 10)) {
+ if(Stream.of(1, 2, 3).sorted().filter(x -> x > 0).allMatch(x -> x < 10)) {
return;
}
- if(Stream.of("foo", "bar", "baz").sorted(String.CASE_INSENSITIVE_ORDER).count() > 0) {
+ if(Stream.of("foo", "bar", "baz").sorted(String.CASE_INSENSITIVE_ORDER).count() > 0) {
return;
}
long first = Stream.of(1, 2, 3).distinct().sorted().skip(1).limit(2).distinct()
@@ -44,15 +44,15 @@ public class RedundantStreamOptionalCall {
Collection collection = Arrays.asList("foo", "foo", "bar");
Set set1 = collection.stream().distinct().collect(Collectors.toSet());
- Set set2 = collection.stream().sorted().collect(Collectors.toSet());
- Set set3 = collection.stream().sorted().distinct().collect(Collectors.toSet());
- Set set4 = collection.stream().distinct().sorted().collect(Collectors.toSet());
+ Set set2 = collection.stream().sorted().collect(Collectors.toSet());
+ Set set3 = collection.stream().sorted().distinct().collect(Collectors.toSet());
+ Set set4 = collection.stream().distinct().sorted().collect(Collectors.toSet());
List list1 = collection.stream().distinct().collect(Collectors.toList());
List list2 = collection.stream().sorted().collect(Collectors.toList());
- Map map1 = collection.stream().sorted().collect(Collectors.toMap(Integer::valueOf, x -> x));
+ Map map1 = collection.stream().sorted().collect(Collectors.toMap(Integer::valueOf, x -> x));
Map map2 = collection.stream().sorted().collect(Collectors.toMap(Integer::valueOf, x -> x, (a,b) ->a, LinkedHashMap::new));
- Set set5 = collection.stream().sorted().collect(Collectors.toCollection(HashSet::new));
- Set set6 = collection.stream().sorted().collect(Collectors.toCollection(() -> new HashSet<>()));
+ Set set5 = collection.stream().sorted().collect(Collectors.toCollection(HashSet::new));
+ Set set6 = collection.stream().sorted().collect(Collectors.toCollection(() -> new HashSet<>()));
Set set6a = collection.stream().sorted().collect(Collectors.toCollection(() -> new LinkedHashSet<>()));
Set set7 = collection.stream().distinct().collect(Collectors.toCollection(HashSet::new));
Set set8 = collection.stream().distinct().collect(Collectors.toCollection(() -> new HashSet<>()));
@@ -64,12 +64,12 @@ public class RedundantStreamOptionalCall {
Stream.of("foo").flatMap(x -> Stream.of(x, x)).parallel();
Stream.of("foo").flatMap(x -> Stream.of(x, x)).parallel().forEach(System.out::println);
- Stream.of("foo", "bar", "baz").sorted().sorted(Comparator.naturalOrder().reversed());
+ Stream.of("foo", "bar", "baz").sorted().sorted(Comparator.naturalOrder().reversed());
Stream.of("foo", "bar", "baz").sorted().sorted(Comparator.comparing(x -> x.charAt(0) == 'b'));
- Stream.of("foo", "bar", "baz").sorted().sorted(Comparator.comparing(x -> x.charAt(0) == 'b')).sorted(Comparator.reverseOrder());
+ Stream.of("foo", "bar", "baz").sorted().sorted(Comparator.comparing(x -> x.charAt(0) == 'b')).sorted(Comparator.reverseOrder());
- Stream.of("foo", "bar", "baz").sorted(String.CASE_INSENSITIVE_ORDER).max(String.CASE_INSENSITIVE_ORDER.reversed());
- Stream.of("foo", "bar", "baz").sorted(String.CASE_INSENSITIVE_ORDER).min(String.CASE_INSENSITIVE_ORDER);
+ Stream.of("foo", "bar", "baz").sorted(String.CASE_INSENSITIVE_ORDER).max(String.CASE_INSENSITIVE_ORDER.reversed());
+ Stream.of("foo", "bar", "baz").sorted(String.CASE_INSENSITIVE_ORDER).min(String.CASE_INSENSITIVE_ORDER);
Stream.of("foo", "bar", "baz").sorted(String.CASE_INSENSITIVE_ORDER).min(Comparator.naturalOrder());
}
}
diff --git a/platform/platform-resources-en/src/messages/InspectionsBundle.properties b/platform/platform-resources-en/src/messages/InspectionsBundle.properties
index 0429fb7cec0f..f6bf9584cb19 100644
--- a/platform/platform-resources-en/src/messages/InspectionsBundle.properties
+++ b/platform/platform-resources-en/src/messages/InspectionsBundle.properties
@@ -828,7 +828,8 @@ inspection.require.non.null.option.min.size=Minimal delta length when inspection
inspection.redundant.stream.optional.call.message=Redundant ''{0}'' call
inspection.redundant.stream.optional.call.explanation.filter=predicate is always true
-inspection.redundant.stream.optional.call.explanation.sorted=subsequent ''{0}'' call makes sorting useless
+inspection.redundant.stream.optional.call.explanation.sorted=subsequent ''{0}'' call doesn''t depend on the sort order
+inspection.redundant.stream.optional.call.explanation.sorted.twice=stream content is sorted again after that
inspection.redundant.stream.optional.call.explanation.distinct=there already was a 'distinct' call in the chain
inspection.redundant.stream.optional.call.explanation.distinct.set=elements will be distinct anyways when collected to the Set
inspection.redundant.stream.optional.call.explanation.unordered=there already was an 'unordered' call in the chain
@@ -838,7 +839,7 @@ inspection.redundant.stream.optional.call.explanation.parallel.single=stream cre
inspection.redundant.stream.optional.call.fix.family.name=Remove redundant chain call
inspection.redundant.stream.optional.call.fix.name=Remove ''{0}'' call
inspection.redundant.stream.optional.call.fix.collect.to.ordered.family.name=Collect to 'LinkedHashSet'
-inspection.redundant.stream.optional.call.option.streamboxing=Report useless boxing in Stream.map
+inspection.redundant.stream.optional.call.option.streamboxing=Report redundant boxing in Stream.map
inspection.map.foreach.message=Can be replaced with 'Map.forEach'
inspection.map.foreach.fix.name=Replace with Map.forEach
@@ -916,9 +917,9 @@ inspection.reflection.member.access.check.exists.exclude.chooser=Class to exclud
inspection.replace.with.trivial.lambda.fix.family.name=Replace with trivial lambda
inspection.replace.with.trivial.lambda.fix.name=Replace with lambda returning ''{0}''
-inspection.useless.null.check.message=Useless null-check: {0} is never null
-inspection.useless.null.check.always.fail.message=Null-check will always fail: {0} is never null
-inspection.useless.null.check.fix.family.name=Remove useless null-check
+inspection.redundant.null.check.message=Redundant null-check: {0} is never null
+inspection.redundant.null.check.always.fail.message=Null-check will always fail: {0} is never null
+inspection.redundant.null.check.fix.family.name=Remove redundant null-check
inspection.comparator.result.comparison.display.name=Suspicious usage of compare method
inspection.comparator.result.comparison.problem.display.name=Comparison of compare method result with specific constant
diff --git a/plugins/InspectionGadgets/src/inspectionDescriptions/BoxingBoxedValue.html b/plugins/InspectionGadgets/src/inspectionDescriptions/BoxingBoxedValue.html
index f2bb65253b42..56fc7dcb6ca0 100644
--- a/plugins/InspectionGadgets/src/inspectionDescriptions/BoxingBoxedValue.html
+++ b/plugins/InspectionGadgets/src/inspectionDescriptions/BoxingBoxedValue.html
@@ -1,6 +1,6 @@
-Reports boxing of already boxed values. This is a useless
+Reports boxing of already boxed values. This is a redundant
operation since any boxed value will first be auto-unboxed before boxing the
value again. If done inside an inner loop such code may cause performance
problems.
diff --git a/plugins/InspectionGadgets/src/inspectionDescriptions/NestedSynchronizedStatement.html b/plugins/InspectionGadgets/src/inspectionDescriptions/NestedSynchronizedStatement.html
index ad6fd49beb01..807cb7fbebb0 100644
--- a/plugins/InspectionGadgets/src/inspectionDescriptions/NestedSynchronizedStatement.html
+++ b/plugins/InspectionGadgets/src/inspectionDescriptions/NestedSynchronizedStatement.html
@@ -1,7 +1,7 @@
Reports nested synchronized statements. Nested synchronized statements
-are either useless (if the lock objects are identical) or prone to deadlock.
+are either redundant (if the lock objects are identical) or prone to deadlock.
diff --git a/plugins/groovy/groovy-psi/resources/inspectionDescriptions/GroovyNestedSynchronizedStatement.html b/plugins/groovy/groovy-psi/resources/inspectionDescriptions/GroovyNestedSynchronizedStatement.html
index 79cad9fdaa36..8e8aa5bd4e27 100644
--- a/plugins/groovy/groovy-psi/resources/inspectionDescriptions/GroovyNestedSynchronizedStatement.html
+++ b/plugins/groovy/groovy-psi/resources/inspectionDescriptions/GroovyNestedSynchronizedStatement.html
@@ -3,7 +3,7 @@
This inspection reports all instances of nested Groovy synchronized statements. Nested synchronized statements
-are either useless (if the lock objects are identical) or prone to deadlock.
+are either redundant (if the lock objects are identical) or prone to deadlock.
Powered by InspectorGroovy