ModuleNameAndVersionQuery vs CONSTANT_ModuleQuery_Info

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

ModuleNameAndVersionQuery vs CONSTANT_ModuleQuery_Info

Mandy Chung
Alex,

In a 'requires' clause, version is optional.  It seems that
the version_index in the CONSTANT_ModuleQuery_info structure
should be zero in that case as in the CONSTANT_ModuleId_info

But the spec for the CONSTANT_ModuleQuery_info structure requires
the version_index be a valid index into the constant_pool table.
A spec bug?

Mandy


Reply | Threaded
Open this post in threaded view
|

Re: ModuleNameAndVersionQuery vs CONSTANT_ModuleQuery_Info

Alex Buckley
On 1/25/2012 1:10 PM, Mandy Chung wrote:
> In a 'requires' clause, version is optional. It seems that
> the version_index in the CONSTANT_ModuleQuery_info structure
> should be zero in that case as in the CONSTANT_ModuleId_info

Yes. The representation of a 'requires' clause
(ModuleRequires.module_table) used to refer to CONSTANT_ModuleId, so it
got version-less queries for free. Then we broke out version queries
into CONSTANT_ModuleQuery.

I am wondering if we need both kinds of constant pool entry, given that
the JVM can't distinguish between a string which holds a single version
and a string which holds a version query. That is, the strong typing
provided by different kinds of constant pool entries can be subverted.
But I'll leave them both in for now. Project page will update soon.

Alex