Please review the change to support dual mode launcher
Jonathan Gibbons
jonathan.gibbons at oracle.com
Tue Mar 30 08:44:57 PDT 2010
Alan Bateman wrote:
> Mandy Chung wrote:
>> Alan,
>>
>> Can you review this fix?
>>
>> Webrev at:
>> http://cr.openjdk.java.net/~mchung/jigsaw/dual-mode-launcher/
>>
>> The language tools such as javac, javap, and javah needs to access
>> all platform classes. In legacy world, it will access the platform
>> classes from the bootclasspath. However, in modules world, a module
>> can only access classes from its required modules. For example,
>> javap won't be able to access xml module:
>> jdk-module-image/bin/javap javax.xml.XMLConstants
>>
>> So this patch will fix the launcher makefile to build javah and javap
>> to run in legacy mode like javac. When Jon pushes his patch for
>> javac to use the jigsaw resolver to find platform classes, javac
>> could switch to run in module mode. I added an internal switch in
>> the launcher, -mode:legacy or -mode:module, to specify a tool to run
>> in legacy mode or module mode when running in a modules image (e.g.
>> jdk-module-image). This is temporary and only valid for jdk tools to
>> use.
>>
>> Jon,
>> Does javadoc need to access platform classes like javap and
>> javah? In your patch, javac uses the jigsaw resolver to find
>> platform classes. How about javah and javap?
>>
>> Thanks
>> Mandy
> The change seems reasonable to me. I realize the switch is
> temporary/internal only but would it be better to make it -X option?
> Maybe -Xlegacymode and -Xmodulesmode?
>
> -Alan.
>
I think an option taking a value is better than a pair of boolean options.
Separately, note that users will have to use -J to prefix the option,
e.g. -J-Xmode:legacy. That's not an issue, but just remember that when
trying out the option, and when documenting it.
javadoc is similar to the other tools. The requirement for all of these
tools is that the system property sun.boot.class.path is set to the
platform class path. This is embodied in the code that handles these
tools path options, Paths.java, round about line 344
http://hg.openjdk.java.net/jdk7/tl/langtools/file/de6375751eb7/src/share/classes/com/sun/tools/javac/file/Paths.java.
Thus the tools could operate in "hybrid" mode, where the tool's JVM runs
in module mode, but sun.boot.class.path is set to a value that would
allow the tool itself to operate in legacy mode. The distinction is
similar to the existing distinction between -Xbootclasspath and
-J-Xbootclasspath seen by all the tools.
-- Jon
More information about the jigsaw-dev
mailing list