From 891fecd297117de29fdaeec029690d9fdd737f97 Mon Sep 17 00:00:00 2001 From: Rick Ossendrijver Date: Sun, 25 Sep 2022 19:09:22 +0200 Subject: [PATCH] Replace occurrences of "which" with "that" in defining clauses (#259) --- CONTRIBUTING.md | 2 +- error-prone-contrib/README.md | 127 +++++++++--------- .../bugpatterns/AmbiguousJsonCreator.java | 2 +- .../errorprone/bugpatterns/AssertJIsNull.java | 2 +- .../bugpatterns/AutowiredConstructor.java | 2 +- .../CanonicalAnnotationSyntax.java | 2 +- .../bugpatterns/CollectorMutability.java | 2 +- .../errorprone/bugpatterns/EmptyMethod.java | 2 +- .../ErrorProneTestHelperSourceFormat.java | 2 +- .../bugpatterns/ExplicitEnumOrdering.java | 2 +- .../bugpatterns/FluxFlatMapUsage.java | 2 +- .../FormatStringConcatenation.java | 6 +- .../ImmutablesSortedSetComparator.java | 2 +- .../bugpatterns/JUnitMethodDeclaration.java | 4 +- ...cographicalAnnotationAttributeListing.java | 2 +- .../bugpatterns/MethodReferenceUsage.java | 2 +- .../bugpatterns/MockitoStubbing.java | 2 +- .../bugpatterns/NestedOptionals.java | 2 +- .../errorprone/bugpatterns/NonEmptyMono.java | 2 +- .../bugpatterns/PrimitiveComparison.java | 2 +- .../RedundantStringConversion.java | 6 +- .../bugpatterns/RefasterAnyOfUsage.java | 2 +- .../bugpatterns/RequestMappingAnnotation.java | 2 +- .../bugpatterns/RequestParamType.java | 2 +- .../ScheduledTransactionTrace.java | 4 +- .../bugpatterns/Slf4jLogStatement.java | 2 +- .../bugpatterns/SpringMvcAnnotation.java | 2 +- .../errorprone/bugpatterns/StaticImport.java | 5 +- .../errorprone/bugpatterns/TimeZoneUsage.java | 2 +- .../AssertJBigIntegerTemplates.java | 2 +- .../refastertemplates/AssertJTemplates.java | 10 +- .../AssertJThrowingCallableTemplates.java | 4 +- .../refastertemplates/AssortedTemplates.java | 4 +- .../refastertemplates/EqualityTemplates.java | 2 +- .../ImmutableListTemplates.java | 8 +- .../ImmutableMapTemplates.java | 2 +- .../ImmutableSetTemplates.java | 8 +- .../refastertemplates/OptionalTemplates.java | 2 +- .../refastertemplates/ReactorTemplates.java | 2 +- .../TestNGToAssertJTemplates.java | 6 +- .../util/MethodMatcherFactoryTest.java | 2 +- pom.xml | 6 +- refaster-compiler/pom.xml | 2 +- .../refaster/plugin/RefasterRuleCompiler.java | 2 +- .../RefasterRuleCompilerTaskListener.java | 2 +- .../refaster/plugin/package-info.java | 2 +- .../errorprone/refaster/runner/Refaster.java | 6 +- .../errorprone/refaster/util/IsArrayTest.java | 2 +- .../refaster/util/IsCharacterTest.java | 2 +- .../util/ThrowsCheckedExceptionTest.java | 2 +- 50 files changed, 137 insertions(+), 139 deletions(-) diff --git a/CONTRIBUTING.md b/CONTRIBUTING.md index 22cd3227c2..1023593a8f 100644 --- a/CONTRIBUTING.md +++ b/CONTRIBUTING.md @@ -51,7 +51,7 @@ Some pointers: - Checks should be _topical_: ideally they address a single concern. - Where possible checks should provide _fixes_, and ideally these are completely behavior-preserving. In order for a check to be adopted by users - it must not "get in the way". So for a check which addresses a relatively + it must not "get in the way". So for a check that addresses a relatively trivial stylistic concern it is doubly important that the violations it detects can be auto-patched. - Make sure you have read Error Prone's [criteria for new diff --git a/error-prone-contrib/README.md b/error-prone-contrib/README.md index cdf81d05d7..ace42e7da4 100644 --- a/error-prone-contrib/README.md +++ b/error-prone-contrib/README.md @@ -54,7 +54,7 @@ The following is a list of checks we'd like to see implemented: signature groups. Using Error Prone's method matchers forbidden method calls can easily be identified. But Error Prone can go one step further by auto-patching violations. For each violation two fixes can be proposed: a - purely behavior-preserving fix which makes the platform-dependent behavior + purely behavior-preserving fix, which makes the platform-dependent behavior explicit, and another which replaces the platform-dependent behavior with the preferred alternative. (Such as using `UTF-8` instead of the system default charset.) @@ -64,129 +64,128 @@ The following is a list of checks we'd like to see implemented: functionality. - A subset of the refactor operations provided by the Eclipse-specific [AutoRefactor][autorefactor] plugin. -- A check which replaces fully qualified types with simple types in contexts +- A check that replaces fully qualified types with simple types in contexts where this does not introduce ambiguity. Should consider both actual Java code and Javadoc `@link` references. -- A check which simplifies array expressions. It would replace empty array +- A check that simplifies array expressions. It would replace empty array expressions of the form `new int[] {}` with `new int[0]`. Statements of the - form `byte[] arr = new byte[] {'c'};` would be shortened to - `byte[] arr = {'c'};`. -- A check which replaces expressions of the form - `String.format("some prefix %s", arg)` with `"some prefix " + arg`, and - similar for simple suffixes. Can perhaps be generalized further, though it's - unclear how far. (Well, a `String.format` call without arguments can - certainly be simplified, too.) -- A check which replaces single-character strings with `char`s where possible. + form `byte[] arr = new byte[] {'c'};` would be shortened to `byte[] arr = + {'c'};`. +- A check that replaces expressions of the form `String.format("some prefix + %s", arg)` with `"some prefix " + arg`, and similar for simple suffixes. Can + perhaps be generalized further, though it's unclear how far. (Well, a + `String.format` call without arguments can certainly be simplified, too.) +- A check that replaces single-character strings with `char`s where possible. For example as argument to `StringBuilder.append` and in string concatenations. -- A check which adds or removes the first `Locale` argument to `String.format` +- A check that adds or removes the first `Locale` argument to `String.format` and similar calls as necessary. (For example, a format string containing only `%s` placeholders is locale-insensitive unless any of the arguments is a `Formattable`, while `%f` placeholders _are_ locale-sensitive.) -- A check which replaces `String.replaceAll` with `String.replace` if the first +- A check that replaces `String.replaceAll` with `String.replace` if the first argument is certainly not a regular expression. And if both arguments are single-character strings then the `(char, char)` overload can be invoked instead. -- A check which flags (and ideally, replaces) `try-finally` constructs with +- A check that flags (and ideally, replaces) `try-finally` constructs with equivalent `try-with-resources` constructs. -- A check which drops exceptions declared in `throws` clauses if they are (a) +- A check that drops exceptions declared in `throws` clauses if they are (a) not actually thrown and (b) the associated method cannot be overridden. -- A check which tries to statically import certain methods whenever used, if +- A check that tries to statically import certain methods whenever used, if possible. The set of targeted methods should be configurable, but may default to e.g. `java.util.Function.identity()`, the static methods exposed by `java.util.stream.Collectors` and the various Guava collector factory methods. -- A check which replaces `new Random().someMethod()` calls with +- A check that replaces `new Random().someMethod()` calls with `ThreadLocalRandom.current().someMethod()` calls, to avoid unnecessary synchronization. -- A check which drops `this.` from `this.someMethod()` calls and which +- A check that drops `this.` from `this.someMethod()` calls and which optionally does the same for fields, if no ambiguity arises. -- A check which replaces `Integer.valueOf` calls with `Integer.parseInt` or - vice versa in order to prevent auto (un)boxing, and likewise for other number +- A check that replaces `Integer.valueOf` calls with `Integer.parseInt` or vice + versa in order to prevent auto (un)boxing, and likewise for other number types. -- A check which flags nullable collections. -- A check which flags `AutoCloseable` resources not managed by a +- A check that flags nullable collections. +- A check that flags `AutoCloseable` resources not managed by a `try-with-resources` construct. Certain subtypes, such as jOOQ's `DSLContext` should be excluded. -- A check which flags `java.time` methods which implicitly consult the system +- A check that flags `java.time` methods which implicitly consult the system clock, suggesting that a passed-in `Clock` is used instead. -- A check which flags public methods on public classes which reference +- A check that flags public methods on public classes which reference non-public types. This can cause `IllegalAccessError`s and `BootstrapMethodError`s at runtime. -- A check which swaps the LHS and RHS in expressions of the form +- A check that swaps the LHS and RHS in expressions of the form `nonConstant.equals(someNonNullConstant)`. -- A check which annotates methods which only throw an exception with +- A check that annotates methods which only throw an exception with `@Deprecated` or ` @DoNotCall`. -- A check which flags imports from other test classes. -- A Guava-specific check which replaces `Joiner.join` calls with `String.join` +- A check that flags imports from other test classes. +- A Guava-specific check that replaces `Joiner.join` calls with `String.join` calls in those cases where the latter is a proper substitute for the former. -- A Guava-specific check which flags `{Immutable,}Multimap` type usages where +- A Guava-specific check that flags `{Immutable,}Multimap` type usages where `{Immutable,}{List,Set}Multimap` would be more appropriate. -- A Guava-specific check which rewrites - `if (conditional) { throw new IllegalArgumentException(); }` and variants to - an equivalent `checkArgument` statement. Idem for other exception types. -- A Guava-specific check which replaces simple anonymous `CacheLoader` subclass +- A Guava-specific check that rewrites `if (conditional) { throw new + IllegalArgumentException(); }` and variants to an equivalent `checkArgument` + statement. Idem for other exception types. +- A Guava-specific check that replaces simple anonymous `CacheLoader` subclass declarations with `CacheLoader.from(someLambda)`. -- A Spring-specific check which enforces that methods with the `@Scheduled` +- A Spring-specific check that enforces that methods with the `@Scheduled` annotation are also annotated with New Relic's `@Trace` annotation. Such methods should ideally not also represent Spring MVC endpoints. -- A Spring-specific check which enforces that `@RequestMapping` annotations, +- A Spring-specific check that enforces that `@RequestMapping` annotations, when applied to a method, explicitly specify one or more target HTTP methods. -- A Spring-specific check which looks for classes in which all - `@RequestMapping` annotations (and the various aliases) specify the same - `path`/`value` property and then moves that path to the class level. -- A Spring-specific check which flags `@Value("some.property")` annotations, as +- A Spring-specific check that looks for classes in which all `@RequestMapping` + annotations (and the various aliases) specify the same `path`/`value` + property and then moves that path to the class level. +- A Spring-specific check that flags `@Value("some.property")` annotations, as these almost certainly should be `@Value("${some.property}")`. -- A Spring-specific check which drops the `required` attribute from +- A Spring-specific check that drops the `required` attribute from `@RequestParam` annotations when the `defaultValue` attribute is also specified. -- A Spring-specific check which rewrites a class which uses field injection to +- A Spring-specific check that rewrites a class which uses field injection to one which uses constructor injection. This check wouldn't be strictly behavior preserving, but could be used for a one-off code base migration. -- A Spring-specific check which disallows field injection, except in +- A Spring-specific check that disallows field injection, except in `AbstractTestNGSpringContextTests` subclasses. (One known edge case: self-injections so that a bean can call itself through an implicit proxy.) -- A Spring-specific check which verifies that public methods on all classes +- A Spring-specific check that verifies that public methods on all classes whose name matches a certain pattern, e.g. `.*Service`, are annotated `@Secured`. -- A Spring-specific check which verifies that annotations such as +- A Spring-specific check that verifies that annotations such as `@RequestParam` are only present in `@RestController` classes. -- A Spring-specific check which disallows `@ResponseStatus` on MVC endpoint +- A Spring-specific check that disallows `@ResponseStatus` on MVC endpoint methods, as this prevents communication of error status codes. -- A Hibernate Validator-specific check which looks for `@UnwrapValidatedValue` +- A Hibernate Validator-specific check that looks for `@UnwrapValidatedValue` usages and migrates the associated constraint annotations to the generic type argument to which they (are presumed to) apply. -- A TestNG-specific check which drops method-level `@Test` annotations if a +- A TestNG-specific check that drops method-level `@Test` annotations if a matching/more specific annotation is already present at the class level. -- A TestNG-specific check which enforces that all tests are in a group. -- A TestNG-specific check which flags field assignments in +- A TestNG-specific check that enforces that all tests are in a group. +- A TestNG-specific check that flags field assignments in `@BeforeMethod`-annotated methods unless the class is annotated `@Test(singleThreaded = true)`. -- A TestNG-specific check which flags usages of the `expectedExceptions` +- A TestNG-specific check that flags usages of the `expectedExceptions` attribute of the `@Test` annotation, pointing to `assertThrows`. -- A Jongo-specific check which disallows the creation of sparse indices, in +- A Jongo-specific check that disallows the creation of sparse indices, in favour of partial indices. -- An Immutables-specific check which replaces +- An Immutables-specific check that replaces `checkState`/`IllegalStateException` usages inside a `@Value.Check`-annotated method with `checkArgument`/`IllegalArgument`, since the method is invoked when a caller attempts to create an immutable instance. -- An Immutables-specific check which disallows references to collection types +- An Immutables-specific check that disallows references to collection types other than the Guava immutable collections, including inside generic type arguments. -- An SLF4J-specific check which drops or adds a trailing dot from log messages, +- An SLF4J-specific check that drops or adds a trailing dot from log messages, as applicable. -- A Mockito-specific check which identifies sequences of statements which mock - a significant number of methods on a single object with "default data"; such +- A Mockito-specific check that identifies sequences of statements which mock a + significant number of methods on a single object with "default data"; such constructions can often benefit from a different type of default answer, such as `Answers.RETURNS_MOCKS`. -- An RxJava-specific check which flags `.toCompletable()` calls on expressions +- An RxJava-specific check that flags `.toCompletable()` calls on expressions of type `Single` etc., as most likely `.flatMapCompletable(Functions.identity())` was meant instead. Idem for other variations. -- An RxJava-specific check which flags `expr.firstOrError()` calls and suggests +- An RxJava-specific check that flags `expr.firstOrError()` calls and suggests `expr.switchIfEmpty(Single.error(...))`, so that an application-specific exception is thrown instead of `NoSuchElementException`. -- An RxJava-specific check which flags use of `#assertValueSet` without +- An RxJava-specific check that flags use of `#assertValueSet` without `#assertValueCount`, as the former method doesn't do what one may intuitively expect it to do. See ReactiveX/RxJava#6151. @@ -212,16 +211,16 @@ Refaster's expressiveness: - Some Refaster refactorings (e.g. when dealing with lazy evaluation) are valid only when some free parameter is a constant, variable reference or some other pure expression. Introduce a way to express such a constraint. For example, - rewriting `optional1.map(Optional::of).orElse(optional2)` to - `optional1.or(() -> optional2)` is not behavior preserving if evaluation of - `optional2` has side effects. + rewriting `optional1.map(Optional::of).orElse(optional2)` to `optional1.or(() + -> optional2)` is not behavior preserving if evaluation of `optional2` has + side effects. - Similarly, certain refactoring operations are only valid if one of the matched expressions is not `@Nullable`. It'd be nice to be able to express this. - Generalize `@Placeholder` support such that rules can reference e.g. "any concrete unary method". This would allow refactorings such as - `Mono.just(constant).flatmap(this::someFun)` -> - `Mono.defer(() -> someFun(constant))`. + `Mono.just(constant).flatmap(this::someFun)` -> `Mono.defer(() -> + someFun(constant))`. - Sometimes a Refaster refactoring can cause the resulting code not to compile due to a lack of generic type information. Identify and resolve such occurrences. For example, an `@AfterTemplate` may require the insertion of a diff --git a/error-prone-contrib/src/main/java/tech/picnic/errorprone/bugpatterns/AmbiguousJsonCreator.java b/error-prone-contrib/src/main/java/tech/picnic/errorprone/bugpatterns/AmbiguousJsonCreator.java index 24b933467e..4e90b6a53c 100644 --- a/error-prone-contrib/src/main/java/tech/picnic/errorprone/bugpatterns/AmbiguousJsonCreator.java +++ b/error-prone-contrib/src/main/java/tech/picnic/errorprone/bugpatterns/AmbiguousJsonCreator.java @@ -22,7 +22,7 @@ import java.util.Map; import javax.lang.model.element.AnnotationValue; -/** A {@link BugChecker} which flags ambiguous {@code @JsonCreator}s in enums. */ +/** A {@link BugChecker} that flags ambiguous {@code @JsonCreator}s in enums. */ @AutoService(BugChecker.class) @BugPattern( summary = "`JsonCreator.Mode` should be set for single-argument creators", diff --git a/error-prone-contrib/src/main/java/tech/picnic/errorprone/bugpatterns/AssertJIsNull.java b/error-prone-contrib/src/main/java/tech/picnic/errorprone/bugpatterns/AssertJIsNull.java index 3c217cdc3f..632e1eaa2a 100644 --- a/error-prone-contrib/src/main/java/tech/picnic/errorprone/bugpatterns/AssertJIsNull.java +++ b/error-prone-contrib/src/main/java/tech/picnic/errorprone/bugpatterns/AssertJIsNull.java @@ -21,7 +21,7 @@ import com.sun.source.tree.MethodInvocationTree; /** - * A {@link BugChecker} which flags AssertJ {@code isEqualTo(null)} checks for simplification. + * A {@link BugChecker} that flags AssertJ {@code isEqualTo(null)} checks for simplification. * *

This bug checker cannot be replaced with a simple Refaster template, as the Refaster approach * would require that all overloads of {@link org.assertj.core.api.Assert#isEqualTo(Object)} (such diff --git a/error-prone-contrib/src/main/java/tech/picnic/errorprone/bugpatterns/AutowiredConstructor.java b/error-prone-contrib/src/main/java/tech/picnic/errorprone/bugpatterns/AutowiredConstructor.java index ba4f47b4ba..764a80909d 100644 --- a/error-prone-contrib/src/main/java/tech/picnic/errorprone/bugpatterns/AutowiredConstructor.java +++ b/error-prone-contrib/src/main/java/tech/picnic/errorprone/bugpatterns/AutowiredConstructor.java @@ -24,7 +24,7 @@ import com.sun.source.tree.Tree; import java.util.List; -/** A {@link BugChecker} which flags redundant {@code @Autowired} constructor annotations. */ +/** A {@link BugChecker} that flags redundant {@code @Autowired} constructor annotations. */ @AutoService(BugChecker.class) @BugPattern( summary = "Omit `@Autowired` on a class' sole constructor, as it is redundant", diff --git a/error-prone-contrib/src/main/java/tech/picnic/errorprone/bugpatterns/CanonicalAnnotationSyntax.java b/error-prone-contrib/src/main/java/tech/picnic/errorprone/bugpatterns/CanonicalAnnotationSyntax.java index 718caa2865..a8deaf6fd3 100644 --- a/error-prone-contrib/src/main/java/tech/picnic/errorprone/bugpatterns/CanonicalAnnotationSyntax.java +++ b/error-prone-contrib/src/main/java/tech/picnic/errorprone/bugpatterns/CanonicalAnnotationSyntax.java @@ -27,7 +27,7 @@ import java.util.regex.Pattern; import tech.picnic.errorprone.bugpatterns.util.SourceCode; -/** A {@link BugChecker} which flags annotations that could be written more concisely. */ +/** A {@link BugChecker} that flags annotations that could be written more concisely. */ @AutoService(BugChecker.class) @BugPattern( summary = "Omit redundant syntax from annotation declarations", diff --git a/error-prone-contrib/src/main/java/tech/picnic/errorprone/bugpatterns/CollectorMutability.java b/error-prone-contrib/src/main/java/tech/picnic/errorprone/bugpatterns/CollectorMutability.java index dba5a9758f..f59ac7bba7 100644 --- a/error-prone-contrib/src/main/java/tech/picnic/errorprone/bugpatterns/CollectorMutability.java +++ b/error-prone-contrib/src/main/java/tech/picnic/errorprone/bugpatterns/CollectorMutability.java @@ -19,7 +19,7 @@ import java.util.stream.Collector; /** - * A {@link BugChecker} which flags {@link Collector Collectors} that don't clearly express + * A {@link BugChecker} that flags {@link Collector Collectors} that don't clearly express * (im)mutability. * *

Replacing such collectors with alternatives that produce immutable collections is preferred. diff --git a/error-prone-contrib/src/main/java/tech/picnic/errorprone/bugpatterns/EmptyMethod.java b/error-prone-contrib/src/main/java/tech/picnic/errorprone/bugpatterns/EmptyMethod.java index 9cd6ae0ece..ba75a9e836 100644 --- a/error-prone-contrib/src/main/java/tech/picnic/errorprone/bugpatterns/EmptyMethod.java +++ b/error-prone-contrib/src/main/java/tech/picnic/errorprone/bugpatterns/EmptyMethod.java @@ -22,7 +22,7 @@ import com.sun.source.tree.Tree; import java.util.Optional; -/** A {@link BugChecker} which flags empty methods that seemingly can simply be deleted. */ +/** A {@link BugChecker} that flags empty methods that seemingly can simply be deleted. */ @AutoService(BugChecker.class) @BugPattern( summary = "Empty method can likely be deleted", diff --git a/error-prone-contrib/src/main/java/tech/picnic/errorprone/bugpatterns/ErrorProneTestHelperSourceFormat.java b/error-prone-contrib/src/main/java/tech/picnic/errorprone/bugpatterns/ErrorProneTestHelperSourceFormat.java index 5c2ed5c5a2..5a95703af8 100644 --- a/error-prone-contrib/src/main/java/tech/picnic/errorprone/bugpatterns/ErrorProneTestHelperSourceFormat.java +++ b/error-prone-contrib/src/main/java/tech/picnic/errorprone/bugpatterns/ErrorProneTestHelperSourceFormat.java @@ -30,7 +30,7 @@ import java.util.Optional; /** - * A {@link BugChecker} which flags improperly formatted Error Prone test code. + * A {@link BugChecker} that flags improperly formatted Error Prone test code. * *

All test code should be formatted in accordance with Google Java Format's {@link Formatter} * output, and imports should be ordered according to the {@link Style#GOOGLE Google} style. diff --git a/error-prone-contrib/src/main/java/tech/picnic/errorprone/bugpatterns/ExplicitEnumOrdering.java b/error-prone-contrib/src/main/java/tech/picnic/errorprone/bugpatterns/ExplicitEnumOrdering.java index 97585f8c4a..85549ab9d3 100644 --- a/error-prone-contrib/src/main/java/tech/picnic/errorprone/bugpatterns/ExplicitEnumOrdering.java +++ b/error-prone-contrib/src/main/java/tech/picnic/errorprone/bugpatterns/ExplicitEnumOrdering.java @@ -30,7 +30,7 @@ import java.util.stream.Stream; /** - * A {@link BugChecker} which flags {@link Ordering#explicit(Object, Object[])}} invocations listing + * A {@link BugChecker} that flags {@link Ordering#explicit(Object, Object[])}} invocations listing * a subset of an enum type's values. */ @AutoService(BugChecker.class) diff --git a/error-prone-contrib/src/main/java/tech/picnic/errorprone/bugpatterns/FluxFlatMapUsage.java b/error-prone-contrib/src/main/java/tech/picnic/errorprone/bugpatterns/FluxFlatMapUsage.java index 1ce9a5f6a7..5f03cecc00 100644 --- a/error-prone-contrib/src/main/java/tech/picnic/errorprone/bugpatterns/FluxFlatMapUsage.java +++ b/error-prone-contrib/src/main/java/tech/picnic/errorprone/bugpatterns/FluxFlatMapUsage.java @@ -24,7 +24,7 @@ import reactor.core.publisher.Flux; /** - * A {@link BugChecker} which flags usages of {@link Flux#flatMap(Function)} and {@link + * A {@link BugChecker} that flags usages of {@link Flux#flatMap(Function)} and {@link * Flux#flatMapSequential(Function)}. * *

{@link Flux#flatMap(Function)} and {@link Flux#flatMapSequential(Function)} eagerly perform up diff --git a/error-prone-contrib/src/main/java/tech/picnic/errorprone/bugpatterns/FormatStringConcatenation.java b/error-prone-contrib/src/main/java/tech/picnic/errorprone/bugpatterns/FormatStringConcatenation.java index 54b5f53bb3..f071843e80 100644 --- a/error-prone-contrib/src/main/java/tech/picnic/errorprone/bugpatterns/FormatStringConcatenation.java +++ b/error-prone-contrib/src/main/java/tech/picnic/errorprone/bugpatterns/FormatStringConcatenation.java @@ -35,8 +35,8 @@ import tech.picnic.errorprone.bugpatterns.util.SourceCode; /** - * A {@link BugChecker} which flags string concatenations that produce a format string; in such - * cases the string concatenation should instead be deferred to the invoked method. + * A {@link BugChecker} that flags string concatenations that produce a format string; in such cases + * the string concatenation should instead be deferred to the invoked method. * * @implNote This checker is based on the implementation of {@link * com.google.errorprone.bugpatterns.flogger.FloggerStringConcatenation}. @@ -46,7 +46,7 @@ // should introduce special handling of `Formattable` arguments, as this check would replace a // `Formattable#toString` invocation with a `Formattable#formatTo` invocation. But likely that // should be considered a bug fix, too. -// XXX: Introduce a separate check which adds/removes the `Locale` parameter to `String.format` +// XXX: Introduce a separate check that adds/removes the `Locale` parameter to `String.format` // invocations, as necessary. @AutoService(BugChecker.class) @BugPattern( diff --git a/error-prone-contrib/src/main/java/tech/picnic/errorprone/bugpatterns/ImmutablesSortedSetComparator.java b/error-prone-contrib/src/main/java/tech/picnic/errorprone/bugpatterns/ImmutablesSortedSetComparator.java index 5e8a3c2c71..7afbc09930 100644 --- a/error-prone-contrib/src/main/java/tech/picnic/errorprone/bugpatterns/ImmutablesSortedSetComparator.java +++ b/error-prone-contrib/src/main/java/tech/picnic/errorprone/bugpatterns/ImmutablesSortedSetComparator.java @@ -26,7 +26,7 @@ import javax.lang.model.element.Modifier; /** - * A {@link BugChecker} which flags {@link SortedSet} property declarations inside + * A {@link BugChecker} that flags {@link SortedSet} property declarations inside * {@code @Value.Immutable}- and {@code @Value.Modifiable}-annotated types that lack a * {@code @Value.NaturalOrder} or {@code @Value.ReverseOrder} annotation. * diff --git a/error-prone-contrib/src/main/java/tech/picnic/errorprone/bugpatterns/JUnitMethodDeclaration.java b/error-prone-contrib/src/main/java/tech/picnic/errorprone/bugpatterns/JUnitMethodDeclaration.java index c342283008..419fc93de7 100644 --- a/error-prone-contrib/src/main/java/tech/picnic/errorprone/bugpatterns/JUnitMethodDeclaration.java +++ b/error-prone-contrib/src/main/java/tech/picnic/errorprone/bugpatterns/JUnitMethodDeclaration.java @@ -38,8 +38,8 @@ import javax.lang.model.element.Name; import tech.picnic.errorprone.bugpatterns.util.SourceCode; -/** A {@link BugChecker} which flags non-canonical JUnit method declarations. */ -// XXX: Consider introducing a class-level check which enforces that test classes: +/** A {@link BugChecker} that flags non-canonical JUnit method declarations. */ +// XXX: Consider introducing a class-level check that enforces that test classes: // 1. Are named `*Test` or `Abstract*TestCase`. // 2. If not `abstract`, are package-private and don't have public methods and subclasses. // 3. Only have private fields. diff --git a/error-prone-contrib/src/main/java/tech/picnic/errorprone/bugpatterns/LexicographicalAnnotationAttributeListing.java b/error-prone-contrib/src/main/java/tech/picnic/errorprone/bugpatterns/LexicographicalAnnotationAttributeListing.java index cab0458736..7a57cc1fd7 100644 --- a/error-prone-contrib/src/main/java/tech/picnic/errorprone/bugpatterns/LexicographicalAnnotationAttributeListing.java +++ b/error-prone-contrib/src/main/java/tech/picnic/errorprone/bugpatterns/LexicographicalAnnotationAttributeListing.java @@ -42,7 +42,7 @@ import tech.picnic.errorprone.bugpatterns.util.SourceCode; /** - * A {@link BugChecker} which flags annotation array listings which aren't sorted lexicographically. + * A {@link BugChecker} that flags annotation array listings which aren't sorted lexicographically. * *

The idea behind this checker is that maintaining a sorted sequence simplifies conflict * resolution, and can even avoid it if two branches add the same entry. diff --git a/error-prone-contrib/src/main/java/tech/picnic/errorprone/bugpatterns/MethodReferenceUsage.java b/error-prone-contrib/src/main/java/tech/picnic/errorprone/bugpatterns/MethodReferenceUsage.java index 3a7c1de49c..e9d086b82e 100644 --- a/error-prone-contrib/src/main/java/tech/picnic/errorprone/bugpatterns/MethodReferenceUsage.java +++ b/error-prone-contrib/src/main/java/tech/picnic/errorprone/bugpatterns/MethodReferenceUsage.java @@ -35,7 +35,7 @@ import javax.lang.model.element.Name; /** - * A {@link BugChecker} which flags lambda expressions that can be replaced with method references. + * A {@link BugChecker} that flags lambda expressions that can be replaced with method references. */ // XXX: Other custom expressions we could rewrite: // - `a -> "str" + a` to `"str"::concat`. But only if `str` is provably non-null. diff --git a/error-prone-contrib/src/main/java/tech/picnic/errorprone/bugpatterns/MockitoStubbing.java b/error-prone-contrib/src/main/java/tech/picnic/errorprone/bugpatterns/MockitoStubbing.java index 4ce75c8a46..7c03a48f0c 100644 --- a/error-prone-contrib/src/main/java/tech/picnic/errorprone/bugpatterns/MockitoStubbing.java +++ b/error-prone-contrib/src/main/java/tech/picnic/errorprone/bugpatterns/MockitoStubbing.java @@ -20,7 +20,7 @@ import tech.picnic.errorprone.bugpatterns.util.SourceCode; /** - * A {@link BugChecker} which flags method invocations for which all arguments are wrapped using + * A {@link BugChecker} that flags method invocations for which all arguments are wrapped using * {@link org.mockito.Mockito#eq}; this is redundant. */ @AutoService(BugChecker.class) diff --git a/error-prone-contrib/src/main/java/tech/picnic/errorprone/bugpatterns/NestedOptionals.java b/error-prone-contrib/src/main/java/tech/picnic/errorprone/bugpatterns/NestedOptionals.java index a10ae529e4..143fba87fb 100644 --- a/error-prone-contrib/src/main/java/tech/picnic/errorprone/bugpatterns/NestedOptionals.java +++ b/error-prone-contrib/src/main/java/tech/picnic/errorprone/bugpatterns/NestedOptionals.java @@ -20,7 +20,7 @@ import com.sun.tools.javac.util.List; import java.util.Optional; -/** A {@link BugChecker} which flags nesting of {@link Optional Optionals}. */ +/** A {@link BugChecker} that flags nesting of {@link Optional Optionals}. */ @AutoService(BugChecker.class) @BugPattern( summary = diff --git a/error-prone-contrib/src/main/java/tech/picnic/errorprone/bugpatterns/NonEmptyMono.java b/error-prone-contrib/src/main/java/tech/picnic/errorprone/bugpatterns/NonEmptyMono.java index 8019039880..95564084cc 100644 --- a/error-prone-contrib/src/main/java/tech/picnic/errorprone/bugpatterns/NonEmptyMono.java +++ b/error-prone-contrib/src/main/java/tech/picnic/errorprone/bugpatterns/NonEmptyMono.java @@ -22,7 +22,7 @@ import tech.picnic.errorprone.bugpatterns.util.SourceCode; /** - * A {@link BugChecker} which flags {@link Mono} operations that are known to be vacuous, given that + * A {@link BugChecker} that flags {@link Mono} operations that are known to be vacuous, given that * they are invoked on a {@link Mono} that is known not to complete empty. */ @AutoService(BugChecker.class) diff --git a/error-prone-contrib/src/main/java/tech/picnic/errorprone/bugpatterns/PrimitiveComparison.java b/error-prone-contrib/src/main/java/tech/picnic/errorprone/bugpatterns/PrimitiveComparison.java index 4851db0b54..3f3adfc271 100644 --- a/error-prone-contrib/src/main/java/tech/picnic/errorprone/bugpatterns/PrimitiveComparison.java +++ b/error-prone-contrib/src/main/java/tech/picnic/errorprone/bugpatterns/PrimitiveComparison.java @@ -34,7 +34,7 @@ import tech.picnic.errorprone.bugpatterns.util.SourceCode; /** - * A {@link BugChecker} which flags {@code Comparator#comparing*} invocations that can be replaced + * A {@link BugChecker} that flags {@code Comparator#comparing*} invocations that can be replaced * with an equivalent alternative so as to avoid unnecessary (un)boxing. */ // XXX: Add more documentation. Explain how this is useful in the face of refactoring to more diff --git a/error-prone-contrib/src/main/java/tech/picnic/errorprone/bugpatterns/RedundantStringConversion.java b/error-prone-contrib/src/main/java/tech/picnic/errorprone/bugpatterns/RedundantStringConversion.java index 543a814671..bb5c06b101 100644 --- a/error-prone-contrib/src/main/java/tech/picnic/errorprone/bugpatterns/RedundantStringConversion.java +++ b/error-prone-contrib/src/main/java/tech/picnic/errorprone/bugpatterns/RedundantStringConversion.java @@ -51,7 +51,7 @@ import tech.picnic.errorprone.bugpatterns.util.MethodMatcherFactory; import tech.picnic.errorprone.bugpatterns.util.SourceCode; -/** A {@link BugChecker} which flags redundant explicit string conversions. */ +/** A {@link BugChecker} that flags redundant explicit string conversions. */ @AutoService(BugChecker.class) @BugPattern( summary = "Avoid redundant string conversions when possible", @@ -224,7 +224,7 @@ private Optional tryFixPositionalConverter( .flatMap(args -> tryFix(args.get(index), state, ANY_EXPR)); } - // XXX: Write another check which checks that Formatter patterns don't use `{}` and have a + // XXX: Write another check that checks that Formatter patterns don't use `{}` and have a // matching number of arguments of the appropriate type. Also flag explicit conversions from // `Formattable` to string. private Optional tryFixFormatter( @@ -255,7 +255,7 @@ private Optional tryFixGuavaGuard( return tryFixFormatterArguments(arguments, state, ANY_EXPR, ANY_EXPR); } - // XXX: Write another check which checks that SLF4J patterns don't use `%s` and have a matching + // XXX: Write another check that checks that SLF4J patterns don't use `%s` and have a matching // number of arguments of the appropriate type. Also flag explicit conversions from `Throwable` to // string as the last logger argument. Suggests either dropping the conversion or going with // `Throwable#getMessage()` instead. diff --git a/error-prone-contrib/src/main/java/tech/picnic/errorprone/bugpatterns/RefasterAnyOfUsage.java b/error-prone-contrib/src/main/java/tech/picnic/errorprone/bugpatterns/RefasterAnyOfUsage.java index 9a47ba167c..24ee6cc211 100644 --- a/error-prone-contrib/src/main/java/tech/picnic/errorprone/bugpatterns/RefasterAnyOfUsage.java +++ b/error-prone-contrib/src/main/java/tech/picnic/errorprone/bugpatterns/RefasterAnyOfUsage.java @@ -19,7 +19,7 @@ import tech.picnic.errorprone.bugpatterns.util.SourceCode; /** - * A {@link BugChecker} which flags unnecessary {@link Refaster#anyOf(Object[])} usages. + * A {@link BugChecker} that flags unnecessary {@link Refaster#anyOf(Object[])} usages. * *

Note that this logic can't be implemented as a Refaster template, as the {@link Refaster} * class is treated specially. diff --git a/error-prone-contrib/src/main/java/tech/picnic/errorprone/bugpatterns/RequestMappingAnnotation.java b/error-prone-contrib/src/main/java/tech/picnic/errorprone/bugpatterns/RequestMappingAnnotation.java index 257b0361e8..46d66511b2 100644 --- a/error-prone-contrib/src/main/java/tech/picnic/errorprone/bugpatterns/RequestMappingAnnotation.java +++ b/error-prone-contrib/src/main/java/tech/picnic/errorprone/bugpatterns/RequestMappingAnnotation.java @@ -23,7 +23,7 @@ import com.sun.source.tree.Tree; /** - * A {@link BugChecker} which flags {@code @RequestMapping} methods that have one or more parameters + * A {@link BugChecker} that flags {@code @RequestMapping} methods that have one or more parameters * that appear to lack a relevant annotation. * *

Matched mappings are {@code @{Delete,Get,Patch,Post,Put,Request}Mapping}. diff --git a/error-prone-contrib/src/main/java/tech/picnic/errorprone/bugpatterns/RequestParamType.java b/error-prone-contrib/src/main/java/tech/picnic/errorprone/bugpatterns/RequestParamType.java index 7b69019782..2367f8518b 100644 --- a/error-prone-contrib/src/main/java/tech/picnic/errorprone/bugpatterns/RequestParamType.java +++ b/error-prone-contrib/src/main/java/tech/picnic/errorprone/bugpatterns/RequestParamType.java @@ -21,7 +21,7 @@ import com.google.errorprone.matchers.Matcher; import com.sun.source.tree.VariableTree; -/** A {@link BugChecker} which flags {@code @RequestParam} parameters with an unsupported type. */ +/** A {@link BugChecker} that flags {@code @RequestParam} parameters with an unsupported type. */ @AutoService(BugChecker.class) @BugPattern( summary = "`@RequestParam` does not support `ImmutableCollection` and `ImmutableMap` subtypes", diff --git a/error-prone-contrib/src/main/java/tech/picnic/errorprone/bugpatterns/ScheduledTransactionTrace.java b/error-prone-contrib/src/main/java/tech/picnic/errorprone/bugpatterns/ScheduledTransactionTrace.java index 4b4071e7e7..65ca2b7094 100644 --- a/error-prone-contrib/src/main/java/tech/picnic/errorprone/bugpatterns/ScheduledTransactionTrace.java +++ b/error-prone-contrib/src/main/java/tech/picnic/errorprone/bugpatterns/ScheduledTransactionTrace.java @@ -27,8 +27,8 @@ import com.sun.source.tree.Tree; /** - * A {@link BugChecker} which flags methods with Spring's {@code @Scheduled} annotation that lack - * New Relic Agent's {@code @Trace(dispatcher = true)}. + * A {@link BugChecker} that flags methods with Spring's {@code @Scheduled} annotation that lack New + * Relic Agent's {@code @Trace(dispatcher = true)}. */ @AutoService(BugChecker.class) @BugPattern( diff --git a/error-prone-contrib/src/main/java/tech/picnic/errorprone/bugpatterns/Slf4jLogStatement.java b/error-prone-contrib/src/main/java/tech/picnic/errorprone/bugpatterns/Slf4jLogStatement.java index 3374501d9f..21c03bf150 100644 --- a/error-prone-contrib/src/main/java/tech/picnic/errorprone/bugpatterns/Slf4jLogStatement.java +++ b/error-prone-contrib/src/main/java/tech/picnic/errorprone/bugpatterns/Slf4jLogStatement.java @@ -24,7 +24,7 @@ import java.util.Optional; import tech.picnic.errorprone.bugpatterns.util.SourceCode; -/** A {@link BugChecker} which flags SLF4J usages that are likely to be in error. */ +/** A {@link BugChecker} that flags SLF4J usages that are likely to be in error. */ // XXX: The special-casing of Throwable applies only to SLF4J 1.6.0+; see // https://www.slf4j.org/faq.html#paramException. That should be documented. // XXX: Also simplify `LOG.error(String.format("Something %s", arg), throwable)`. diff --git a/error-prone-contrib/src/main/java/tech/picnic/errorprone/bugpatterns/SpringMvcAnnotation.java b/error-prone-contrib/src/main/java/tech/picnic/errorprone/bugpatterns/SpringMvcAnnotation.java index ef6b65375e..fcfd79e8d6 100644 --- a/error-prone-contrib/src/main/java/tech/picnic/errorprone/bugpatterns/SpringMvcAnnotation.java +++ b/error-prone-contrib/src/main/java/tech/picnic/errorprone/bugpatterns/SpringMvcAnnotation.java @@ -29,7 +29,7 @@ import tech.picnic.errorprone.bugpatterns.util.SourceCode; /** - * A {@link BugChecker} which flags {@code @RequestMapping} annotations that can be written more + * A {@link BugChecker} that flags {@code @RequestMapping} annotations that can be written more * concisely. */ @AutoService(BugChecker.class) diff --git a/error-prone-contrib/src/main/java/tech/picnic/errorprone/bugpatterns/StaticImport.java b/error-prone-contrib/src/main/java/tech/picnic/errorprone/bugpatterns/StaticImport.java index cf0ee74e8e..bc4d2900b9 100644 --- a/error-prone-contrib/src/main/java/tech/picnic/errorprone/bugpatterns/StaticImport.java +++ b/error-prone-contrib/src/main/java/tech/picnic/errorprone/bugpatterns/StaticImport.java @@ -27,15 +27,14 @@ import java.util.Optional; /** - * A {@link BugChecker} which flags methods and constants that can and should be statically - * imported. + * A {@link BugChecker} that flags methods and constants that can and should be statically imported. */ // XXX: Tricky cases: // - `org.springframework.http.HttpStatus` (not always an improvement, and `valueOf` must // certainly be excluded) // - `com.google.common.collect.Tables` // - `ch.qos.logback.classic.Level.{DEBUG, ERROR, INFO, TRACE, WARN"}` -// XXX: Also introduce a check which disallows static imports of certain methods. Candidates: +// XXX: Also introduce a check that disallows static imports of certain methods. Candidates: // - `com.google.common.base.Strings` // - `java.util.Optional.empty` // - `java.util.Locale.ROOT` diff --git a/error-prone-contrib/src/main/java/tech/picnic/errorprone/bugpatterns/TimeZoneUsage.java b/error-prone-contrib/src/main/java/tech/picnic/errorprone/bugpatterns/TimeZoneUsage.java index 86888b3c24..26748a38b3 100644 --- a/error-prone-contrib/src/main/java/tech/picnic/errorprone/bugpatterns/TimeZoneUsage.java +++ b/error-prone-contrib/src/main/java/tech/picnic/errorprone/bugpatterns/TimeZoneUsage.java @@ -26,7 +26,7 @@ import java.time.LocalDateTime; import java.time.LocalTime; -/** A {@link BugChecker} which flags illegal time-zone related operations. */ +/** A {@link BugChecker} that flags illegal time-zone related operations. */ @AutoService(BugChecker.class) @BugPattern( summary = diff --git a/error-prone-contrib/src/main/java/tech/picnic/errorprone/refastertemplates/AssertJBigIntegerTemplates.java b/error-prone-contrib/src/main/java/tech/picnic/errorprone/refastertemplates/AssertJBigIntegerTemplates.java index 9ae79af35c..6394d1cda0 100644 --- a/error-prone-contrib/src/main/java/tech/picnic/errorprone/refastertemplates/AssertJBigIntegerTemplates.java +++ b/error-prone-contrib/src/main/java/tech/picnic/errorprone/refastertemplates/AssertJBigIntegerTemplates.java @@ -9,7 +9,7 @@ import java.math.BigInteger; import org.assertj.core.api.AbstractBigIntegerAssert; -// XXX: If we add a rule which drops unnecessary `L` suffixes from literal longs, then the `0L`/`1L` +// XXX: If we add a rule that drops unnecessary `L` suffixes from literal longs, then the `0L`/`1L` // cases below can go. final class AssertJBigIntegerTemplates { private AssertJBigIntegerTemplates() {} diff --git a/error-prone-contrib/src/main/java/tech/picnic/errorprone/refastertemplates/AssertJTemplates.java b/error-prone-contrib/src/main/java/tech/picnic/errorprone/refastertemplates/AssertJTemplates.java index a0b942750f..6eccc20cd5 100644 --- a/error-prone-contrib/src/main/java/tech/picnic/errorprone/refastertemplates/AssertJTemplates.java +++ b/error-prone-contrib/src/main/java/tech/picnic/errorprone/refastertemplates/AssertJTemplates.java @@ -63,7 +63,7 @@ // ^ And variants. // XXX: Consider splitting this class into multiple classes. // XXX: Some of these rules may not apply given the updated TestNG rewrite rules. Review. -// XXX: For the templates which "unwrap" explicitly enumerated collections, also introduce variants +// XXX: For the templates that "unwrap" explicitly enumerated collections, also introduce variants // with explicitly enumerated sorted collections. (Requires that the type bound is Comparable.) // XXX: Handle `.isEqualTo(explicitlyEnumeratedCollection)`. Can be considered equivalent to // `.containsOnly(elements)`. (This does mean the auto-generated code needs to be more advanced. @@ -106,12 +106,12 @@ // candidates, such as `assertThat(ImmutableSet(foo, bar)).XXX` // XXX: Write generic plugin to replace explicit array parameters with varargs (`new int[] {1, 2}` // -> `1, 2`). -// XXX: Write plugin which drops any `.withFailMessage` which doesn't include a compile-time -// constant string? Most of these are useless. -// XXX: Write plugin which identifies `.get().propertyAccess()` and "pushes" this out. Would only +// XXX: Write plugin that drops any `.withFailMessage` that doesn't include a compile-time constant +// string? Most of these are useless. +// XXX: Write plugin that identifies `.get().propertyAccess()` and "pushes" this out. Would only // nicely work for non-special types, though, cause after `extracting(propertyAccess)` many // operations are not available... -// XXX: Write plugin which identifies repeated `assertThat(someProp.xxx)` calls and bundles these +// XXX: Write plugin that identifies repeated `assertThat(someProp.xxx)` calls and bundles these // somehow. // XXX: `abstractOptionalAssert.get().satisfies(pred)` -> // `abstractOptionalAssert.hasValueSatisfying(pred)`. diff --git a/error-prone-contrib/src/main/java/tech/picnic/errorprone/refastertemplates/AssertJThrowingCallableTemplates.java b/error-prone-contrib/src/main/java/tech/picnic/errorprone/refastertemplates/AssertJThrowingCallableTemplates.java index 3a0b0d5650..14ebac29d5 100644 --- a/error-prone-contrib/src/main/java/tech/picnic/errorprone/refastertemplates/AssertJThrowingCallableTemplates.java +++ b/error-prone-contrib/src/main/java/tech/picnic/errorprone/refastertemplates/AssertJThrowingCallableTemplates.java @@ -429,7 +429,7 @@ static final class AssertThatThrownByHasMessageParameters { } } - // XXX: Drop this template in favour of a generic Error Prone check which flags + // XXX: Drop this template in favour of a generic Error Prone check that flags // `String.format(...)` arguments to a wide range of format methods. static final class AbstractThrowableAssertHasMessage { @BeforeTemplate @@ -449,7 +449,7 @@ static final class AbstractThrowableAssertHasMessage { } } - // XXX: Drop this template in favour of a generic Error Prone check which flags + // XXX: Drop this template in favour of a generic Error Prone check that flags // `String.format(...)` arguments to a wide range of format methods. static final class AbstractThrowableAssertWithFailMessage { @BeforeTemplate diff --git a/error-prone-contrib/src/main/java/tech/picnic/errorprone/refastertemplates/AssortedTemplates.java b/error-prone-contrib/src/main/java/tech/picnic/errorprone/refastertemplates/AssortedTemplates.java index 81169772e5..62ec075c2a 100644 --- a/error-prone-contrib/src/main/java/tech/picnic/errorprone/refastertemplates/AssortedTemplates.java +++ b/error-prone-contrib/src/main/java/tech/picnic/errorprone/refastertemplates/AssortedTemplates.java @@ -82,7 +82,7 @@ V after(Map map, L key) { * ImmutableSet#toImmutableSet()} and produces a more compact object. * *

Warning: this rewrite rule is not completely behavior preserving: while the - * original code produces a set which iterates over the elements in encounter order, the + * original code produces a set that iterates over the elements in encounter order, the * replacement code iterates over the elements in enum definition order. */ // XXX: ^ Consider emitting a comment warning about this fact? @@ -118,7 +118,7 @@ T after(Iterator iterator, T defaultValue) { /** Don't unnecessarily repeat boolean expressions. */ // XXX: This template captures only the simplest case. `@AlsoNegation` doesn't help. Consider - // contributing a Refaster patch which handles the negation in the `@BeforeTemplate` more + // contributing a Refaster patch, which handles the negation in the `@BeforeTemplate` more // intelligently. static final class LogicalImplication { @BeforeTemplate diff --git a/error-prone-contrib/src/main/java/tech/picnic/errorprone/refastertemplates/EqualityTemplates.java b/error-prone-contrib/src/main/java/tech/picnic/errorprone/refastertemplates/EqualityTemplates.java index 3a1e267c67..3cb561b11a 100644 --- a/error-prone-contrib/src/main/java/tech/picnic/errorprone/refastertemplates/EqualityTemplates.java +++ b/error-prone-contrib/src/main/java/tech/picnic/errorprone/refastertemplates/EqualityTemplates.java @@ -36,7 +36,7 @@ boolean after(T a, T b) { /** Prefer {@link Object#equals(Object)} over the equivalent lambda function. */ // XXX: As it stands, this rule is a special case of what `MethodReferenceUsage` tries to achieve. // If/when `MethodReferenceUsage` becomes production ready, we should simply drop this check. - // XXX: Alternatively, the rule should be replaced with a plugin which also identifies cases where + // XXX: Alternatively, the rule should be replaced with a plugin that also identifies cases where // the arguments are swapped but simplification is possible anyway, by virtue of `v` being // non-null. static final class EqualsPredicate { diff --git a/error-prone-contrib/src/main/java/tech/picnic/errorprone/refastertemplates/ImmutableListTemplates.java b/error-prone-contrib/src/main/java/tech/picnic/errorprone/refastertemplates/ImmutableListTemplates.java index 711426361b..082fadf231 100644 --- a/error-prone-contrib/src/main/java/tech/picnic/errorprone/refastertemplates/ImmutableListTemplates.java +++ b/error-prone-contrib/src/main/java/tech/picnic/errorprone/refastertemplates/ImmutableListTemplates.java @@ -194,7 +194,7 @@ ImmutableList after(T e1) { * Prefer {@link ImmutableList#of(Object, Object)} over alternatives that don't communicate the * immutability of the resulting list at the type level. */ - // XXX: Consider writing an Error Prone check which also flags straightforward + // XXX: Consider writing an Error Prone check that also flags straightforward // `ImmutableList.builder()` usages. static final class ImmutableListOf2 { @BeforeTemplate @@ -212,7 +212,7 @@ ImmutableList after(T e1, T e2) { * Prefer {@link ImmutableList#of(Object, Object, Object)} over alternatives that don't * communicate the immutability of the resulting list at the type level. */ - // XXX: Consider writing an Error Prone check which also flags straightforward + // XXX: Consider writing an Error Prone check that also flags straightforward // `ImmutableList.builder()` usages. static final class ImmutableListOf3 { @BeforeTemplate @@ -230,7 +230,7 @@ ImmutableList after(T e1, T e2, T e3) { * Prefer {@link ImmutableList#of(Object, Object, Object, Object)} over alternatives that don't * communicate the immutability of the resulting list at the type level. */ - // XXX: Consider writing an Error Prone check which also flags straightforward + // XXX: Consider writing an Error Prone check that also flags straightforward // `ImmutableList.builder()` usages. static final class ImmutableListOf4 { @BeforeTemplate @@ -248,7 +248,7 @@ ImmutableList after(T e1, T e2, T e3, T e4) { * Prefer {@link ImmutableList#of(Object, Object, Object, Object, Object)} over alternatives that * don't communicate the immutability of the resulting list at the type level. */ - // XXX: Consider writing an Error Prone check which also flags straightforward + // XXX: Consider writing an Error Prone check that also flags straightforward // `ImmutableList.builder()` usages. static final class ImmutableListOf5 { @BeforeTemplate diff --git a/error-prone-contrib/src/main/java/tech/picnic/errorprone/refastertemplates/ImmutableMapTemplates.java b/error-prone-contrib/src/main/java/tech/picnic/errorprone/refastertemplates/ImmutableMapTemplates.java index 8429e1b3d5..ad9a4e3a70 100644 --- a/error-prone-contrib/src/main/java/tech/picnic/errorprone/refastertemplates/ImmutableMapTemplates.java +++ b/error-prone-contrib/src/main/java/tech/picnic/errorprone/refastertemplates/ImmutableMapTemplates.java @@ -135,7 +135,7 @@ abstract static class StreamOfMapEntriesToImmutableMap { abstract V valueFunction(@MayOptionallyUse E element); // XXX: We could add variants in which the entry is created some other way, but we have another - // rule which covers canonicalization to `Map.entry`. + // rule that covers canonicalization to `Map.entry`. @BeforeTemplate ImmutableMap before(Stream stream) { return stream diff --git a/error-prone-contrib/src/main/java/tech/picnic/errorprone/refastertemplates/ImmutableSetTemplates.java b/error-prone-contrib/src/main/java/tech/picnic/errorprone/refastertemplates/ImmutableSetTemplates.java index a3ef63e71f..b710f4e7a1 100644 --- a/error-prone-contrib/src/main/java/tech/picnic/errorprone/refastertemplates/ImmutableSetTemplates.java +++ b/error-prone-contrib/src/main/java/tech/picnic/errorprone/refastertemplates/ImmutableSetTemplates.java @@ -142,7 +142,7 @@ ImmutableSet after(T e1) { * Prefer {@link ImmutableSet#of(Object, Object)} over alternatives that don't communicate the * immutability of the resulting set at the type level. */ - // XXX: Consider writing an Error Prone check which also flags straightforward + // XXX: Consider writing an Error Prone check that also flags straightforward // `ImmutableSet.builder()` usages. static final class ImmutableSetOf2 { @BeforeTemplate @@ -160,7 +160,7 @@ ImmutableSet after(T e1, T e2) { * Prefer {@link ImmutableSet#of(Object, Object, Object)} over alternatives that don't communicate * the immutability of the resulting set at the type level. */ - // XXX: Consider writing an Error Prone check which also flags straightforward + // XXX: Consider writing an Error Prone check that also flags straightforward // `ImmutableSet.builder()` usages. static final class ImmutableSetOf3 { @BeforeTemplate @@ -178,7 +178,7 @@ ImmutableSet after(T e1, T e2, T e3) { * Prefer {@link ImmutableSet#of(Object, Object, Object, Object)} over alternatives that don't * communicate the immutability of the resulting set at the type level. */ - // XXX: Consider writing an Error Prone check which also flags straightforward + // XXX: Consider writing an Error Prone check that also flags straightforward // `ImmutableSet.builder()` usages. static final class ImmutableSetOf4 { @BeforeTemplate @@ -196,7 +196,7 @@ ImmutableSet after(T e1, T e2, T e3, T e4) { * Prefer {@link ImmutableSet#of(Object, Object, Object, Object, Object)} over alternatives that * don't communicate the immutability of the resulting set at the type level. */ - // XXX: Consider writing an Error Prone check which also flags straightforward + // XXX: Consider writing an Error Prone check that also flags straightforward // `ImmutableSet.builder()` usages. static final class ImmutableSetOf5 { @BeforeTemplate diff --git a/error-prone-contrib/src/main/java/tech/picnic/errorprone/refastertemplates/OptionalTemplates.java b/error-prone-contrib/src/main/java/tech/picnic/errorprone/refastertemplates/OptionalTemplates.java index 1e216ed121..15bb579ce9 100644 --- a/error-prone-contrib/src/main/java/tech/picnic/errorprone/refastertemplates/OptionalTemplates.java +++ b/error-prone-contrib/src/main/java/tech/picnic/errorprone/refastertemplates/OptionalTemplates.java @@ -166,7 +166,7 @@ boolean after(Optional optional, Predicate predicate) { } /** - * Prefer {@link Optional#map} over a {@link Optional#flatMap} which wraps the result of a + * Prefer {@link Optional#map} over a {@link Optional#flatMap} that wraps the result of a * transformation in an {@link Optional}; the former operation transforms {@code null} to {@link * Optional#empty()}. */ diff --git a/error-prone-contrib/src/main/java/tech/picnic/errorprone/refastertemplates/ReactorTemplates.java b/error-prone-contrib/src/main/java/tech/picnic/errorprone/refastertemplates/ReactorTemplates.java index d76ca5befb..ff491b33a0 100644 --- a/error-prone-contrib/src/main/java/tech/picnic/errorprone/refastertemplates/ReactorTemplates.java +++ b/error-prone-contrib/src/main/java/tech/picnic/errorprone/refastertemplates/ReactorTemplates.java @@ -228,7 +228,7 @@ Flux after(Mono mono) { /** * Prefer a collection using {@link MoreCollectors#toOptional()} over more contrived alternatives. */ - // XXX: Consider creating a plugin which flags/discourages `Mono>` method return + // XXX: Consider creating a plugin that flags/discourages `Mono>` method return // types, just as we discourage nullable `Boolean`s and `Optional`s. static final class MonoCollectToOptional { @BeforeTemplate diff --git a/error-prone-contrib/src/main/java/tech/picnic/errorprone/refastertemplates/TestNGToAssertJTemplates.java b/error-prone-contrib/src/main/java/tech/picnic/errorprone/refastertemplates/TestNGToAssertJTemplates.java index 4c9e79dd77..23f36f7865 100644 --- a/error-prone-contrib/src/main/java/tech/picnic/errorprone/refastertemplates/TestNGToAssertJTemplates.java +++ b/error-prone-contrib/src/main/java/tech/picnic/errorprone/refastertemplates/TestNGToAssertJTemplates.java @@ -30,7 +30,7 @@ import org.testng.Assert.ThrowingRunnable; /** - * Refaster templates which replace TestNG assertions with equivalent AssertJ assertions. + * Refaster templates that replace TestNG assertions with equivalent AssertJ assertions. * *

Some of the classes below have TestNG {@code @BeforeTemplate}s that reference wildcard type * bounds ({@code }), while the associated AssertJ {@code @AfterTemplate}s reference stricter @@ -39,9 +39,9 @@ * the appropriate (more specific) types _will_ be inferred properly when plugged into AssertJ's * API. * - *

The following is an example of a TestNG statement which would not be rewritten if it weren't + *

The following is an example of a TestNG statement, which would not be rewritten if it weren't * for the wildcard matching (note that the type parameters of the map on the right-hand side will - * be inferred to be {@code } rather than {@code }.) + * be inferred to be {@code } rather than {@code }). * *

{@code
  * List> myMaps = new ArrayList<>();
diff --git a/error-prone-contrib/src/test/java/tech/picnic/errorprone/bugpatterns/util/MethodMatcherFactoryTest.java b/error-prone-contrib/src/test/java/tech/picnic/errorprone/bugpatterns/util/MethodMatcherFactoryTest.java
index 7bd24f2f9a..782b5f77c9 100644
--- a/error-prone-contrib/src/test/java/tech/picnic/errorprone/bugpatterns/util/MethodMatcherFactoryTest.java
+++ b/error-prone-contrib/src/test/java/tech/picnic/errorprone/bugpatterns/util/MethodMatcherFactoryTest.java
@@ -16,7 +16,7 @@
 import org.junit.jupiter.api.Test;
 
 final class MethodMatcherFactoryTest {
-  /** A {@link BugChecker} which flags method invocations matched by {@link #TEST_MATCHER}. */
+  /** A {@link BugChecker} that flags method invocations matched by {@link #TEST_MATCHER}. */
   @BugPattern(severity = SUGGESTION, summary = "Flags methods matched by the test matcher.")
   public static final class MatchedMethodsFlagger extends BugChecker
       implements MethodInvocationTreeMatcher {
diff --git a/pom.xml b/pom.xml
index 16fd4cb465..4cc3ba96f6 100644
--- a/pom.xml
+++ b/pom.xml
@@ -159,7 +159,7 @@
         
@@ -1320,7 +1320,7 @@
             
         
         
-            
             non-maven-central
             
@@ -1507,7 +1507,7 @@
             
         
         
-            
diff --git a/refaster-compiler/pom.xml b/refaster-compiler/pom.xml
index 62be4b6a2b..049521617d 100644
--- a/refaster-compiler/pom.xml
+++ b/refaster-compiler/pom.xml
@@ -11,7 +11,7 @@
     refaster-compiler
 
     Picnic :: Error Prone Support :: Refaster Compiler
-    Java compiler plugin which identifies and compiles Refaster templates, storing them as resource files on the classpath.
+    A Java compiler plugin that identifies and compiles Refaster templates, storing them as resource files on the classpath.
 
     
         
diff --git a/refaster-compiler/src/main/java/tech/picnic/errorprone/refaster/plugin/RefasterRuleCompiler.java b/refaster-compiler/src/main/java/tech/picnic/errorprone/refaster/plugin/RefasterRuleCompiler.java
index a251ce3597..c78593e4bc 100644
--- a/refaster-compiler/src/main/java/tech/picnic/errorprone/refaster/plugin/RefasterRuleCompiler.java
+++ b/refaster-compiler/src/main/java/tech/picnic/errorprone/refaster/plugin/RefasterRuleCompiler.java
@@ -6,7 +6,7 @@
 import com.sun.tools.javac.api.BasicJavacTask;
 
 /**
- * A variant of {@code com.google.errorprone.refaster.RefasterRuleCompiler} which outputs a {@code
+ * A variant of {@code com.google.errorprone.refaster.RefasterRuleCompiler} that outputs a {@code
  * fully/qualified/Class.refaster} file for each compiled {@code fully.qualified.Class} that
  * contains a Refaster template.
  */
diff --git a/refaster-compiler/src/main/java/tech/picnic/errorprone/refaster/plugin/RefasterRuleCompilerTaskListener.java b/refaster-compiler/src/main/java/tech/picnic/errorprone/refaster/plugin/RefasterRuleCompilerTaskListener.java
index aed8fd68d8..e2940b1422 100644
--- a/refaster-compiler/src/main/java/tech/picnic/errorprone/refaster/plugin/RefasterRuleCompilerTaskListener.java
+++ b/refaster-compiler/src/main/java/tech/picnic/errorprone/refaster/plugin/RefasterRuleCompilerTaskListener.java
@@ -34,7 +34,7 @@
 import javax.tools.StandardLocation;
 
 /**
- * A variant of {@code com.google.errorprone.refaster.RefasterRuleCompilerAnalyzer} which stores
+ * A variant of {@code com.google.errorprone.refaster.RefasterRuleCompilerAnalyzer} that stores
  * compiled Refaster rules in a {@code .refaster} file next to the compiled {@code .class} file,
  * rather than at a fixed location.
  *
diff --git a/refaster-compiler/src/main/java/tech/picnic/errorprone/refaster/plugin/package-info.java b/refaster-compiler/src/main/java/tech/picnic/errorprone/refaster/plugin/package-info.java
index 2134c5502b..7a5be8d1f6 100644
--- a/refaster-compiler/src/main/java/tech/picnic/errorprone/refaster/plugin/package-info.java
+++ b/refaster-compiler/src/main/java/tech/picnic/errorprone/refaster/plugin/package-info.java
@@ -1,5 +1,5 @@
 /**
- * A Java compiler plugin which identifies and compiles Refaster templates, storing them as resource
+ * A Java compiler plugin that identifies and compiles Refaster templates, storing them as resource
  * files on the classpath.
  */
 @com.google.errorprone.annotations.CheckReturnValue
diff --git a/refaster-runner/src/main/java/tech/picnic/errorprone/refaster/runner/Refaster.java b/refaster-runner/src/main/java/tech/picnic/errorprone/refaster/runner/Refaster.java
index b6e7d19600..118475dbea 100644
--- a/refaster-runner/src/main/java/tech/picnic/errorprone/refaster/runner/Refaster.java
+++ b/refaster-runner/src/main/java/tech/picnic/errorprone/refaster/runner/Refaster.java
@@ -37,7 +37,7 @@
 import java.util.stream.Stream;
 
 /**
- * A {@link BugChecker} which flags code which can be simplified using Refaster templates located on
+ * A {@link BugChecker} that flags code that can be simplified using Refaster templates located on
  * the classpath.
  *
  * 

This checker locates all {@code *.refaster} classpath resources and assumes they contain a @@ -98,9 +98,9 @@ public Description matchCompilationUnit(CompilationUnitTree tree, VisitorState s * Reports a subset of the given matches, such that no two reported matches suggest a replacement * of the same part of the source code. * - *

In the common case all matches will be reported. In case of overlap the match which replaces + *

In the common case all matches will be reported. In case of overlap the match that replaces * the largest piece of source code is preferred. In case two matches wish to replace exactly the - * same piece of code, preference is given to the match which suggests the shortest replacement. + * same piece of code, preference is given to the match that suggests the shortest replacement. */ // XXX: This selection logic solves an issue described in // https://github.com/google/error-prone/issues/559. Consider contributing it back upstream. diff --git a/refaster-support/src/test/java/tech/picnic/errorprone/refaster/util/IsArrayTest.java b/refaster-support/src/test/java/tech/picnic/errorprone/refaster/util/IsArrayTest.java index 847ca0931f..3b78d3e06f 100644 --- a/refaster-support/src/test/java/tech/picnic/errorprone/refaster/util/IsArrayTest.java +++ b/refaster-support/src/test/java/tech/picnic/errorprone/refaster/util/IsArrayTest.java @@ -48,7 +48,7 @@ void matches() { .doTest(); } - /** A {@link BugChecker} which simply delegates to {@link IsArray}. */ + /** A {@link BugChecker} that simply delegates to {@link IsArray}. */ @BugPattern(summary = "Flags expressions matched by `IsArray`", severity = ERROR) public static final class MatcherTestChecker extends AbstractMatcherTestChecker { private static final long serialVersionUID = 1L; diff --git a/refaster-support/src/test/java/tech/picnic/errorprone/refaster/util/IsCharacterTest.java b/refaster-support/src/test/java/tech/picnic/errorprone/refaster/util/IsCharacterTest.java index 247e1a3f89..d4534f227e 100644 --- a/refaster-support/src/test/java/tech/picnic/errorprone/refaster/util/IsCharacterTest.java +++ b/refaster-support/src/test/java/tech/picnic/errorprone/refaster/util/IsCharacterTest.java @@ -48,7 +48,7 @@ void matches() { .doTest(); } - /** A {@link BugChecker} which simply delegates to {@link IsCharacter}. */ + /** A {@link BugChecker} that simply delegates to {@link IsCharacter}. */ @BugPattern(summary = "Flags expressions matched by `IsCharacter`", severity = ERROR) public static final class MatcherTestChecker extends AbstractMatcherTestChecker { private static final long serialVersionUID = 1L; diff --git a/refaster-support/src/test/java/tech/picnic/errorprone/refaster/util/ThrowsCheckedExceptionTest.java b/refaster-support/src/test/java/tech/picnic/errorprone/refaster/util/ThrowsCheckedExceptionTest.java index 789e16c1e3..66811cb9e5 100644 --- a/refaster-support/src/test/java/tech/picnic/errorprone/refaster/util/ThrowsCheckedExceptionTest.java +++ b/refaster-support/src/test/java/tech/picnic/errorprone/refaster/util/ThrowsCheckedExceptionTest.java @@ -79,7 +79,7 @@ void matches() { .doTest(); } - /** A {@link BugChecker} which simply delegates to {@link ThrowsCheckedException}. */ + /** A {@link BugChecker} that simply delegates to {@link ThrowsCheckedException}. */ @BugPattern(summary = "Flags expressions matched by `ThrowsCheckedException`", severity = ERROR) public static final class MatcherTestChecker extends AbstractMatcherTestChecker { private static final long serialVersionUID = 1L;