From 0260b4b4d5c79586f3605bae41e8afffaa740de1 Mon Sep 17 00:00:00 2001 From: Bas Leijdekkers Date: Tue, 19 Jul 2022 11:11:13 +0200 Subject: [PATCH] Improve inspection description example GitOrigin-RevId: f03b4d9082aecc9fe87f1a1e3a9ec8389d57808b --- .../src/inspectionDescriptions/RedundantUnmodifiable.html | 8 ++++++-- 1 file changed, 6 insertions(+), 2 deletions(-) diff --git a/java/java-impl/src/inspectionDescriptions/RedundantUnmodifiable.html b/java/java-impl/src/inspectionDescriptions/RedundantUnmodifiable.html index e75a63f9eb1e..baf3c184fb66 100644 --- a/java/java-impl/src/inspectionDescriptions/RedundantUnmodifiable.html +++ b/java/java-impl/src/inspectionDescriptions/RedundantUnmodifiable.html @@ -1,12 +1,16 @@ -Reports redundant calls to unmodifiable collection wrappers within the +Reports redundant calls to unmodifiable collection wrappers from the Collections class.

If the argument that is passed to an unmodifiable collection wrapper is already immutable, such a wrapping becomes redundant.

Example:


-  Collections.unmodifiableList(Collections.singletonList("abc"));
+  List<String> x = Collections.unmodifiableList(Collections.singletonList("abc"));
+
+

After the quick-fix is applied:

+

+  List<String> x = Collections.singletonList("abc");
 

In order to detect the methods that return unmodifiable collections, the inspection uses the org.jetbrains.annotations.Unmodifiable