diff --git a/error-prone-contrib/README.md b/error-prone-contrib/README.md index a9eddf26576..db63ff439dc 100644 --- a/error-prone-contrib/README.md +++ b/error-prone-contrib/README.md @@ -97,7 +97,7 @@ The following is a list of checks we'd like to see implemented: `java.util.stream.Collectors` and the various Guava collector factory methods. - A check which replaces `new Random().someMethod()` calls with - `ThreadLocalRandom.current().someMethod()` calls, so as to avoid unnecessary + `ThreadLocalRandom.current().someMethod()` calls, to avoid unnecessary synchronization. - A check which drops `this.` from `this.someMethod()` calls and which optionally does the same for fields, if no ambiguity arises. @@ -214,7 +214,7 @@ Refaster's expressiveness: 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. + `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. @@ -241,20 +241,17 @@ Refaster's expressiveness: example would be to rewrite `BigDecimal.valueOf("")` to `BigDecimal.valueOf(theParsedLongValue)`. - More generally, investigate ways to plug in fully dynamic behavior, e.g. - by providing hooks which enable plugging in arbitrary predicates/transformations. - The result would be a Refaster/`BugChecker` hybrid. A feature such as this - could form the basis for many other features listed here. (As a - concrete example, consider the ability to reference - `com.google.errorprone.matchers.Matcher` implementations.) -- Provide a way to match lambda expressions and method references which match a - specified functional interface. This would allow rewrites such as - `Mono.fromCallable(this::doesNotThrowCheckException)` -> - `Mono.fromSupplier(this::doesNotThrowCheckException)`. -- Provide an extension API which enables defining methods or expressions based on - functional properties. A motivating example is the Java Collections + by providing hooks which enable plugging in arbitrary predicates/ + transformations. + The result would be a Refaster/`BugChecker` hybrid. A feature like this could + form the basis for many other features listed here. (As a concrete example, + consider the ability to reference `com.google.errorprone.matchers.Matcher` + implementations.) +- Provide an extension API that enables defining methods or expressions based + on functional properties. A motivating example is the Java Collections framework, which allows many ways to define (im)mutable (un)ordered collections with(out) duplicates. One could then express things like "match - any method call which collects its inputs into an immutable ordered list". An + any method call that collects its inputs into an immutable ordered list". An enum analogous to `java.util.stream.Collector.Characteristics` could be used. Out of the box JDK and Guava collection factory methods could be classified, with the user having the option to extend the classification. @@ -262,7 +259,7 @@ Refaster's expressiveness: Provide two additional modes: (a) match and drop the comments or (b) transport the comments to before/after the replaced expression. - Extend Refaster to drop imports that become unnecessary as a result of a - refactoring. This e.g. allows one to replace a statically import TestNG + refactoring. This e.g. allows one to replace a statically imported TestNG `fail(...)` invocation with a statically imported equivalent AssertJ `fail(...)` invocation. (Observe that without an import cleanup this replacement would cause a compilation error.) @@ -270,7 +267,7 @@ Refaster's expressiveness: methods. For a motivating example see google/error-prone#568. - When matching explicit type references, also match super types. For a motivating example, see the two subtly different loop definitions in - `CollectionRemoveAllFromCollectionBlock`. + `CollectionRemoveAllFromCollectionExpression`. - Figure out why Refaster sometimes doesn't match the correct generic overload. See the `AssertThatIterableHasOneComparableElementEqualTo` template for an example.