Package, import and type declarations are allowed now in module-info.java by spec

2016-02-26 Thread Georgiy Rakov
Hello, current spec [1] now contains following assertions related to grammar: A compilation unit (JLS 7.3) may contain a module declaration, in which case the filename of the compilation unit is typically |module-info.java|. CompilationUnit: [PackageDeclaration] {ImportDeclara

Re: Package, import and type declarations are allowed now in module-info.java by spec

2016-02-26 Thread Alex Buckley
On 2/26/2016 8:37 AM, Georgiy Rakov wrote: current spec [1] now contains following assertions related to grammar: A compilation unit (JLS 7.3) may contain a module declaration, in which case the filename of the compilation unit is typically |module-info.java|. CompilationUnit:

Re: Package, import and type declarations are allowed now in module-info.java by spec

2016-03-09 Thread Georgiy Rakov
Hi Alex, if I understand correctly you mean about following assertions from JLS 7.6: If and only if packages are stored in a file system (ยง7.2 ), the host system may choose to enforce the restriction that it is a co

Re: Package, import and type declarations are allowed now in module-info.java by spec

2016-03-09 Thread Alex Buckley
The JLS doesn't prevent javac from rejecting a package declaration or an import declaration in a file called module-info.java. In fact, since a package declaration or import declaration must be followed by a type declaration, and since a type declaration cannot use a hyphen, javac is free to t

Re: Package, import and type declarations are allowed now in module-info.java by spec

2016-03-14 Thread Paul Benedict
Alex, you wrote: "The JLS doesn't prevent javac from rejecting a package declaration or an import declaration in a file called module-info.java." It seems that a package declaration, in this context, should be prohibited syntax because module-info.class is always in the JAR root which has no packa

Re: Package, import and type declarations are allowed now in module-info.java by spec

2016-03-14 Thread Alex Buckley
The JLS doesn't know what the string "module-info.class" means or what a "JAR root" is. It only knows about Unicode input matching the CompilationUnit production. Nothing is mandated about the filesystem layout of files containing CompilationUnit productions that include a PackageDeclaration. F

Re: Package, import and type declarations are allowed now in module-info.java by spec

2016-03-15 Thread Paul Benedict
On Mon, Mar 14, 2016 at 5:21 PM, Alex Buckley wrote: > The JLS doesn't know what the string "module-info.class" means or what a > "JAR root" is. Of course. Though that wasn't my ultimate point; I was merely illustrating (philosophically) why having "package" in module-info.java is nonsensical s

Re: Package, import and type declarations are allowed now in module-info.java by spec

2016-03-15 Thread Paul Benedict
I am happy to say the latest EA only allows "module" or types. It is either-or but not both. Cheers, Paul On Tue, Mar 15, 2016 at 12:43 PM, Paul Benedict wrote: > On Mon, Mar 14, 2016 at 5:21 PM, Alex Buckley > wrote: > >> The JLS doesn't know what the string "module-info.class" means or what

Re: Package, import and type declarations are allowed now in module-info.java by spec

2016-03-21 Thread Georgiy Rakov
According to my understanding import or type declarations are *optionally* followed by a type declaration according to the CompilationUnit grammar rule. JLS 7.6 just conditionally allows compiler to restrict file names to be aligned with type declaration but the compile errors are produced even

Re: Package, import and type declarations are allowed now in module-info.java by spec

2016-03-21 Thread Alex Buckley
Imagine the 7.6 text about the host system wasn't there. Now the JLS has no rules about the name of the file from which a CompilationUnit production is parsed. A compiler is therefore allowed to reject a file named module-info.java whenever it wishes. Now imagine the 7.6 text is put back. Sinc