JDK-8156998 : javac should support new option -XinheritRuntimeEnvironment
  • Type: Enhancement
  • Component: tools
  • Sub-Component: javac
  • Affected Version: 9
  • Priority: P3
  • Status: Resolved
  • Resolution: Fixed
  • Submitted: 2016-05-14
  • Updated: 2017-01-25
  • Resolved: 2016-07-20
The Version table provides details related to the release that this issue/RFE will be addressed.

Unresolved : Release in which this issue/RFE will be addressed.
Resolved: Release in which this issue/RFE has been resolved.
Fixed : Release in which this issue/RFE has been fixed. The release containing this fix may be available for download as an Early Access Release or a General Availability Release.

To download the current JDK release, click here.
JDK 9
9Fixed
Related Reports
Relates :  
Relates :  
Relates :  
Description
javac should support a new option to configure the javac compilation environment from the current runtime (execution) environment.

Exact details TBD, but informally, the option has the effect of determining the options specified when starting the enclosing VM, using ProcessHandle.current().info() and applying a subset of those options to javac, such as -addmods, -limitmods, -modulepath, -XaddReads, -XaddExports, -Xpatch, etc.

It is TBD what happens if any of those options conflict with any given explicitly to javac, either before or after the -XinheritRuntimeEnvironment option. Possibilities are: "last on wins", "merge", or "reject".  Of these, "reject" is the simplest, although merge would be reasonable for at least some of the options.
Comments
Option is --inherit-runtime-environment
20-07-2016

ProcessHandle.current().info does not reliably provide access to VM args. (It provides access to the process args, which may or may not be the args to the VM.) It also does not take _JAVA_OPTIONS into account.
19-05-2016