From e32a42a8a08087b6f7f2a5a7ef57f7a1f77e5790 Mon Sep 17 00:00:00 2001 From: Ilyas Selimov Date: Thu, 29 Apr 2021 14:21:52 +0700 Subject: [PATCH] java inspections - fix descriptions GitOrigin-RevId: b628c4204c612954bcdd226d78d752525dabf523 --- .../AwaitWithoutCorrespondingSignal.html | 31 +++++-------------- .../HardcodedLineSeparators.html | 6 ++++ .../VariableNotUsedInsideIf.html | 2 +- 3 files changed, 14 insertions(+), 25 deletions(-) diff --git a/plugins/InspectionGadgets/src/inspectionDescriptions/AwaitWithoutCorrespondingSignal.html b/plugins/InspectionGadgets/src/inspectionDescriptions/AwaitWithoutCorrespondingSignal.html index 6e408d9aef82..e7ddb813c301 100644 --- a/plugins/InspectionGadgets/src/inspectionDescriptions/AwaitWithoutCorrespondingSignal.html +++ b/plugins/InspectionGadgets/src/inspectionDescriptions/AwaitWithoutCorrespondingSignal.html @@ -8,35 +8,18 @@ Only calls that target fields of the current class are reported by this inspecti

Example:

   class Queue {
-    // ...
-    private final Lock lock = new ReentrantLock();
-    private final Condition isEmpty = lock.newCondition();
-    private int size = 0;
+    private final Condition isEmpty = ...;
 
     void add(Object elem) {
-      lock.lock();
-      try {
-          // ...
-          size++;
-          // isEmpty.signal();
-          // ...
-      } finally {
-          lock.unlock();
-      }
+      // ...
+      // isEmpty.signal();
+      // ...
     }
 
     void remove(Object elem) throws InterruptedException {
-      lock.lock();
-      try {
-          // ...
-          while (size <= 0) {
-            isEmpty.await(); // 'await()' doesn't contain corresponding 'signal()'/'signalAll()' call
-          }
-          size--;
-          // ...
-      } finally {
-          lock.unlock();
-      }
+      // ...
+      isEmpty.await(); // 'await()' doesn't contain corresponding 'signal()'/'signalAll()' call
+      // ...
     }
   }
 
diff --git a/plugins/InspectionGadgets/src/inspectionDescriptions/HardcodedLineSeparators.html b/plugins/InspectionGadgets/src/inspectionDescriptions/HardcodedLineSeparators.html index 25f7ac75877e..94be41aa7b36 100644 --- a/plugins/InspectionGadgets/src/inspectionDescriptions/HardcodedLineSeparators.html +++ b/plugins/InspectionGadgets/src/inspectionDescriptions/HardcodedLineSeparators.html @@ -2,6 +2,12 @@ Reports the newline (\n) or return (\r) characters in a string or character literal. These characters are commonly used as line separators, and portability may suffer if they are hardcoded. +

Example:

+
+  void test() {
+    String str = "first\nsecond\rthird";
+  }
+

diff --git a/plugins/InspectionGadgets/src/inspectionDescriptions/VariableNotUsedInsideIf.html b/plugins/InspectionGadgets/src/inspectionDescriptions/VariableNotUsedInsideIf.html index 117c84a5f3e3..1ab0e17cda78 100644 --- a/plugins/InspectionGadgets/src/inspectionDescriptions/VariableNotUsedInsideIf.html +++ b/plugins/InspectionGadgets/src/inspectionDescriptions/VariableNotUsedInsideIf.html @@ -1,6 +1,6 @@ -Reports any references to variables that are checked for nullity +Reports any references to variables that are checked for nullability in the condition of an if statement or conditional expression but which are not used inside the if statement. Usually this either means that