aboutsummaryrefslogtreecommitdiffhomepage
path: root/third_party/java/jdk/README.md
blob: 02c794ae2014012b49c60d680a7cb2235f92f329 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
# Java compilers in Bazel

Bazel compiles Java code using a custom builder. This builder is called
JavaBuilder and its code lies in //src/java_tools/buildjar. To build Java
code, JavaBuilder use the Java compiler from the JDK. To support
[ErrorProne](http://errorprone.info) checks, we vendor a custom build
of the Java compiler code. This is the raw version of the Java compiler
from [OpenJDK](https://openjdk.java.net) but compiled for a lower
version of the JRE. Those builds are vendored in
//third_party/java/jdk/langtools.

Current Bazel supports running on a JRE 8 only because the default Java
compiler used (//third_party/java/jdk/langtools/javac.jar) is the
Java compiler of OpenJDK 9 compiled to run on a JRE 8. This cannot
be built to run on a JRE 7 because of code incompatiblity. Bazel's
JavaBuilder at HEAD cannot be linked with earlier version of the
Java compiler (it depends on some internals of the Java compiler).

To build a version of Bazel that can run on a JRE 7, we need to rely
on the version of JavaBuilder provided with Bazel 0.1.0
(//third_party/java/jdk/javabuilder/JavaBuilder_0.1.0_deploy.jar) which works
with a Java compiler of OpenJDK 8 compiled to run on a JRE 7
(//third_party/java/jdk/langtools/javac7.jar).