The main feature of toolchain_vanilla definition is to support newer
Java language versions that the embedded JDK, e.g.: at the time of this
change, toolchain_java could be used to support building with JDK 13 and
produce byte code major version 57, using the combination of absolute
javabase and toolchain_vanilla:
$ bazel build --define=ABSOLUTE_JAVABASE=/use/local/bin/jdk-13 \
--javabase=@bazel_tools//tools/jdk:absolute_javabase \
--host_javabase=@bazel_tools//tools/jdk:absolute_javabase \
--host_java_toolchain=@bazel_tools//tools/jdk:toolchain_vanilla \
--java_toolchain=@bazel_tools//tools/jdk:toolchain_vanilla \
:gerrit
Unfortunately, [1] sets source and target language levels to Java 8 to
restore backwards compatibility, to fix a regression, that was
introduced during upgrade of remote JDK version to Java 11, in: [2].
This change restores the neutrality of toolchain_vanilla declaration by
unsetting source and target language level versions. So that the bazel
invocation in the example above produces byte code major version 57
(Java 13), and not 52 (Java 8) as it is the case before this change.
Also add a TODO, to remove the workaround, when this issue is fixed:
[3].
[1] 6ef6d879ab
[2] bad5a2beb9
[3] https://github.com/bazelbuild/bazel/issues/9415
Bug: Issue 11571
Change-Id: I721067202de744883bc8c74bb4106ad08f19c66d