Issue with an automatic module

Alan Bateman Alan.Bateman at
Tue Aug 2 14:10:46 UTC 2016

On 02/08/2016 06:19, Peter Levart wrote:

> Hi,
> Top-package (unnamed package) classes can not be referenced from 
> classes in named packages anyway, so they usually represent just 
> reflective entry points (such as Main class with main() method). If a 
> jar is used as an automatic module, it would probably be safe to just 
> ignore any classes that appear in the jar at the top-level. Maybe this 
> way there would be less grief in trying to use such jars as automatic 
> modules than by rejecting them.
The concern is that it gives the impression that a module can have a 
type in the unnamed package. If it is the main class then `java -m 
nar.maven.plugin/HelpMojo` will fail for example.  I concede of course 
that at some cases will be just mistakes where someone has included some 
classes in the top-level directory by accident.

(Note that the main class scenario has an another issue where it's 
possible for a JAR file to have a Main-Class attribute that named a 
class in the unnamed package as the main class. Known problem that will 
resolve itself once the builder API is overhauled).


More information about the jigsaw-dev mailing list