From 93c83aec85e6f7d2a68445352a2adaf778ee14dc Mon Sep 17 00:00:00 2001 From: Bas Leijdekkers Date: Mon, 14 Oct 2019 15:12:28 +0200 Subject: [PATCH] indicate method calls with '()' in inspection names GitOrigin-RevId: f92b0d4bae7978663cfde0560dea122a1a096724 --- java/java-impl/src/META-INF/JavaPlugin.xml | 6 +++--- .../streamMigration/SimplifyForEachInspection.java | 4 ++-- .../testData/inspection/endlessStream/Collect.java | 6 +++--- .../testData/inspection/endlessStream/Sorted.java | 4 ++-- .../inspection/java8MapForEach/afterForEach.java | 2 +- .../inspection/java8MapForEach/beforeForEach.java | 2 +- .../src/messages/InspectionsBundle.properties | 9 ++++++--- 7 files changed, 18 insertions(+), 15 deletions(-) diff --git a/java/java-impl/src/META-INF/JavaPlugin.xml b/java/java-impl/src/META-INF/JavaPlugin.xml index 7fd6e39094a9..9d0f222ca342 100644 --- a/java/java-impl/src/META-INF/JavaPlugin.xml +++ b/java/java-impl/src/META-INF/JavaPlugin.xml @@ -1388,7 +1388,7 @@ groupBundle="messages.InspectionsBundle" groupKey="group.names.probable.bugs" enabledByDefault="true" level="WARNING" implementationClass="com.intellij.codeInspection.EndlessStreamInspection" - displayName="Non-short-circuit operation consumes the infinite stream"/> + bundle="messages.InspectionsBundle" key="inspection.endless.stream.description"/> + bundle="messages.InspectionsBundle" key="inspection.map.foreach.display.name"/> - collect(Collectors.toList()); - new Random().doubles().boxed().collect(Collectors.toList()); - new Random().longs().boxed().collect(Collectors.toList()); + new Random().ints().boxed().collect(Collectors.toList()); + new Random().doubles().boxed().collect(Collectors.toList()); + new Random().longs().boxed().collect(Collectors.toList()); } } \ No newline at end of file diff --git a/java/java-tests/testData/inspection/endlessStream/Sorted.java b/java/java-tests/testData/inspection/endlessStream/Sorted.java index f1bf6f9ff7d1..fe9758f80240 100644 --- a/java/java-tests/testData/inspection/endlessStream/Sorted.java +++ b/java/java-tests/testData/inspection/endlessStream/Sorted.java @@ -2,7 +2,7 @@ import java.util.stream.LongStream; public class Sorted { public static void main(String[] args) { - long sum1 = LongStream.iterate(0, i -> i + 1).sorted().limit(10).sum(); - long sum2 = LongStream.generate(() -> 10).sorted().limit(10).sum(); + long sum1 = LongStream.iterate(0, i -> i + 1).sorted().limit(10).sum(); + long sum2 = LongStream.generate(() -> 10).sorted().limit(10).sum(); } } \ No newline at end of file diff --git a/java/java-tests/testData/inspection/java8MapForEach/afterForEach.java b/java/java-tests/testData/inspection/java8MapForEach/afterForEach.java index 068434dc413e..e39054a01d4b 100644 --- a/java/java-tests/testData/inspection/java8MapForEach/afterForEach.java +++ b/java/java-tests/testData/inspection/java8MapForEach/afterForEach.java @@ -1,4 +1,4 @@ -// "Fix all 'Map.forEach can be used' problems in file" "true" +// "Fix all 'Map.forEach() can be used' problems in file" "true" import java.util.Map; import java.util.function.Supplier; diff --git a/java/java-tests/testData/inspection/java8MapForEach/beforeForEach.java b/java/java-tests/testData/inspection/java8MapForEach/beforeForEach.java index 651e4dbb9fdd..17a708293235 100644 --- a/java/java-tests/testData/inspection/java8MapForEach/beforeForEach.java +++ b/java/java-tests/testData/inspection/java8MapForEach/beforeForEach.java @@ -1,4 +1,4 @@ -// "Fix all 'Map.forEach can be used' problems in file" "true" +// "Fix all 'Map.forEach() can be used' problems in file" "true" import java.util.Map; import java.util.function.Supplier; diff --git a/platform/platform-resources-en/src/messages/InspectionsBundle.properties b/platform/platform-resources-en/src/messages/InspectionsBundle.properties index 40796fed6c96..2ce778da5d2b 100644 --- a/platform/platform-resources-en/src/messages/InspectionsBundle.properties +++ b/platform/platform-resources-en/src/messages/InspectionsBundle.properties @@ -875,10 +875,13 @@ 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 redundant boxing in Stream.map -inspection.map.foreach.message=Can be replaced with 'Map.forEach' -inspection.map.foreach.fix.name=Replace with Map.forEach +inspection.map.foreach.display.name=Map.forEach() can be used +inspection.map.foreach.message=Can be replaced with 'Map.forEach()' +inspection.map.foreach.fix.name=Replace with 'Map.forEach()' inspection.map.foreach.option.no.loops=Do not report loops +inspection.simplify.foreach.display.name=Simplifiable forEach() call + inspection.collection.factories.message=Can be replaced with ''{0}.{1}'' call inspection.collection.factories.option.ignore.non.constant=Do not warn when content is non-constant inspection.collection.factories.option.suggest.ofentries=Suggest 'Map.ofEntries' @@ -988,7 +991,7 @@ inspection.conditional.break.in.infinite.loop=Move condition to loop inspection.conditional.break.in.infinite.loop.no.conversion.with.do.while=Don't suggest to replace with 'do while' inspection.conditional.break.in.infinite.loop.description=Conditional break inside infinite loop -inspection.endless.stream.description=Non-short-circuit operation consumes the infinite stream +inspection.endless.stream.description=Non-short-circuit operation consumes infinite stream inspection.simplifiable.comparator.display.name=Comparator can be simplified inspection.simplifiable.comparator.comparing.message=Unnecessary ''{0}()'' call