The very end of the generics specification included with ea2.2 states that the class file format changes are specified in a document that is "attached to this specification as a separated document". I can't seem to find any document that details those changes. Where can I get this information? I need it to improve a tool that I've written that parses Java classfiles. Please don't tell me that I need to read through the compiler source code.
The very end of the generics specification included
with ea2.2 states that the class file format changes
are specified in a document that is "attached to this
specification as a separated document". I can't seem
to find any document that details those changes. Where
can I get this information? I need it to improve a
tool that I've written that parses Java classfiles.
Please don't tell me that I need to read through the
compiler source code.
I'm afraid reading the compiler source code won't help, as most of the VM changes aren't implemented in it yet. You will have to wait for the community review of JSR202 (which is imminent) or perhaps the public review to get a copy of the proposed spec. Here are the highlights:
(1) CLDC-style verifier tables required starting in classfile version 49 (-target 1.5); jsr/ret instructions no longer allowed.
(2) class, field, and method names can include almost any unicode character, not just valid Java identifiers
(3) New flag bits for "synthetic", "enum" (for enum types and enumeration constants), "varargs" (for a varargs method), and "bridge" (for compiler-generated bridge methods).
(4) New class file attributes for JSR175.
(5) ldc instruction can reference a class in the constant pool, to support class literals.
Thanks for the info Scott. Does the grammar replace that for the current grammar defined for field and method descriptors, or is it attached as some separate attribute? At least when the compiler was supposed to generate code that would target pre1.5 vm's, this couldn't have replaced the existing descriptor grammar. Do you (or Neal) know how likely this is to change?
This was described in the original prototype 1.0 spec document.
The original type-erased (non-parameterized) "descriptors" are still present on methods, fields, and classes. But a new "Signature" attribute has also been
added, which contains extended descriptors with the grammar specified at my site.
I just expanded the description at the URL above to better describe this. I'd forgotten that the context for the grammar has been removed from the new spec.
Starting from the description in the 1.0 spec, I wrote sinjp, a javap workalike for generic methods. I published my first "corrected" version of the signature grammar addressing problems I found while implementing sinjp. Then I've just kept updating both to keep them working with the different prototype versions as they were released. "Reverse-engineering."