Allow specification of an alternate javac location.

Review Request #4124 - Created July 26, 2016 and submitted

Information
Benjy Weinberger
pants
3722
Reviewers
pants-reviews
stuhood, zundel

Currently we always use the javac embedded in the JDK Zinc runs on.

This change supports experimenting with unreleased compiler versions
without having to use an unreleased, and possibly unstable, runtime.

Specifically, this allows running the (relatively stable but still unreleased)
javac 9 compiler on a Java 8 runtime, something that Bazel currently supports.

Note that this change also removes the explicit adding of tools.jar to the classpath,
since Zinc does this anyway (via javax.tools.ToolProvider.getSystemJavaCompiler) if
it doesn't find a compiler on the bootclasspath.

Note also that this does not support introducing alternate entry points
(such as would be required to use errorprone). The entry point must still
be com.sun.tools.javac.api.JavacTool. All this change does is allow that
class to be loaded from somewhere outside the JDK's tools.jar.

Supporting alternate entry points will require changing how Zinc locates
the JavaCompiler implementation it uses. As mentioned above, it currently
delegates to javax.tools.ToolProvider.getSystemJavaCompiler, which locates
com.sun.tools.javac.api.JavacTool. But it would be pretty easy to add
a flag to zinc that names some other implementer of JavaCompiler to load.

This change also:
- Removes a comment that was obsoleted long ago, in b15a7cbb to be precise.

- Fixes a couple of references to a non-public member of a base class.

CI passes: https://travis-ci.org/pantsbuild/pants/builds/147580570

Eric Ayers
Stu Hood
Benjy Weinberger
Benjy Weinberger
Review request changed

Status: Closed (submitted)

Change Summary:

71b7bdf0cc5765e26e2cdeef1731b7391628cddd

Loading...