Pass OpenJDK 8's bootclasspath for host tools targeting <= 1.8.
Host (as opposed to hostdex) tools compile and run against OpenJDK's core libraries. Before this CL, the core libraries of the default toolchain were always used, even when targeting an earlier language version. This meant that code that uses APIs from a later version of OpenJDK than corresponded to LOCAL_JAVA_LANGUAGE_VERSION would compile, but would fail to run under that earlier version of OpenJDK. It also meant that calls to existing APIs might be reinterpreted; for example, the return type of java.nio.ByteBuffer.clear() changed from Buffer in OpenJDK 8 to ByteBuffer in OpenJDK 9. At compile time, this was noted via the warning: bootstrap class path not set in conjunction with -source 1.8 After this CL, when targeting a language version <= 1.8 (which is always the case when building with OpenJDK 8), some of OpenJDK 8's core library/tools jars are now passed on the bootclasspath. The decision to include the bootclasspath argument when building with OpenJDK 8 was somewhat arbitrary, but has the advantage that we discover any issues before we switch to OpenJDK 9. Even when compiling with OpenJDK 9, use of OpenJDK 9 APIs will now fail at compile time rather than at runtime; calls to existing APIs will now be interpreted in OpenJDK 8 rather than 9 fashion. For example, this means that dx and host-side CTS tests built with OpenJDK 9 javac -target 1.8 will be runnable under OpenJDK 8. Bug: 70521453 Bug: 70862583 Test: Checked that the bootclasspath argument was passed in the javac invocation targeting 1.8 during: make showcommands compatibility-common-util-hostsidelib Test: make checkbuild Change-Id: I9b6081edfdd2c3e9a450ae8a39c4e32c3d2cda92
Loading
Please register or sign in to comment