Search in sources :

Example 51 with Element

use of xmlkit.XMLKit.Element in project jdk8u_jdk by JetBrains.

the class AnnotationsElementVisitor method visitCharacterRangeTable.

@Override
public Element visitCharacterRangeTable(CharacterRangeTable_attribute crt, Element p) {
    Element e = new Element(x.getCpString(crt.attribute_name_index));
    for (CharacterRangeTable_attribute.Entry ce : crt.character_range_table) {
        e.setAttr("start_pc", "" + ce.start_pc);
        e.setAttr("end_pc", "" + ce.end_pc);
        e.setAttr("range_start", "" + ce.character_range_start);
        e.setAttr("range_end", "" + ce.character_range_end);
        e.setAttr("flags", x.flagString(ce.flags, "Method"));
    }
    e.trimToSize();
    p.add(e);
    return null;
}
Also used : CharacterRangeTable_attribute(com.sun.tools.classfile.CharacterRangeTable_attribute) Element(xmlkit.XMLKit.Element)

Example 52 with Element

use of xmlkit.XMLKit.Element in project jdk8u_jdk by JetBrains.

the class AnnotationsElementVisitor method visitDouble.

@Override
public String visitDouble(CONSTANT_Double_info c, Integer p) {
    String value = slist.get(p);
    if (value == null) {
        value = Double.toString(c.value);
        slist.set(p, value);
        xpool.add(new Element("CONSTANT_Double", new String[] { "id", p.toString() }, value));
    }
    return value;
}
Also used : Element(xmlkit.XMLKit.Element)

Example 53 with Element

use of xmlkit.XMLKit.Element in project jdk8u_jdk by JetBrains.

the class AnnotationsElementVisitor method readCP.

private void readCP(ClassFile c) throws IOException {
    cpool = new Element("ConstantPool", c.constant_pool.size());
    ConstantPoolVisitor cpv = new ConstantPoolVisitor(cpool, c, c.constant_pool.size());
    for (int i = 1; i < c.constant_pool.size(); i++) {
        try {
            cpv.visit(c.constant_pool.get(i), i);
        } catch (InvalidIndex ex) {
        // can happen periodically when accessing doubles etc. ignore it
        // ex.printStackTrace();
        }
    }
    thePool = cpv.getPoolList();
    if (verbose) {
        for (int i = 0; i < thePool.size(); i++) {
            System.out.println("[" + i + "]: " + thePool.get(i));
        }
    }
    if (keepCP) {
        cfile.add(cpool);
    }
}
Also used : Element(xmlkit.XMLKit.Element)

Example 54 with Element

use of xmlkit.XMLKit.Element in project jdk8u_jdk by JetBrains.

the class AnnotationsElementVisitor method visit_same_locals_1_stack_item_frame_extended.

@Override
public Element visit_same_locals_1_stack_item_frame_extended(same_locals_1_stack_item_frame_extended s, Void p) {
    Element e = new Element("SameLocals1StackItemFrameExtended");
    e.setAttr("tag", "" + s.frame_type);
    e.addAll(getVerificationTypeInfo("Stack", s.stack));
    e.trimToSize();
    return e;
}
Also used : Element(xmlkit.XMLKit.Element)

Example 55 with Element

use of xmlkit.XMLKit.Element in project jdk8u_jdk by JetBrains.

the class AnnotationsElementVisitor method visitLocalVariableTable.

@Override
public Element visitLocalVariableTable(LocalVariableTable_attribute lvt, Element p) {
    String name = x.getCpString(lvt.attribute_name_index);
    for (LocalVariableTable_attribute.Entry e : lvt.local_variable_table) {
        Element l = new Element(name);
        l.setAttr("bci", "" + e.start_pc);
        l.setAttr("span", "" + e.length);
        l.setAttr("name", x.getCpString(e.name_index));
        l.setAttr("type", x.getCpString(e.descriptor_index));
        l.setAttr("slot", "" + e.index);
        l.trimToSize();
        p.add(l);
    }
    // already added to parent
    return null;
}
Also used : Element(xmlkit.XMLKit.Element) LocalVariableTable_attribute(com.sun.tools.classfile.LocalVariableTable_attribute)

Aggregations

Element (xmlkit.XMLKit.Element)77 ConstantPoolException (com.sun.tools.classfile.ConstantPoolException)8 TypeAnnotation (com.sun.tools.classfile.TypeAnnotation)7 Annotation (com.sun.tools.classfile.Annotation)5 StackMapTable_attribute (com.sun.tools.classfile.StackMapTable_attribute)2 AccessFlags (com.sun.tools.classfile.AccessFlags)1 Attribute (com.sun.tools.classfile.Attribute)1 BootstrapMethods_attribute (com.sun.tools.classfile.BootstrapMethods_attribute)1 CharacterRangeTable_attribute (com.sun.tools.classfile.CharacterRangeTable_attribute)1 ClassFile (com.sun.tools.classfile.ClassFile)1 Code_attribute (com.sun.tools.classfile.Code_attribute)1 DefaultAttribute (com.sun.tools.classfile.DefaultAttribute)1 Field (com.sun.tools.classfile.Field)1 Info (com.sun.tools.classfile.InnerClasses_attribute.Info)1 Instruction (com.sun.tools.classfile.Instruction)1 LineNumberTable_attribute (com.sun.tools.classfile.LineNumberTable_attribute)1 LocalVariableTable_attribute (com.sun.tools.classfile.LocalVariableTable_attribute)1 LocalVariableTypeTable_attribute (com.sun.tools.classfile.LocalVariableTypeTable_attribute)1 Method (com.sun.tools.classfile.Method)1 MethodParameters_attribute (com.sun.tools.classfile.MethodParameters_attribute)1