-
-
Notifications
You must be signed in to change notification settings - Fork 2.4k
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
"warning: Can't force a new processing round. Lombok won't work." with Bazel #1290
Comments
That is correct. Lombok needs multiple processor rounds to do its job. That is uncommon for annotation processors and no API exists for this. But if a new source file is generated, a new round will be triggered. Can you also find the stacktrace that's printed to the error stderr? |
I've opened a ticket with the Bazel folks to try and figure out where the stacktrace is going - it's buried in the logs somewhere and I'm not sure where. Do you know if the trace would be dumped to stdout or stderr? |
I repro'd the error with Bazel, and the log includes:
The type of that field changed in JDK 9: http://hg.openjdk.java.net/jdk9/dev/langtools/annotate/85ff2daae534/src/share/classes/com/sun/tools/javac/code/Symbol.java#l913 It logged two stack traces:
|
I think I've fixed the NPE, and can reproduce the |
Also just fixed the members_field problem. |
Can you test against an edge release? |
Let me take a look right now. |
I only get the one stacktrace (with both the edge release and the other version we were using, which was 1.16.8). At least, one stacktrace per library Lombok tries to build, which given the size of our monorepo, is a lot...but at least the stacktrace is always the same:
|
Are you sure the edge release is being used by all those projects? Can you explain how I can test this using Bazel myself? |
I am reasonably sure the edge release is being used by all of those projects. Each project has a list of deps that are specified like so: java_library(
name = "spinaltap-client",
deps = [
...
"//third_party/plugins:org.projectlombok_lombok",
...
],
srcs = glob(["src/main/java/**/*.java"]),
) In java_library(
name = "org.projectlombok_lombok",
exports = ["//third_party:org.projectlombok_lombok"],
exported_plugins = [":lombok_plugin"],
)
java_plugin(
name = "lombok_plugin",
processor_class = "lombok.launch.AnnotationProcessorHider$AnnotationProcessor",
deps = ["//third_party:org.projectlombok_lombok"],
) This, in turn, points to java_import(
name = "org.projectlombok_lombok",
jars = [
"jars/lombok-edge.jar"
# "jars/org.projectlombok/lombok/1.16.8/2ce9de13f277ec1600e7e04231477e3e5f59d317/lombok-1.16.8.jar"
],
) This would be built using a command like So there isn't really an opportunity for another version of Lombok to sneak in anywhere. It's possible I've managed to screw something up somewhere, so it'd be nice if @cushon could confirm my findings. |
I'm also still seeing the NPE, here's a simpler repro: Install Bazel: https://bazel.build/versions/master/docs/install.html and then:
|
I'm also noticing that the line numbers on my and @cushon's stacktraces line up -- our edge jar stacktrace comes from line 123, and the 1.16.8 stacktrace goes to line 109 |
Any news on this, @rspilker? |
Yeah. the latest edge release added some extra prints to pinpoint the problem. I'll see if I can link the other issue |
See #985 for progress on jdk9 support. |
The newest edge release might give us more insight. Can someone please try it out? See #985 (comment) |
The default Bazel config uses a filemanager that breaks Lombok's assumptions:
Disabling that part of Bazel causes Lombok to fail this way instead:
|
A new edge release might contain the fix. Feedback is welcome. |
That fixed the
|
A new edge release (2017-06-19 22:15:39 UTC) might contain the fix. Feedback is welcome. |
The repro no longer crashes. (I haven't done anything to verify the output is correct.) |
Will be part of 1.16.18, scheduled to be released very soon. |
I started getting the NPE after switching to Java 9.
|
While following the code of @venantius above, the Can anyone help me how to instruct bazel to apply the plugin to a test target? |
I've been running into this issue when building a project with Bazel that uses Lombok for its annotations:
I'm not totally clear what the new processing round error refers to - I had a look at the source code and it looks like it tries to create a temporary file somewhere and fails when that file creation fails. Is that more or less correct?
The text was updated successfully, but these errors were encountered: