Open hlawrence-cn opened 1 year ago
This seems like a bug with rules_java, in that it produces a java_binary that's not fully hermetic. We see a similar problem in https://github.com/aspect-build/rules_lint/actions/runs/8483630419/job/23245094613?pr=189 where it fails like
java.lang.NoClassDefFoundError: com/sun/source/tree/Tree
at com.google.googlejavaformat.java.FormatFileCallable.call(FormatFileCallable.java:74)
at com.google.googlejavaformat.java.FormatFileCallable.call(FormatFileCallable.java:29)
at java.base/java.util.concurrent.FutureTask.run(Unknown Source)
at java.base/java.util.concurrent.Executors$RunnableAdapter.call(Unknown Source)
at java.base/java.util.concurrent.FutureTask.run(Unknown Source)
at java.base/java.util.concurrent.ThreadPoolExecutor.runWorker(Unknown Source)
at java.base/java.util.concurrent.ThreadPoolExecutor$Worker.run(Unknown Source)
at java.base/java.lang.Thread.run(Unknown Source)
Caused by: java.lang.ClassNotFoundException: com.sun.source.tree.Tree
at java.base/jdk.internal.loader.BuiltinClassLoader.loadClass(Unknown Source)
at java.base/jdk.internal.loader.ClassLoaders$AppClassLoader.loadClass(Unknown Source)
at java.base/java.lang.ClassLoader.loadClass(Unknown Source)
... 8 more
I'm not sure how this could be a bug in this repo, though maybe there's some workaround flags needed for Java. @bencodes maybe knows?
What happened?
Added a Record file in a java project
When the google java formatter is run directly against the file via a java_binary target, it succeeds
When run via the multi_formatter_binary that consumes that target, we see error: class interface or enum expected
Version
Development (host) and target OS/architectures: Mac
Output of
bazel --version
: bazel 7.0.2Version of the Aspect rules, or other relevant rules from your
WORKSPACE
orMODULE.bazel
file: bazel_dep(name = "aspect_rules_lint", version = "0.10.0") (Also tried 11.0)Language(s) and/or frameworks involved: java
How to reproduce
Any other information?
No response