bazel: `toolchain_vanilla` works with locally defined jdk 11, but `toolchain_java11` breaks the jdk compiler

Description of the problem / feature request:

Building in Java 11 works using toolchain_vanilla, but changing to toolchain_java11 does not compile due to a JDK bug (that should be fixed). Does the toolchain_java11 not use a locally defined host_javabase and javabase?

I assume that the vanilla one is using the local, but does that change to remote if i use toolchain_java11? Is there any way to change this so that I can define the jdk to use in that toolchain?

We define things like this in our .bazelrc:

build --define=ABSOLUTE_JAVABASE=//tools:jdk11
build --javabase=//tools:jdk11
build --host_javabase=//tools:jdk11
build --java_toolchain=@bazel_tools//tools/jdk:toolchain_java11
build --host_java_toolchain=@bazel_tools//tools/jdk:toolchain_java11

The jdk11 we use is this (via an alias)

http_archive(
    name = "jdk11_linux",
    build_file_content = "java_runtime(name = 'runtime', srcs =  glob(['**']), visibility = ['//visibility:public'])",
    sha256 = "3b1c0c34be4c894e64135a454f2d5aaa4bd10aea04ec2fa0c0efe6bb26528e30",
    strip_prefix = "jdk-11.0.13+8",
    urls = ["https://github.com/adoptium/temurin11-binaries/releases/download/jdk-11.0.13%2B8/OpenJDK11U-jdk_x64_linux_hotspot_11.0.13_8.tar.gz"],
)

Feature requests: what underlying problem are you trying to solve with this feature?

Get our build to work.

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

I think that it might have to do with our own giant code base, so it’s not easily reproducible that I’ve found.

What operating system are you running Bazel on?

Linux - Ubuntu 21.04

What’s the output of bazel info release?

release 1.2.1

Have you found anything relevant by searching the web?

Yes, it looks like the bug we are hitting is a bug in the JDK: https://bugs.openjdk.java.net/browse/JDK-8210483

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

(06:53:41) ERROR: XXX/BUILD:5:1: Building XXX-class.jar (2277 source files) and running annotation processors (AnnotationProcessorHider$AnnotationProcessor, AnnotationDependsOnProcessor) failed (Exit 1)
compiler message file broken: key=compiler.misc.msg.bug arguments=11.0.13, {1}, {2}, {3}, {4}, {5}, {6}, {7}
java.lang.AssertionError
	at jdk.compiler/com.sun.tools.javac.util.Assert.error(Assert.java:155)
	at jdk.compiler/com.sun.tools.javac.util.Assert.check(Assert.java:46)
	at jdk.compiler/com.sun.tools.javac.comp.DeferredAttr$2$1.setOverloadKind(

About this issue

  • Original URL
  • State: closed
  • Created 2 years ago
  • Comments: 16 (9 by maintainers)

Commits related to this issue

Most upvoted comments

@cushon Just wanted to follow up and thank you for all of your time and patience 😃

The 11.0.15 release of Java fixes everything for us (with the removal of --patch-module). Thank you!!!