Error in JLS for module-info.class

classic Classic list List threaded Threaded
3 messages Options
Reply | Threaded
Open this post in threaded view
|

Error in JLS for module-info.class

Luke Hutchison
In JLS section 4.1 ("The ClassFile structure") for SE 11, it states:

super_class

For a class, the value of the super_class item either must be zero or must
be a valid index into the constant_pool table. If the value of the
super_class item is nonzero, the constant_pool entry at that index must be
a CONSTANT_Class_info structure representing the direct superclass of the
class defined by this class file. Neither the direct superclass nor any of
its superclasses may have the ACC_FINAL flag set in the access_flags item
of its ClassFile structure.

If the value of the super_class item is zero, then this class file must
represent the class Object, the only class or interface without a direct
superclass.
This is incorrect -- the value of super_class is also zero for
module-info.class files.
Reply | Threaded
Open this post in threaded view
|

Re: Error in JLS for module-info.class

Alex Buckley
On 10/19/2018 4:09 PM, Luke Hutchison wrote:
> In JLS section 4.1 ("The ClassFile structure") for SE 11, it states:

You mean JVMS, not JLS. See the text under Table 4.1-B: "The ACC_MODULE
flag indicates that this class file defines a module, not a class or
interface. If the ACC_MODULE flag is set, then special rules apply to
the class file which are given at the end of this section. If the
ACC_MODULE flag is not set, then the rules immediately below the current
paragraph apply to the class file."

The rules at the end of the section mandate that super_class is zero for
an ACC_MODULE class file.

Alex
Reply | Threaded
Open this post in threaded view
|

Re: Error in JLS for module-info.class

Luke Hutchison
Ah, thanks for clarifying, I missed those exceptions.


On Fri, Oct 19, 2018 at 5:53 PM Alex Buckley <[hidden email]>
wrote:

> On 10/19/2018 4:09 PM, Luke Hutchison wrote:
> > In JLS section 4.1 ("The ClassFile structure") for SE 11, it states:
>
> You mean JVMS, not JLS. See the text under Table 4.1-B: "The ACC_MODULE
> flag indicates that this class file defines a module, not a class or
> interface. If the ACC_MODULE flag is set, then special rules apply to
> the class file which are given at the end of this section. If the
> ACC_MODULE flag is not set, then the rules immediately below the current
> paragraph apply to the class file."
>
> The rules at the end of the section mandate that super_class is zero for
> an ACC_MODULE class file.
>
> Alex
>