Re: class file extensions in JDK 7, for ASM 4.0

Ben Evans <[email protected]>
Newsgroups gmane.comp.java.objectweb.asm
Message-ID <[email protected]>
Hi Eric,

292 and 308 are basically definites for JDK 7, as far as anyone who's not 
an Oracle employee can tell. 308 has been stable and in OpenJDK for >12 
months now, 292 is still evolving but under very, very active development 
and one of the most "headline" pieces of JDK 7. 

Not sure about the status of 294. 

Note that there's an announcement on Sept 20th which should shed some more 
light on all this.

Thanks,

Ben
-- 
Ben Evans
GFFX Auto Trading
Deutsche Bank, London
Office: +44 (0)20 7541 3953



[email protected] 
28/08/2010 15:37

To
[email protected]
cc

Subject
[asm] class file extensions in JDK 7, for ASM 4.0






I was looking at JDK 7 new features, from 
http://openjdk.java.net/projects/jdk7/features/

It seems that 3 JSRs define extensions to the class file format:
- JSR 292 for invokedynamic
- JSR 294 for modular programing
- JSR 308 for annotations on Java types
or do I miss something?

all these JSRs are marked as inactive, and I did not found official 
documents describing the proposed changes to the class file format. This 
is strange because I read somewhere that JDK 7 is supposed to be released 
at the end of this year?

The most recent documents I found for JSR 294 and 308 are:
- http://openjdk.java.net/projects/jigsaw/doc/classfile.html
- 
http://types.cs.washington.edu/jsr308/specification/java-annotation-design.html#class-file


JSR 294 adds a new access flag (ACC_MODULE), as well as four new class 
attributes:

Module_attribute {
  u2 attribute_name_index;
  u4 attribute_length;
  u2 module_id_index;
}

ModuleRequires_attribute {
  u2 attribute_name_index;
  u4 attribute_length;
  u2 requires_length;
  { 
    u2 requires_index; 
    u1 flags; 
  } requires_table[depends_length];
}

ModulePermits_attribute {
  u2 attribute_name_index;
  u4 attribute_length;
  u2 permits_length;
  { u2 permits_index } permits_table[permits_length];
}

ModuleProvides_attribute {
  u2 attribute_name_index;
  u4 attribute_length;
  u2 provides_length;
  { u2 provides_index; } provides_table[provides_length];
}

providing support for this in ASM is not complicated (with four new 
methods in ClassVisitor
and a new constant in Opcodes)

JSR 308 adds two new attributes: RuntimeVisibleTypeAnnotations and 
RuntimeInvisibleTypeAnnotations
they contains extended_annotation values, which are like annotation, with 
these additional fields at the end:

    u1 target_type;    // the type of the targeted program element, 36 
possible values!
    union {
        offset_target {
            u2 offset;
            // if within parameterized type or array type
            u2 location_length;
                     u1 location[location_length];
        };
        localvar_target {
            u2 table_length;
            {
                u2 start_pc;
                u2 length;
                u2 index;
            } table[table_length];
            // if within parameterized type or array type
            u2 location_length;
                     u1 location[location_length];
        };
        methodparam_target {
            u1 parameter_index;
            // if within parameterized type or array type
            u2 location_length;
                     u1 location[location_length];
        };
        field_target; // no definition ???
        typeparam_target {
            u1 param_index;
            // if within parameterized type or array type
            u2 location_length;
                     u1 location[location_length];
        };
        typeparam_bound_target {
            u1 param_index;
            u1 bound_index;
            // if within parameterized type or array type
            u2 location_length;
                     u1 location[location_length];
        };
        typearg_target {
            u2 offset;
            u1 type_index;
            // if within parameterized type or array type
            u2 location_length;
                     u1 location[location_length];
        };
        supertype_target {
            u2 type_index;
            // if within parameterized type or array type
            u2 location_length;
                     u1 location[location_length];
        };
        typeindex_target; // no definition ???
        wildcard_bound_target {
            u1 wildcard_location_type;
            target_info;
            // if within parameterized type or array type
            u2 location_length;
                     u1 location[location_length];
        }
        empty_target {
            // if within parameterized type or array type
            u2 location_length;
                     u1 location[location_length];
        };
    } target_info; 

quite complex! Especially to keep such a structure up to date, when doing 
bytecode modifications (there are many indices and code offsets to 
elements that could be modified by a bytecode transformation). Also 
handling these extensions in AnnotationVisitor will not be simple!

Anyway, before thinking about that, we need to know if these proposed 
changes are quite stable, if they can still be modified, if they will 
effectively be included in Java 7, etc. Any news about that?

Eric

-- 
You receive this message as a subscriber of the [email protected] mailing list.
To unsubscribe: mailto:[email protected]
For general help: mailto:[email protected]?subject=help
OW2 mailing lists service home page: http://www.ow2.org/wws




---

This e-mail may contain confidential and/or privileged information. If you are not the intended recipient (or have received this e-mail in error) please notify the sender immediately and delete this e-mail. Any unauthorized copying, disclosure or distribution of the material in this e-mail is strictly forbidden.

Please refer to http://www.db.com/en/content/eu_disclosures.htm for additional EU corporate and regulatory disclosures.
message-footer.txt (text/plain, 238 B)
-- 
You receive this message as a subscriber of the [email protected] mailing list.
To unsubscribe: mailto:[email protected]
For general help: mailto:[email protected]?subject=help
OW2 mailing lists service home page: http://www.ow2.org/wws
lmpx.com only provides a reader for public news (NNTP) servers. It is not affiliated with the servers or forums shown here and is not responsible for the content of articles, which is written by their respective authors.