javac: "legacy" mode
Peter Jensen
peter.jensen at oracle.com
Fri Jan 27 14:30:42 PST 2012
On 01/27/12 13:37, 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.
That pretty much seems like a no-go, for legacy tooling.
>
> 2. Distinguish between the case of no module compilation units in a
> compilation and module compilation units involved, but not containing
> any requires on the base module. If no module compilation unit is
> observable, one would be synthesized containing "requires jdk;" or
> some equivalent. If any observable module compilation unit does not
> contain a requires for the platform base, then a "requires
> java.base>=N;" will be generated, with an appropriate value of N, per
> the spec.
What happens if I have some classes, compiled in legacy mode, and I want
to mix them into a module?
Example: I may not have the source files, but I really want to reuse
these classes.
>
> -- Jon
>
More information about the jigsaw-dev
mailing list