diff --git a/error-prone-contrib/src/main/java/tech/picnic/errorprone/bugpatterns/IsInstanceLambdaUsage.java b/error-prone-contrib/src/main/java/tech/picnic/errorprone/bugpatterns/IsInstanceLambdaUsage.java index 21ff02436a..5c9ed225d5 100644 --- a/error-prone-contrib/src/main/java/tech/picnic/errorprone/bugpatterns/IsInstanceLambdaUsage.java +++ b/error-prone-contrib/src/main/java/tech/picnic/errorprone/bugpatterns/IsInstanceLambdaUsage.java @@ -23,10 +23,9 @@ /** * A {@link BugChecker} that flags lambda expressions that can be replaced with a method reference * of the form {@code T.class::isInstance}. - * - * @see MethodReferenceUsage */ -// XXX: Consider folding this logic into the `MethodReferenceUsage` check. +// XXX: Consider folding this logic into the `MethodReferenceUsage` check of the +// `error-prone-experimental` module. @AutoService(BugChecker.class) @BugPattern( summary = "Prefer `Class::isInstance` method reference over equivalent lambda expression", diff --git a/error-prone-experimental/README.md b/error-prone-experimental/README.md new file mode 100644 index 0000000000..792297be8b --- /dev/null +++ b/error-prone-experimental/README.md @@ -0,0 +1,6 @@ +# Experimental Error Prone checks + +This module contains Error Prone checks that are currently under development or +evaluation. These checks may be works-in-progress or have uncertain impact on +code. Having this module allows for controlled experimentation and refinement +before integration into production environments. diff --git a/error-prone-experimental/pom.xml b/error-prone-experimental/pom.xml new file mode 100644 index 0000000000..e9607b2164 --- /dev/null +++ b/error-prone-experimental/pom.xml @@ -0,0 +1,61 @@ + + + 4.0.0 + + + tech.picnic.error-prone-support + error-prone-support + 0.14.1-SNAPSHOT + + + error-prone-experimental + + Picnic :: Error Prone Support :: Experimental + Experimental Error Prone checks. + https://error-prone.picnic.tech + + + + ${groupId.error-prone} + error_prone_annotation + provided + + + ${groupId.error-prone} + error_prone_check_api + provided + + + ${groupId.error-prone} + error_prone_test_helpers + provided + + + ${project.groupId} + error-prone-utils + provided + + + com.google.auto.service + auto-service-annotations + provided + + + com.google.guava + guava + provided + + + org.junit.jupiter + junit-jupiter-api + provided + + + + org.junit.jupiter + junit-jupiter-engine + test + + + diff --git a/error-prone-contrib/src/main/java/tech/picnic/errorprone/bugpatterns/MethodReferenceUsage.java b/error-prone-experimental/src/main/java/tech/picnic/errorprone/experimental/bugpatterns/MethodReferenceUsage.java similarity index 98% rename from error-prone-contrib/src/main/java/tech/picnic/errorprone/bugpatterns/MethodReferenceUsage.java rename to error-prone-experimental/src/main/java/tech/picnic/errorprone/experimental/bugpatterns/MethodReferenceUsage.java index 4123d02f1e..8795235faf 100644 --- a/error-prone-contrib/src/main/java/tech/picnic/errorprone/bugpatterns/MethodReferenceUsage.java +++ b/error-prone-experimental/src/main/java/tech/picnic/errorprone/experimental/bugpatterns/MethodReferenceUsage.java @@ -1,4 +1,4 @@ -package tech.picnic.errorprone.bugpatterns; +package tech.picnic.errorprone.experimental.bugpatterns; import static com.google.common.collect.ImmutableList.toImmutableList; import static com.google.errorprone.BugPattern.LinkType.CUSTOM; @@ -37,8 +37,6 @@ /** * A {@link BugChecker} that flags lambda expressions that can be replaced with method references. - * - * @see IsInstanceLambdaUsage */ // XXX: Other custom expressions we could rewrite: // - `a -> "str" + a` to `"str"::concat`. But only if `str` is provably non-null. @@ -54,7 +52,8 @@ // Palantir's `LambdaMethodReference` check seems to suffer a similar issue at this time. // XXX: Expressions of the form `i -> SomeType.class.isInstance(i)` are not replaced; fix that using // a suitable generalization. -// XXX: Consider folding the `IsInstanceLambdaUsage` check into this class. +// XXX: Consider folding the `IsInstanceLambdaUsage` check of the `error-prone-contrib` module into +// this class. @AutoService(BugChecker.class) @BugPattern( summary = "Prefer method references over lambda expressions", diff --git a/error-prone-contrib/src/test/java/tech/picnic/errorprone/bugpatterns/MethodReferenceUsageTest.java b/error-prone-experimental/src/test/java/tech/picnic/errorprone/experimental/bugpatterns/MethodReferenceUsageTest.java similarity index 99% rename from error-prone-contrib/src/test/java/tech/picnic/errorprone/bugpatterns/MethodReferenceUsageTest.java rename to error-prone-experimental/src/test/java/tech/picnic/errorprone/experimental/bugpatterns/MethodReferenceUsageTest.java index ca583d92e6..1d53e6709c 100644 --- a/error-prone-contrib/src/test/java/tech/picnic/errorprone/bugpatterns/MethodReferenceUsageTest.java +++ b/error-prone-experimental/src/test/java/tech/picnic/errorprone/experimental/bugpatterns/MethodReferenceUsageTest.java @@ -1,4 +1,4 @@ -package tech.picnic.errorprone.bugpatterns; +package tech.picnic.errorprone.experimental.bugpatterns; import com.google.errorprone.BugCheckerRefactoringTestHelper; import com.google.errorprone.BugCheckerRefactoringTestHelper.TestMode; diff --git a/pom.xml b/pom.xml index 34a87297d4..ff01146798 100644 --- a/pom.xml +++ b/pom.xml @@ -41,6 +41,7 @@ documentation-support error-prone-contrib + error-prone-experimental error-prone-utils refaster-compiler refaster-runner @@ -256,6 +257,11 @@ error-prone-contrib ${project.version} + + ${project.groupId} + error-prone-experimental + ${project.version} + ${project.groupId} error-prone-utils @@ -1607,6 +1613,11 @@ error-prone-contrib ${project.version} + + ${project.groupId} + error-prone-experimental + ${project.version} + ${project.groupId} refaster-runner