JDK-8191112: javac OutOfMemoryError caused by "-Xlint:exports" option
Jonathan Gibbons
jonathan.gibbons at oracle.com
Wed Nov 15 22:50:55 UTC 2017
+1
-- Jon
On 11/14/2017 05:17 AM, Jan Lahoda wrote:
> Hi,
>
> Consider an automatic module "dep" with class "dep.Dep", and
> additional automatic modules ext1 and ext2.
>
> When javac has these on the modulepath, and compiles a module like this:
> ---
> module mod {
> requires dep;
> exports api;
> }
>
> package api;
>
> public class Api extends dep.Dep {}
> ---
>
> -Xlint:exports can be used to report exported APIs that refer to types
> potentially inaccessible to the clients. In this case, the supertype
> of api.Api may be inaccessible unless the client has a dependency on
> "dep", so the lint will warn about that. But since the dep, ext1 and
> ext2 are automatic modules, each of the modules "requires transitive"
> the other automatic modules, and the check may go into an infinite loop.
>
> Moreover, for code like this:
> ---
> module mod {
> requires transitive ext1;
> exports api;
> }
> ---
>
> "dep.Dep" is accessible using requires transitive edges of the
> automatic modules, hence the warning/lint is not printed.
>
> That does not seem quite right, an explicit "requires transitive dep"
> dependency would be better, otherwise the changes in the module path
> can lead to surprising behavior.
>
> The suggested patch is to simply ignore the dependencies of automatic
> modules in the check - that should avoid the infinite loop and print
> the warning in the "requires transitive ext1" case.
>
> Bug: https://bugs.openjdk.java.net/browse/JDK-8191112
> Webrev: http://cr.openjdk.java.net/~jlahoda/8191112/webrev.00/
>
> What do you think?
>
> Thanks,
> Jan
>
More information about the compiler-dev
mailing list