[NEW BUG] jdk.internal.module.Checks seems to miss a check for 'var'

Alan Bateman Alan.Bateman at oracle.com
Fri Mar 22 12:36:22 UTC 2019

On 22/03/2019 11:30, Christoph Dreis wrote:
> Hi,
> I recently stumbled upon jdk.internal.module.Checks and was wondering if you
> could help me understanding if I face a bug. The mentioned class has a
> private static field containing a list of reserved keywords. When checking
> the list for completeness, I noticed that "var" seems to be missing here and
> I wonder if it should be added.
This class supports validation when building module descriptors with the 
API, e.g.

         var descriptor = ModuleDescriptor.newModule("var")
                 .exports("var", Set.of("var"))
                 .provides("var.var", List.of("var.var"))

It is also used when deriving module descriptors for automatic modules.

So I think you found an issue as the "provides" and "mainClass" builder 
methods should reject a class name named "var" (no issue with the module 
or packages names which is why it shouldn't be added to the RESERVED set).


More information about the core-libs-dev mailing list