Module compilation unit grammar

Jonathan Gibbons jonathan.gibbons at oracle.com
Sun Apr 3 09:56:01 PDT 2011


On 03/25/2011 04:42 PM, Alex Buckley wrote:
>
> This is a little tricky because it is reasonably clear that you can 
> export whole packages, but the constant pool has no representation for 
> a package name like it does for a class or interface name. We don't 
> want to explode an exported package's members into individual exported 
> types - or maybe we do. For now, I propose just treating 'export 
> A.B.*;' as if it was a fully qualified class or interface name.
>
> ModuleExport_attribute {
>   u2 attribute_name_index;
>   u4 attribute_length;
>   u2 export_length;
>   { u2 export_index; u1 flags; } export_table[export_length];
> }
>
> attribute_name_index: a CONSTANT_Utf8_info representing "ModuleExport".
> attribute_length: length of attributes excluding the initial six bytes.
> export_table: Each export_index points to a CONSTANT_Class_info 
> representing a package or class or interface to be exported.
>
> Alex

For now, I'll continue implementing as written above, but here is a 
modified suggestion:

Rather than include the trailing .* or .** in the class name referred to 
by the export_index, since currently none of the flags bits are used, we 
could remove the .* or .** from the name and replace them with flag 
bits. This would avoid having to do analysis on the contents of the 
class name, albeit just a couple of simple .endsWith calls.

-- Jon



More information about the jigsaw-dev mailing list