Search in sources :

Example 41 with Element

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

the class AnnotationsElementVisitor method readAttributesFor.

protected void readAttributesFor(ClassFile c, Attributes attrs, Element x) {
    Element container = new Element();
    AttributeVisitor av = new AttributeVisitor(this, c);
    for (Attribute a : attrs) {
        av.visit(a, container);
    }
    if (!keepOrder) {
        container.sort();
    }
    x.addAll(container);
}
Also used : Attribute(com.sun.tools.classfile.Attribute) DefaultAttribute(com.sun.tools.classfile.DefaultAttribute) Element(xmlkit.XMLKit.Element)

Example 42 with Element

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

the class AnnotationsElementVisitor method visit.

public Element visit(Instruction i) {
    Element ie = i.accept(this, null);
    ie.trimToSize();
    return ie;
}
Also used : Element(xmlkit.XMLKit.Element)

Example 43 with Element

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

the class AnnotationsElementVisitor method getVerificationTypeInfo.

private Element getVerificationTypeInfo(String kind, StackMapTable_attribute.verification_type_info[] velems) {
    Element container = new Element(velems.length);
    for (StackMapTable_attribute.verification_type_info v : velems) {
        Element ve = null;
        int offset = 0;
        int index = 0;
        switch(v.tag) {
            case StackMapTable_attribute.verification_type_info.ITEM_Top:
                ve = new Element("ITEM_Top");
                break;
            case StackMapTable_attribute.verification_type_info.ITEM_Integer:
                ve = new Element("ITEM_Integer");
                break;
            case StackMapTable_attribute.verification_type_info.ITEM_Float:
                ve = new Element("ITEM_Float");
                break;
            case StackMapTable_attribute.verification_type_info.ITEM_Long:
                ve = new Element("ITEM_Long");
                break;
            case StackMapTable_attribute.verification_type_info.ITEM_Double:
                ve = new Element("ITEM_Double");
                break;
            case StackMapTable_attribute.verification_type_info.ITEM_Null:
                ve = new Element("ITEM_Null");
                break;
            case StackMapTable_attribute.verification_type_info.ITEM_Uninitialized:
                ve = new Element("ITEM_Uninitialized");
                offset = ((StackMapTable_attribute.Uninitialized_variable_info) v).offset;
                ve.setAttr("offset", "" + offset);
                break;
            case StackMapTable_attribute.verification_type_info.ITEM_UninitializedThis:
                ve = new Element("ITEM_UnitializedtThis");
                break;
            case StackMapTable_attribute.verification_type_info.ITEM_Object:
                ve = new Element("ITEM_Object");
                index = ((StackMapTable_attribute.Object_variable_info) v).cpool_index;
                ve.setAttr("class", x.getCpString(index));
                break;
            default:
                ve = new Element("Unknown");
        }
        Element kindE = new Element(kind);
        kindE.setAttr("tag", "" + v.tag);
        container.add(kindE);
        kindE.add(ve);
    }
    container.trimToSize();
    return container;
}
Also used : StackMapTable_attribute(com.sun.tools.classfile.StackMapTable_attribute) Element(xmlkit.XMLKit.Element)

Example 44 with Element

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

the class AnnotationsElementVisitor method visitTableSwitch.

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

Example 45 with Element

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

the class AnnotationsElementVisitor method visitSourceID.

@Override
public Element visitSourceID(SourceID_attribute sid, Element p) {
    Element e = new Element(x.getCpString(sid.attribute_name_index));
    e.add(x.getCpString(sid.sourceID_index));
    e.trimToSize();
    p.add(e);
    return null;
}
Also used : Element(xmlkit.XMLKit.Element)

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