javac: "legacy" mode

Ekaterina Pavlova ekaterina.pavlova at oracle.com
Fri Jan 27 21:49:28 PST 2012


On 1/27/12 5:28 PM, Mandy Chung wrote:
> On 1/27/2012 1:37 PM, Jonathan Gibbons wrote:
>> Until recently, javac implicitly supported "legacy" compilations (meaning compilations that were valid in JDK 7 or earlier). This was as side-effect by design of
>> "single-module mode", because the default requires if none was given was "jdk at 8-ea".
>>
>> Now, we have changed the default requires to "java.base@>=8". This means that without any other changes, a legacy compilation referencing non-base classes will fail to
>> compile.
>>
>> There are two possible solutions.
>>
>> 1. Have javac support -Xmode:legacy, which would change the default requires. It would also require everyone to change the way they use javac for legacy compilations.
>>
>
> This seems a major compatibility concern but it might worth taking the migration story into account. What if javac
> -source 7 -target 7 uses the entire "jdk" as the default
> and keep "java.base" as the default for -source 8 -target 8 (possibly provide a switch to say using the entire "jdk"
> rather than just the base)? I'm in two minds and I
> think it deserves some more thought.

Perhaps introduce something like -Xmode:module and keep legacy mode as default one
is more safe as the compatibility will not be broken.
Later defaults can be changed.

-katya



More information about the jigsaw-dev mailing list