RFR: 8297455: Use the official ToolProvider API to call javac

Erik Joelsson erikj at openjdk.org
Fri Dec 2 13:42:15 UTC 2022


On Thu, 1 Dec 2022 23:21:30 GMT, Magnus Ihse Bursie <ihse at openjdk.org> wrote:

> I have now verified that the interim compiler is indeed used (made it say bad words and fail at startup, so there is no doubt about it :)). As to the reason why this is so, here is the magic incantation from `$(INTERIM_LANGTOOLS_ARGS)`:
> 
> ```
>     --limit-modules java.base,jdk.zipfs,$(INTERIM_LANGTOOLS_MODULES_COMMA) \
>     --add-modules $(INTERIM_LANGTOOLS_MODULES_COMMA) \
>     --module-path $(BUILDTOOLS_OUTPUTDIR)/interim_langtools_modules \
>     --patch-module java.base=$(BUILDTOOLS_OUTPUTDIR)/gensrc/java.base.interim \
>     --add-exports java.base/sun.reflect.annotation=jdk.compiler.interim \
>     --add-exports java.base/jdk.internal.jmod=jdk.compiler.interim \
>     --add-exports java.base/jdk.internal.misc=jdk.compiler.interim \
>     --add-exports java.base/sun.invoke.util=jdk.compiler.interim \
>     --add-exports java.base/jdk.internal.javac=java.compiler.interim \
>     --add-exports java.base/jdk.internal.javac=jdk.compiler.interim \
> ```
> 
> I hope you are not asking me to explain in detail how or why this works. :-)

Thanks! Yeah, that rings a bell and I think I understand how it works, but I surely wouldn't be able to replicate this from memory.

-------------

PR: https://git.openjdk.org/jdk/pull/11299


More information about the compiler-dev mailing list