Search in sources :

Example 11 with Element

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

the class AnnotationsElementVisitor method visitArrayType.

@Override
public Element visitArrayType(Instruction i, TypeKind tk, Void p) {
    Element ie = new Element(i.getMnemonic());
    ie.setAttr("num", "" + tk.value);
    ie.setAttr("val", tk.name);
    return ie;
}
Also used : Element(xmlkit.XMLKit.Element)

Example 12 with Element

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

the class AnnotationsElementVisitor method visitMethodType.

@Override
public String visitMethodType(CONSTANT_MethodType_info c, Integer p) {
    String value = slist.get(p);
    if (value == null) {
        try {
            value = visit(cfpool.get(c.descriptor_index), c.descriptor_index);
            slist.set(p, value);
            xpool.add(new Element("CONSTANT_MethodType", new String[] { "id", p.toString() }, value));
        } catch (ConstantPoolException ex) {
            ex.printStackTrace();
        }
    }
    return value;
}
Also used : Element(xmlkit.XMLKit.Element) ConstantPoolException(com.sun.tools.classfile.ConstantPoolException)

Example 13 with Element

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

the class AnnotationsElementVisitor method visitLineNumberTable.

@Override
public Element visitLineNumberTable(LineNumberTable_attribute lnt, Element p) {
    String name = x.getCpString(lnt.attribute_name_index);
    for (LineNumberTable_attribute.Entry e : lnt.line_number_table) {
        Element l = new Element(name);
        l.setAttr("bci", "" + e.start_pc);
        l.setAttr("line", "" + e.line_number);
        l.trimToSize();
        p.add(l);
    }
    // already added to parent
    return null;
}
Also used : Element(xmlkit.XMLKit.Element) LineNumberTable_attribute(com.sun.tools.classfile.LineNumberTable_attribute)

Example 14 with Element

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

the class AnnotationsElementVisitor method visitLookupSwitch.

@Override
public Element visitLookupSwitch(Instruction i, int i1, int i2, int[] ints, int[] ints1, Void p) {
    Element ie = new Element(i.getMnemonic());
    int pc = i.getPC();
    ie.setAttr("lab", "" + (pc + i1));
    for (int k = 0; k < i2; k++) {
        Element c = new Element("Case");
        c.setAttr("num", "" + (ints[k]));
        c.setAttr("lab", "" + (pc + ints1[k]));
        c.trimToSize();
        ie.add(c);
    }
    return ie;
}
Also used : Element(xmlkit.XMLKit.Element)

Example 15 with Element

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

the class AnnotationsElementVisitor method visitBootstrapMethods.

@Override
public Element visitBootstrapMethods(BootstrapMethods_attribute bm, Element p) {
    Element e = new Element(x.getCpString(bm.attribute_name_index));
    for (BootstrapMethods_attribute.BootstrapMethodSpecifier bsm : bm.bootstrap_method_specifiers) {
        Element be = new Element("BootstrapMethodSpecifier");
        be.setAttr("ref", x.getCpString(bsm.bootstrap_method_ref));
        if (bsm.bootstrap_arguments.length > 0) {
            Element bme = new Element("MethodArguments");
            for (int index : bsm.bootstrap_arguments) {
                bme.add(x.getCpString(index));
            }
            bme.trimToSize();
            be.add(bme);
        }
        be.trimToSize();
        e.add(be);
    }
    e.trimToSize();
    if (!x.keepOrder) {
        e.sort();
    }
    p.add(e);
    return null;
}
Also used : Element(xmlkit.XMLKit.Element) BootstrapMethods_attribute(com.sun.tools.classfile.BootstrapMethods_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