spec clarification: empty default view

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

spec clarification: empty default view

Jonathan Gibbons
In a ModuleProvides_attribute, does there have to be an entry for the
default view, even it it would be completely empty?

-- Jon
Reply | Threaded
Open this post in threaded view
|

Re: spec clarification: empty default view

Alex Buckley
On 1/23/2012 5:57 PM, Jonathan Gibbons wrote:
> In a ModuleProvides_attribute, does there have to be an entry for the
> default view, even it it would be completely empty?

Attributes should only store what exists. The language and the module
system might well say there is logically a default view which is empty,
but we traditionally don't "do" dummy attributes with zero-length tables
in the ClassFile. (A ClassFile format checker must be able to handle
them, but a Java compiler is not obligated to produce it.)

So, if a module declaration consists of just 'requires' clauses and
exports nothing, has no aliases, no friends, and no entrypoint, then I
would say no ModuleProvides attribute is needed at all.

Adding one non-default view to that module declaration would prompt a
ModuleProvides attribute, but I don't think a default view needs to
spring into the physical representation too. Each physical view is
standalone in ModuleProvides.

Alex