From f82fb662b03cd5d29c2e296bf41ac4d6bec2ff87 Mon Sep 17 00:00:00 2001 From: algonell Date: Tue, 24 Sep 2024 07:54:01 -0700 Subject: [PATCH] Fix typos Fix typos in documentation, comments, etc. Fixes #4568 COPYBARA_INTEGRATE_REVIEW=https://github.com/google/error-prone/pull/4568 from algonell:master 086e9a64d0279906354cf80b74717b4bb0e6fcc2 PiperOrigin-RevId: 678249177 --- .../java/com/google/errorprone/bugpatterns/BugChecker.java | 2 +- .../dataflow/nullnesspropagation/NullnessAnnotations.java | 2 +- .../nullnesspropagation/NullnessPropagationTransfer.java | 4 ++-- .../google/errorprone/bugpatterns/DoNotCallSuggester.java | 2 +- .../bugpatterns/argumentselectiondefects/Costs.java | 2 +- .../bugpatterns/formatstring/FormatStringValidation.java | 4 ++-- .../com/google/errorprone/bugpatterns/time/DateChecker.java | 2 +- .../bugpatterns/time/JavaLocalDateTimeGetNano.java | 2 +- .../OverridesGuiceInjectableMethodNegativeCases.java | 2 +- .../testdata/MissingRuntimeRetentionNegativeCases.java | 6 +++--- .../testdata/MissingRuntimeRetentionPositiveCases.java | 6 +++--- .../errorprone/bugpatterns/nullness/UnsafeWildcardTest.java | 2 +- .../bugpatterns/testdata/FinallyNegativeCase2.java | 2 +- .../testdata/JUnitParameterMethodNotFoundNegativeCase.java | 2 +- .../UnnecessaryLongToIntConversionNegativeCases.java | 2 +- .../UnnecessaryLongToIntConversionPositiveCases.java | 2 +- docs/bugpattern/OptionalNotPresent.md | 4 ++-- 17 files changed, 24 insertions(+), 24 deletions(-) diff --git a/check_api/src/main/java/com/google/errorprone/bugpatterns/BugChecker.java b/check_api/src/main/java/com/google/errorprone/bugpatterns/BugChecker.java index b853bc629b5..b553381082e 100644 --- a/check_api/src/main/java/com/google/errorprone/bugpatterns/BugChecker.java +++ b/check_api/src/main/java/com/google/errorprone/bugpatterns/BugChecker.java @@ -285,7 +285,7 @@ private boolean isSuppressed(SuppressWarnings suppression) { public boolean isSuppressed(Tree tree, VisitorState state) { Symbol sym = getDeclaredSymbol(tree); /* - * TOOD(cpovirk): At least for @SuppressWarnings, should our suppression checks look for + * TODO(cpovirk): At least for @SuppressWarnings, should our suppression checks look for * annotations only on the kinds of trees that are covered by SuppressibleTreePathScanner? Or, * now that @SuppressWarnings has been changed to be applicable to all declaration locations, * should we generalize SuppressibleTreePathScanner to look on all those locations? diff --git a/check_api/src/main/java/com/google/errorprone/dataflow/nullnesspropagation/NullnessAnnotations.java b/check_api/src/main/java/com/google/errorprone/dataflow/nullnesspropagation/NullnessAnnotations.java index da65af53475..0abee170320 100644 --- a/check_api/src/main/java/com/google/errorprone/dataflow/nullnesspropagation/NullnessAnnotations.java +++ b/check_api/src/main/java/com/google/errorprone/dataflow/nullnesspropagation/NullnessAnnotations.java @@ -156,7 +156,7 @@ public static Optional fromAnnotationsOn(@Nullable TypeMirror type) { // Note this may be a good candidate for caching public static Optional fromDefaultAnnotations(@Nullable Element sym) { while (sym != null) { - // Just look through declaration annotations here for simplicitly; default annotations aren't + // Just look through declaration annotations here for simplicity; default annotations aren't // type annotations. For now we're just using a hard-coded simple name. // TODO(b/121272440): Look for existing default annotations if (sym.getAnnotationMirrors().stream() diff --git a/check_api/src/main/java/com/google/errorprone/dataflow/nullnesspropagation/NullnessPropagationTransfer.java b/check_api/src/main/java/com/google/errorprone/dataflow/nullnesspropagation/NullnessPropagationTransfer.java index 17b03006fab..af9a791f342 100644 --- a/check_api/src/main/java/com/google/errorprone/dataflow/nullnesspropagation/NullnessPropagationTransfer.java +++ b/check_api/src/main/java/com/google/errorprone/dataflow/nullnesspropagation/NullnessPropagationTransfer.java @@ -1170,14 +1170,14 @@ public boolean hasNonNullConstantValue() { .build(); /** - * Maps from non-null test methods to indices of arguments that are comapred against null. These + * Maps from non-null test methods to indices of arguments that are compared against null. These * methods must guarantee non-nullness if {@code true} and nullness if {@code false}. */ private static final ImmutableSetMultimap NONNULL_IFF_TRUE_PARAMETERS = ImmutableSetMultimap.of(member(Objects.class, "nonNull"), 0); /** - * Maps from null test methods to indices of arguments that are comapred against null. These + * Maps from null test methods to indices of arguments that are compared against null. These * methods must guarantee nullness if {@code true} and non-nullness if {@code false}. */ private static final ImmutableSetMultimap NULL_IFF_TRUE_PARAMETERS = diff --git a/core/src/main/java/com/google/errorprone/bugpatterns/DoNotCallSuggester.java b/core/src/main/java/com/google/errorprone/bugpatterns/DoNotCallSuggester.java index 77593ab1615..dafeb995028 100644 --- a/core/src/main/java/com/google/errorprone/bugpatterns/DoNotCallSuggester.java +++ b/core/src/main/java/com/google/errorprone/bugpatterns/DoNotCallSuggester.java @@ -138,7 +138,7 @@ public Description matchMethod(MethodTree tree, VisitorState state) { } } - // if a method name contais a banned substring, exit + // if a method name contains a banned substring, exit for (String methodSubstring : METHOD_SUBSTRINGS_TO_IGNORE) { if (methodName.contains(methodSubstring)) { return NO_MATCH; diff --git a/core/src/main/java/com/google/errorprone/bugpatterns/argumentselectiondefects/Costs.java b/core/src/main/java/com/google/errorprone/bugpatterns/argumentselectiondefects/Costs.java index 23c1d533852..1ecfc39204d 100644 --- a/core/src/main/java/com/google/errorprone/bugpatterns/argumentselectiondefects/Costs.java +++ b/core/src/main/java/com/google/errorprone/bugpatterns/argumentselectiondefects/Costs.java @@ -35,7 +35,7 @@ class Costs { /** Formal parameters for the method being called. */ private final ImmutableList formals; - /** Actual parameters (argments) for the method call. */ + /** Actual parameters (arguments) for the method call. */ private final ImmutableList actuals; /** diff --git a/core/src/main/java/com/google/errorprone/bugpatterns/formatstring/FormatStringValidation.java b/core/src/main/java/com/google/errorprone/bugpatterns/formatstring/FormatStringValidation.java index b4c855f70ab..73ba43250d0 100644 --- a/core/src/main/java/com/google/errorprone/bugpatterns/formatstring/FormatStringValidation.java +++ b/core/src/main/java/com/google/errorprone/bugpatterns/formatstring/FormatStringValidation.java @@ -145,8 +145,8 @@ protected Void defaultAction(Tree tree, Void unused) { /** * Return an instance of the given type if it receives special handling by {@code String.format}. - * For example, an intance of {@link Integer} will be returned for an input of type {@code int} or - * {@link Integer}. + * For example, an instance of {@link Integer} will be returned for an input of type {@code int} + * or {@link Integer}. */ private static @Nullable Object getInstance(Tree tree, VisitorState state) { Object value = ASTHelpers.constValue(tree); diff --git a/core/src/main/java/com/google/errorprone/bugpatterns/time/DateChecker.java b/core/src/main/java/com/google/errorprone/bugpatterns/time/DateChecker.java index 3a8d52be84d..95ab482a298 100644 --- a/core/src/main/java/com/google/errorprone/bugpatterns/time/DateChecker.java +++ b/core/src/main/java/com/google/errorprone/bugpatterns/time/DateChecker.java @@ -41,7 +41,7 @@ import java.util.List; /** - * Warns against suspect looking calls to {@link java.util.Date} APIs. Noteably, {@code Date} uses: + * Warns against suspect looking calls to {@link java.util.Date} APIs. Notably, {@code Date} uses: * *
    *
  • 1900-based years (negative values permitted) diff --git a/core/src/main/java/com/google/errorprone/bugpatterns/time/JavaLocalDateTimeGetNano.java b/core/src/main/java/com/google/errorprone/bugpatterns/time/JavaLocalDateTimeGetNano.java index 18067a8b57f..8144aae4c0a 100644 --- a/core/src/main/java/com/google/errorprone/bugpatterns/time/JavaLocalDateTimeGetNano.java +++ b/core/src/main/java/com/google/errorprone/bugpatterns/time/JavaLocalDateTimeGetNano.java @@ -38,7 +38,7 @@ */ @BugPattern( summary = - "localDateTime.getNano() only accesss the nanos-of-second field." + "localDateTime.getNano() only access the nanos-of-second field." + " It's rare to only use getNano() without a nearby getSecond() call.", severity = WARNING) public final class JavaLocalDateTimeGetNano extends BugChecker diff --git a/core/src/test/java/com/google/errorprone/bugpatterns/inject/guice/testdata/OverridesGuiceInjectableMethodNegativeCases.java b/core/src/test/java/com/google/errorprone/bugpatterns/inject/guice/testdata/OverridesGuiceInjectableMethodNegativeCases.java index bdd8509bed1..7a90bef6767 100644 --- a/core/src/test/java/com/google/errorprone/bugpatterns/inject/guice/testdata/OverridesGuiceInjectableMethodNegativeCases.java +++ b/core/src/test/java/com/google/errorprone/bugpatterns/inject/guice/testdata/OverridesGuiceInjectableMethodNegativeCases.java @@ -44,7 +44,7 @@ public void foo() {} /** * Class with a method foo() annotated with @com.google.inject.Inject that overrides a method - * annoted with @javax.inject.Inject. + * annotated with @javax.inject.Inject. */ public class TestClass4 extends TestClass2 { @com.google.inject.Inject diff --git a/core/src/test/java/com/google/errorprone/bugpatterns/inject/testdata/MissingRuntimeRetentionNegativeCases.java b/core/src/test/java/com/google/errorprone/bugpatterns/inject/testdata/MissingRuntimeRetentionNegativeCases.java index 1bd1409d3cf..2b2bfa25012 100644 --- a/core/src/test/java/com/google/errorprone/bugpatterns/inject/testdata/MissingRuntimeRetentionNegativeCases.java +++ b/core/src/test/java/com/google/errorprone/bugpatterns/inject/testdata/MissingRuntimeRetentionNegativeCases.java @@ -44,19 +44,19 @@ public class MissingRuntimeRetentionNegativeCases { @Retention(RUNTIME) public @interface TestAnnotation2 {} - /** A qualifer(@Qualifier) annotation with runtime retention. */ + /** A qualifier (@Qualifier) annotation with runtime retention. */ @Qualifier @Target({TYPE, METHOD}) @Retention(RUNTIME) public @interface TestAnnotation3 {} - /** A qualifer(@BindingAnnotation) annotation with runtime retention. */ + /** A qualifier (@BindingAnnotation) annotation with runtime retention. */ @BindingAnnotation @Target({TYPE, METHOD}) @Retention(RUNTIME) public @interface TestAnnotation4 {} - /** A non-qualifer, non-scoping annotation without runtime retention. */ + /** A non-qualifier, non-scoping annotation without runtime retention. */ @Retention(SOURCE) public @interface TestAnnotation5 {} diff --git a/core/src/test/java/com/google/errorprone/bugpatterns/inject/testdata/MissingRuntimeRetentionPositiveCases.java b/core/src/test/java/com/google/errorprone/bugpatterns/inject/testdata/MissingRuntimeRetentionPositiveCases.java index 574b4d6fbd8..c3301797b1a 100644 --- a/core/src/test/java/com/google/errorprone/bugpatterns/inject/testdata/MissingRuntimeRetentionPositiveCases.java +++ b/core/src/test/java/com/google/errorprone/bugpatterns/inject/testdata/MissingRuntimeRetentionPositiveCases.java @@ -45,21 +45,21 @@ public class MissingRuntimeRetentionPositiveCases { @Retention(SOURCE) public @interface TestAnnotation2 {} - /** A qualifer(@Qualifier) annotation with SOURCE retention. */ + /** A qualifier (@Qualifier) annotation with SOURCE retention. */ @Qualifier @Target({TYPE, METHOD}) // BUG: Diagnostic contains: @Retention(RUNTIME) @Retention(SOURCE) public @interface TestAnnotation3 {} - /** A qualifer(@BindingAnnotation) annotation with SOURCE retention. */ + /** A qualifier (@BindingAnnotation) annotation with SOURCE retention. */ @BindingAnnotation @Target({TYPE, METHOD}) // BUG: Diagnostic contains: @Retention(RUNTIME) @Retention(SOURCE) public @interface TestAnnotation4 {} - /** A qualifer annotation with default retention. */ + /** A qualifier annotation with default retention. */ @BindingAnnotation @Target({TYPE, METHOD}) // BUG: Diagnostic contains: @Retention(RUNTIME) diff --git a/core/src/test/java/com/google/errorprone/bugpatterns/nullness/UnsafeWildcardTest.java b/core/src/test/java/com/google/errorprone/bugpatterns/nullness/UnsafeWildcardTest.java index a7867903389..1b873316da4 100644 --- a/core/src/test/java/com/google/errorprone/bugpatterns/nullness/UnsafeWildcardTest.java +++ b/core/src/test/java/com/google/errorprone/bugpatterns/nullness/UnsafeWildcardTest.java @@ -436,7 +436,7 @@ public void arrays() { } /** - * Regresion test demonstrating that generic array creation is a compiler error. If it wasn't, + * Regression test demonstrating that generic array creation is a compiler error. If it wasn't, * we'd want to check element types. */ @Test diff --git a/core/src/test/java/com/google/errorprone/bugpatterns/testdata/FinallyNegativeCase2.java b/core/src/test/java/com/google/errorprone/bugpatterns/testdata/FinallyNegativeCase2.java index 268da4a2a7d..af26b1d22d6 100644 --- a/core/src/test/java/com/google/errorprone/bugpatterns/testdata/FinallyNegativeCase2.java +++ b/core/src/test/java/com/google/errorprone/bugpatterns/testdata/FinallyNegativeCase2.java @@ -67,7 +67,7 @@ public void nestedTryInFinally2() throws Exception { // but we don't do exception analysis and have no way of knowing that. // Xlint:finally doesn't handle this either, since it only reports // situations where the end of a finally block is unreachable as - // definied by JLS 14.21. + // defined by JLS 14.21. throw new IOException(); } catch (Exception e) { } diff --git a/core/src/test/java/com/google/errorprone/bugpatterns/testdata/JUnitParameterMethodNotFoundNegativeCase.java b/core/src/test/java/com/google/errorprone/bugpatterns/testdata/JUnitParameterMethodNotFoundNegativeCase.java index 79edf502173..620ad5b555b 100644 --- a/core/src/test/java/com/google/errorprone/bugpatterns/testdata/JUnitParameterMethodNotFoundNegativeCase.java +++ b/core/src/test/java/com/google/errorprone/bugpatterns/testdata/JUnitParameterMethodNotFoundNegativeCase.java @@ -109,7 +109,7 @@ private List> parametersForParamsInIterableOfIterables() { @Test @Parameters( - "please\\, escape commas if you use it here and don't want your parameters to be splitted") + "please\\, escape commas if you use it here and don't want your parameters to be split") public void commasInParametersUsage(String phrase) {} @Test diff --git a/core/src/test/java/com/google/errorprone/bugpatterns/testdata/UnnecessaryLongToIntConversionNegativeCases.java b/core/src/test/java/com/google/errorprone/bugpatterns/testdata/UnnecessaryLongToIntConversionNegativeCases.java index 3b94ceb71a9..b0b5cdfcfab 100644 --- a/core/src/test/java/com/google/errorprone/bugpatterns/testdata/UnnecessaryLongToIntConversionNegativeCases.java +++ b/core/src/test/java/com/google/errorprone/bugpatterns/testdata/UnnecessaryLongToIntConversionNegativeCases.java @@ -101,7 +101,7 @@ public void checkedCastForIntParameter() { public void checkedCastMultipleArgs() { long x = 1; - // The method expects an int for the first parameter and a long for the second paremeter. + // The method expects an int for the first parameter and a long for the second parameter. acceptsMultipleParams(Ints.checkedCast(x), x); } diff --git a/core/src/test/java/com/google/errorprone/bugpatterns/testdata/UnnecessaryLongToIntConversionPositiveCases.java b/core/src/test/java/com/google/errorprone/bugpatterns/testdata/UnnecessaryLongToIntConversionPositiveCases.java index ccbc0f3d4b4..43af8871a22 100644 --- a/core/src/test/java/com/google/errorprone/bugpatterns/testdata/UnnecessaryLongToIntConversionPositiveCases.java +++ b/core/src/test/java/com/google/errorprone/bugpatterns/testdata/UnnecessaryLongToIntConversionPositiveCases.java @@ -39,7 +39,7 @@ public void longObjectToIntForLongParam() { public void convertMultipleArgs() { long x = 1; - // The method expects an int for the first parameter and a long for the second paremeter. + // The method expects an int for the first parameter and a long for the second parameter. // BUG: Diagnostic contains: UnnecessaryLongToIntConversion acceptsMultipleParams(Ints.checkedCast(x), Ints.checkedCast(x)); } diff --git a/docs/bugpattern/OptionalNotPresent.md b/docs/bugpattern/OptionalNotPresent.md index c8dd43566bb..44f51ea8446 100644 --- a/docs/bugpattern/OptionalNotPresent.md +++ b/docs/bugpattern/OptionalNotPresent.md @@ -1,8 +1,8 @@ Calling `get()` on an `Optional` that is not present will result in a `NoSuchElementException`. -This check detects cases where `get()` is called whent the optional is -definitely not present, e.g.: +This check detects cases where `get()` is called when the optional is definitely +not present, e.g.: ```java if (!o.isPresent()) {