Skip to content

Removing error-prone from our build #2745

@nedtwigg

Description

@nedtwigg

We have recently merged a ton of automated refactors, I believe some by OpenRewrite and some by error-prone. Right now we have:

  • spotless
  • spotbugs
  • errorprone
  • openrewrite

We just received an excellent PR tackling a very hard and long-requested feature:

It failed CI. I took a look and

* What went wrong:
Execution failed for task ':lib:compileJavaParserJava'.
> Compilation failed; see the compiler output below.
  /Users/ntwigg/Documents/dev/spotless/lib/src/javaParser/java/com/diffplug/spotless/glue/javaParser/ExpandWildcardsFormatterFunc.java:95: error: [CollectorMutability] Avoid `Collectors.to{List,Map,Set}` in favor of collectors that emphasize (im)mutability
                                .collect(toMap(Function.identity(),
                                              ^
      (see https://error-prone.picnic.tech/bugpatterns/CollectorMutability)
    Did you mean '.collect(toImmutableMap(Function.identity(),' or 't -> new TreeSet<>(Comparator.comparing(ImportDeclaration::getNameAsString)), (a, b) -> { throw new IllegalStateException(); }, HashMap::new));'?
  1 error

I like immutability, but the warning above is not easy to fix. We don't have guava, toMap is a good choice here.

@Pankraz76 The feature in the PR is more important than the rule-check. When rule-checking is consuming more reviewer time than actual PRs, something is wrong. For this reason, I removed error-prone fom the build in the above-mentioned PR.

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions