google / error-prone

Catch common Java mistakes as compile-time errors
https://errorprone.info
Apache License 2.0
6.86k stars 744 forks source link

Cannot combine scanner suppliers with different implementations of 'DefaultLocale': com.palantir.baseline.errorprone.DefaultLocale, com.google.errorprone.bugpatterns.DefaultLocale #4560

Closed hugoncosta closed 2 months ago

hugoncosta commented 2 months ago

Hello,

We're trying to update our internal usage of error-prone to 2.31.0 and all of the projects where both https://github.com/palantir/palantir-java-format and error-prone work are failing:

[javac]      An exception has occurred in the compiler (21.0.4). Please file a bug against the Java compiler via the Java bug reporting page (https://bugreport.java.com/) after checking the Bug Database (https://bugs.java.com/) for duplicates. Include your program, the following diagnostic, and the parameters passed to the Java compiler in your report. Thank you.
[javac]      java.lang.AssertionError: java.lang.IllegalArgumentException: Cannot combine scanner suppliers with different implementations of 'DefaultLocale': com.palantir.baseline.errorprone.DefaultLocale, com.google.errorprone.bugpatterns.DefaultLocale
[javac]          at com.google.errorprone.ErrorProneAnalyzer.lambda$scansPlugins$2(ErrorProneAnalyzer.java:159)
[javac]          at com.google.common.base.Suppliers$NonSerializableMemoizingSupplier.get(Suppliers.java:186)
[javac]          at com.google.errorprone.ErrorProneAnalyzer.finished(ErrorProneAnalyzer.java:227)
[javac]          at jdk.compiler/com.sun.tools.javac.api.MultiTaskListener.finished(MultiTaskListener.java:133)
[javac]          at jdk.compiler/com.sun.tools.javac.main.JavaCompiler.flow(JavaCompiler.java:1436)
[javac]          at jdk.compiler/com.sun.tools.javac.main.JavaCompiler.flow(JavaCompiler.java:1383)
[javac]          at jdk.compiler/com.sun.tools.javac.main.JavaCompiler.compile(JavaCompiler.java:963)
[javac]          at jdk.compiler/com.sun.tools.javac.main.Main.compile(Main.java:319)
[javac]          at jdk.compiler/com.sun.tools.javac.main.Main.compile(Main.java:178)
[javac]          at jdk.compiler/com.sun.tools.javac.Main.compile(Main.java:64)
[javac]          at jdk.compiler/com.sun.tools.javac.Main.main(Main.java:50)
[javac]      Caused by: java.lang.IllegalArgumentException: Cannot combine scanner suppliers with different implementations of 'DefaultLocale': com.palantir.baseline.errorprone.DefaultLocale, com.google.errorprone.bugpatterns.DefaultLocale
[javac]          at com.google.errorprone.scanner.ScannerSupplier.lambda$plus$13(ScannerSupplier.java:262)
[javac]          at com.google.common.collect.RegularImmutableBiMap.forEach(RegularImmutableBiMap.java:171)
[javac]          at com.google.errorprone.scanner.ScannerSupplier.plus(ScannerSupplier.java:256)
[javac]          at com.google.errorprone.ErrorPronePlugins.loadPlugins(ErrorPronePlugins.java:51)
[javac]          at com.google.errorprone.ErrorProneAnalyzer.lambda$scansPlugins$2(ErrorProneAnalyzer.java:152)
[javac]          ... 10 more
[javac]      printing javac parameters to: /local/p4clients/pkgbuild-const/workspace/src/ACSStoreDetailsRestrictionJavaClient/javac.20240902_064006.args

I see that this DefaultLocale was released with 2.30.0 in https://github.com/google/error-prone/commit/996d09cf2ed8e1b753fde897bb7d643fcc7514af.

What strategy would you recommend us to take here?

hugoncosta commented 2 months ago

Need to combine this upgrade with com.palantir.baseline:baseline-error-prone:2.62.0+ where Palantir removes their implementation of DefaultLocale - https://github.com/palantir/gradle-baseline/pull/2839