From c29ebc0dacccc665d9fab027825c8b31e88aaad0 Mon Sep 17 00:00:00 2001 From: Kurt Alfred Kluever Date: Tue, 26 May 2026 10:59:11 -0700 Subject: [PATCH] More javadoc cleanup to ErrorProne checks. PiperOrigin-RevId: 921566157 --- .../google/errorprone/bugpatterns/Finally.java | 10 +++++++--- .../bugpatterns/NonOverridingEquals.java | 15 ++++++++++----- .../android/WakelockReleasedDangerously.java | 3 +-- .../CreatesDuplicateCallHeuristic.java | 10 +++++++--- 4 files changed, 25 insertions(+), 13 deletions(-) diff --git a/core/src/main/java/com/google/errorprone/bugpatterns/Finally.java b/core/src/main/java/com/google/errorprone/bugpatterns/Finally.java index 406cb54b2ad..3d2383eee3d 100644 --- a/core/src/main/java/com/google/errorprone/bugpatterns/Finally.java +++ b/core/src/main/java/com/google/errorprone/bugpatterns/Finally.java @@ -171,9 +171,13 @@ private enum JumpType { } /** - * The target of a jump statement (break or continue) is (1) the enclosing loop if the jump is - * unlabeled (2) the enclosing LabeledStatementTree with matching label if the jump is labeled - * (3) the enclosing switch statement if the jump is a break + * The target of a jump statement (break or continue) is: + * + *
    + *
  1. the enclosing loop if the jump is unlabeled; + *
  2. the enclosing LabeledStatementTree with matching label if the jump is labeled; + *
  3. the enclosing switch statement if the jump is a break. + *
* *

If the target of a break or continue statement is encountered before reaching a finally * block, return NO_MATCH. diff --git a/core/src/main/java/com/google/errorprone/bugpatterns/NonOverridingEquals.java b/core/src/main/java/com/google/errorprone/bugpatterns/NonOverridingEquals.java index e91f6546d0b..d02b84f7ed7 100644 --- a/core/src/main/java/com/google/errorprone/bugpatterns/NonOverridingEquals.java +++ b/core/src/main/java/com/google/errorprone/bugpatterns/NonOverridingEquals.java @@ -63,8 +63,13 @@ public class NonOverridingEquals extends BugChecker implements MethodTreeMatcher private static final String MESSAGE_BASE = "equals method doesn't override Object.equals"; /** - * Matches any method definition that: 1) is named `equals` 2) takes a single argument of a type - * other than Object 3) returns a boolean or Boolean + * Matches any method definition that: + * + *

    + *
  1. is named {@code equals}; + *
  2. takes a single argument of a type other than {@code Object}; + *
  3. returns a {@code boolean} or {@code Boolean}. + *
*/ private static final Matcher MATCHER = allOf( @@ -88,9 +93,9 @@ public class NonOverridingEquals extends BugChecker implements MethodTreeMatcher * doesn't work: * * */ private static final Matcher noFixMatcher = diff --git a/core/src/main/java/com/google/errorprone/bugpatterns/android/WakelockReleasedDangerously.java b/core/src/main/java/com/google/errorprone/bugpatterns/android/WakelockReleasedDangerously.java index a292af49e8e..1e7ec808329 100644 --- a/core/src/main/java/com/google/errorprone/bugpatterns/android/WakelockReleasedDangerously.java +++ b/core/src/main/java/com/google/errorprone/bugpatterns/android/WakelockReleasedDangerously.java @@ -165,8 +165,7 @@ private boolean tryCatchesException(TryTree tryTree, Type exceptionToCatch, Visi /** * Whether the given WakeLock may throw an unexpected RuntimeException when released. * - *

Returns true if: 1) the given WakeLock was acquired with timeout, and 2) the given WakeLock - * is reference counted. + *

Returns true if the given WakeLock was acquired with timeout and it is reference counted. */ private boolean wakelockMayThrow(Symbol wakelockSymbol, VisitorState state) { ClassTree enclosingClass = getTopLevelClass(state); diff --git a/core/src/main/java/com/google/errorprone/bugpatterns/argumentselectiondefects/CreatesDuplicateCallHeuristic.java b/core/src/main/java/com/google/errorprone/bugpatterns/argumentselectiondefects/CreatesDuplicateCallHeuristic.java index 39910447f21..93040b69063 100644 --- a/core/src/main/java/com/google/errorprone/bugpatterns/argumentselectiondefects/CreatesDuplicateCallHeuristic.java +++ b/core/src/main/java/com/google/errorprone/bugpatterns/argumentselectiondefects/CreatesDuplicateCallHeuristic.java @@ -64,9 +64,13 @@ private static boolean anyArgumentsMatch( * Find all the other calls to {@code calledMethod} within the method (or class) which enclosed * the original call. * - *

We are interested in two different cases: 1) where there are other calls to the method we - * are calling; 2) declarations of the method we are calling (this catches the case when there is - * a recursive call with the arguments correctly swapped). + *

We are interested in two different cases: + * + *

    + *
  1. where there are other calls to the method we are calling + *
  2. declarations of the method we are calling (this catches the case when there is a + * recursive call with the arguments correctly swapped). + *
* * @param calledMethod is the method call we are analysing for swaps * @param currentNode is the tree node the method call occurred at