Skip to content
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

Turbine: error: missing required annotation argument: <clinit> #13758

Closed
mskonovalov opened this issue Jul 27, 2021 · 11 comments
Closed

Turbine: error: missing required annotation argument: <clinit> #13758

mskonovalov opened this issue Jul 27, 2021 · 11 comments
Assignees
Labels
P2 We'll consider working on this in future. (Assignee optional) team-Rules-Java Issues for Java rules

Comments

@mskonovalov
Copy link

mskonovalov commented Jul 27, 2021

Description of the problem / feature request:

Have a java + spring target that builds successfully but fails during Intellij sync.

Server.java:56: error: missing required annotation argument: <clinit>
@CrossOrigin(
^

I was able to checkout turbine and reproduce the bahavior - it works on latest master of turbine.
It seems this has been fixed in turbine 5 month ago google/turbine@617a8f6 but bazel still has the old version of turbine.

What operating system are you running Bazel on?

MacOs, Linux

What's the output of bazel info release?

release 4.1.0- (@non-git)

If bazel info release returns "development version" or "(@Non-Git)", tell us how you built Bazel.

from nix

Have you found anything relevant by searching the web?

https://stackoverflow.com/questions/45656877/crossorigin-annotation-doesnt-compile
google/turbine@617a8f6

@aiuto aiuto added team-OSS Issues for the Bazel OSS team: installation, release processBazel packaging, website untriaged labels Jul 28, 2021
@aiuto
Copy link
Contributor

aiuto commented Jul 28, 2021

This seems like just updating the third_party dependency will fix it.

@mskonovalov
Copy link
Author

I hope it should. What is the process around this?

@aiuto
Copy link
Contributor

aiuto commented Jul 28, 2021

Someone on the bazel team has to update things in //third_party.
It has the appropriate label, so the right people should pick it up in their triage.

@cushon
Copy link
Contributor

cushon commented Jul 30, 2021

cc @comius

The turbine fix made it into java_tools v11.2 per #13144 (comment), this will be fixed in Bazel 4.2

@twheys
Copy link

twheys commented Aug 20, 2021

I was running into this issue on Bazel 4.1.0. Just tried upgrading to Bazel 4.2.0 and I still have the issue. Was this maybe missed? Does anyone know if there's a work-around for the time being?

@cushon
Copy link
Contributor

cushon commented Aug 20, 2021

@comius did the java_tools update not make it into 4.2.0?

@twheys does adding this to your WORKSPACE to update to the latest java_tools version make a difference? https://github.com/bazelbuild/java_tools/releases/tag/java_v11.3

@twheys
Copy link

twheys commented Aug 24, 2021

Hi @cushon - I tried adding the java_tools 11.3 rules to my WORKSPACE file and that results in some errors about missing targets. I tried running bazel clean --expunge to no avail. I am on Bazel 4.2.0

ERROR: /private/var/tmp/_bazel_theys/c47bd7bac752f67cacbe3862d74d80c0/external/bazel_tools/tools/jdk/BUILD:279:28: no such target '@remote_java_tools_darwin//:java_tools/JacocoCoverage_jarjar_deploy.jar': target 'java_tools/JacocoCoverage_jarjar_deploy.jar' not declared in package '' defined by /private/var/tmp/_bazel_theys/c47bd7bac752f67cacbe3862d74d80c0/external/remote_java_tools_darwin/BUILD and referenced by '@bazel_tools//tools/jdk:JacocoCoverageFilegroup'

@philwo philwo added team-Rules-Java Issues for Java rules and removed team-OSS Issues for the Bazel OSS team: installation, release processBazel packaging, website labels Aug 31, 2021
@philwo
Copy link
Member

philwo commented Aug 31, 2021

FYI @comius

@comius
Copy link
Contributor

comius commented Sep 10, 2021

Bazel 4.2.x is using the old Java resolution mechanism, so it has java_tools 10.6. (java_tools 11.x don't work with it).

Since it's a LTS, we should update old java_tools. It requires hand crafting a back-patch.

@comius comius added P2 We'll consider working on this in future. (Assignee optional) and removed untriaged labels Sep 10, 2021
@oliviernotteghem
Copy link

oliviernotteghem commented Oct 1, 2021

4.2.0 lists turbine fix as cherry picked. However, I think it was missed, as the version on 4.2.0 is not right (see below). This probably why folks are still seeing issue on 4.2.x ? cc @comius

EDIT : the JAR checked in are actually not used by bazel binaries. Turbine is pulled instead from java_tools, which are still on 10.6 for bazel 4.2.0, hence don't contain the fix.

Here is the workaround :

  1. Import in your WORKSPACE v11.2 of the java tools (which contains the fix to Turbine)
# Import java tools rules, as it is used by our own java toolchain (to use a patched version of Turbine).
http_archive(
    name = "remote_java_tools",
    sha256 = "b6c468410a371728fe703ef7a6e386bb7f69bb46b900fed0460eb68c54f99895",
    urls = [
            "https://mirror.bazel.build/bazel_java_tools/releases/java/v11.2/java_tools-v11.2.zip",
            "https://github.com/bazelbuild/java_tools/releases/download/java_v11.2/java_tools-v11.2.zip",
    ],
)
  1. Override the version of Turbine used in your toolchain with that version :
java_toolchain(
  .....
  header_compiler = ["@remote_java_tools//:TurbineDirect"],
  header_compiler_direct = ["@remote_java_tools//:TurbineDirect"],
  ....
)

@comius
Copy link
Contributor

comius commented Nov 9, 2021

I made a new release of java_tools v10.7, https://github.com/bazelbuild/java_tools/releases/tag/javac11_v10.7.

This issue should be fixed by including http_archives mentioned in the release notes into the WORKSPACE files (without any need to do custom toolchains). That is if you're on Bazel 4.x.x.

Bazel 5.0.0 should have no such issues.

@comius comius closed this as completed Nov 9, 2021
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
P2 We'll consider working on this in future. (Assignee optional) team-Rules-Java Issues for Java rules
Projects
None yet
Development

No branches or pull requests

7 participants