Skip to content

Turbine header compile issue with annotations #15053

@guw

Description

@guw

Description of the problem:

When compile some Java code with Bazel and JDK 11 I receive the following error:

ERROR: ../BUILD.bazel: Compiling Java headers abc/libabc-hjar.jar (20000 source files, 12 source jars) and running annotation processors (MyCustomGenerator) failed: (Exit 1): java failed: error executing command external/local_jdk/bin/java -XX:-CompactStrings '--add-exports=jdk.compiler/com.sun.tools.javac.api=ALL-UNNAMED' '--add-exports=jdk.compiler/com.sun.tools.javac.main=ALL-UNNAMED' ... (remaining 18 arguments skipped)

Use --sandbox_debug to see verbose messages from the sandbox
abc/java/src/my/rest/api/MyPathHereClass.java:35: error: invalid annotation argument
            @Response(status = HttpStatus.SC_BAD_REQUEST, schema = ErrorResource.ErrorInfo[].class),
                                                          ^
Target //... failed to build

Bugs: what's the simplest, easiest way to reproduce this bug? Please provide a minimal example if possible.

See google/turbine#221.

The Turbine parser isn't able to handle SomeClass[].class as value assignment in an annotation.

What operating system are you running Bazel on?

macOS

What's the output of bazel info release?

release 5.0.0

Any other information, logs, or outputs that you want to share?

This code base is regularly compiled with JDT. For this I am using the JDT Toolchain:
https://github.com/salesforce/bazel-jdt-java-toolchain/releases/tag/0.0.4

The command line is:

/var/tmp/.../process-wrapper
'--timeout=0'
'--kill_delay=15'
external/local_jdk/bin/java
-XX:-CompactStrings
'--add-exports=jdk.compiler/com.sun.tools.javac.api=ALL-UNNAMED'
'--add-exports=jdk.compiler/com.sun.tools.javac.main=ALL-UNNAMED'
'--add-exports=jdk.compiler/com.sun.tools.javac.model=ALL-UNNAMED'
'--add-exports=jdk.compiler/com.sun.tools.javac.parser=ALL-UNNAMED'
'--add-exports=jdk.compiler/com.sun.tools.javac.processing=ALL-UNNAMED'
'--add-exports=jdk.compiler/com.sun.tools.javac.resources=ALL-UNNAMED'
'--add-exports=jdk.compiler/com.sun.tools.javac.tree=ALL-UNNAMED'
'--add-exports=jdk.compiler/com.sun.tools.javac.util=ALL-UNNAMED'
'--add-opens=jdk.compiler/com.sun.tools.javac.code=ALL-UNNAMED'
'--add-opens=jdk.compiler/com.sun.tools.javac.comp=ALL-UNNAMED'
'--add-opens=jdk.compiler/com.sun.tools.javac.file=ALL-UNNAMED'
'--add-opens=java.base/java.nio=ALL-UNNAMED'
'--add-opens=java.base/java.lang=ALL-UNNAMED'
'--patch-module=java.compiler=external/remote_java_tools/java_tools/java_compiler.jar'
'--patch-module=jdk.compiler=external/remote_java_tools/java_tools/jdk_compiler.jar'
-XX:+UseParallelOldGC
-jar
external/remote_java_tools/java_tools/turbine_direct_binary_deploy.jar
@bazel-out/darwin-fastbuild/bin/abc/libabc-hjar.jar-0.params
@bazel-out/darwin-fastbuild/bin/abc/libabc-hjar.jar-1.params

Metadata

Metadata

Assignees

No one assigned

    Labels

    P3We're not considering working on this, but happy to review a PR. (No assignee)not staleIssues or PRs that are inactive but not considered staleteam-Rules-JavaIssues for Java rulestype: bug

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions