use of xmlkit.XMLKit.Element in project jdk8u_jdk by JetBrains.
the class AnnotationsElementVisitor method readMethods.
private void readMethods(ClassFile c, Element klass) throws IOException {
int len = c.methods.length;
Element methods = new Element(len);
for (Method m : c.methods) {
Element member = new Element("Method");
member.setAttr("name", getCpString(m.name_index));
member.setAttr("type", getCpString(m.descriptor.index));
member.setAttr("flags", flagString(m.access_flags.flags, member));
readAttributesFor(c, m.attributes, member);
member.trimToSize();
methods.add(member);
}
if (!keepOrder) {
methods.sort();
}
klass.addAll(methods);
}
use of xmlkit.XMLKit.Element in project jdk8u_jdk by JetBrains.
the class AnnotationsElementVisitor method visitValue.
@Override
public Element visitValue(Instruction i, int i1, Void p) {
Element ie = new Element(i.getMnemonic());
ie.setAttr("num", "" + i1);
return ie;
}
use of xmlkit.XMLKit.Element in project jdk8u_jdk by JetBrains.
the class AnnotationsElementVisitor method parsePosition.
private void parsePosition(Position ap, Element p) {
Element te = new Element();
switch(ap.type) {
case // 0x00
CLASS_TYPE_PARAMETER:
te.setName("CLASS_TYPE_PARAMETER");
te.setAttr("idx", "" + ap.parameter_index);
break;
case // 0x01
METHOD_TYPE_PARAMETER:
te.setName("METHOD_TYPE_PARAMETER");
te.setAttr("idx", "" + ap.parameter_index);
break;
case // 0x10
CLASS_EXTENDS:
te.setName("CLASS_EXTENDS");
te.setAttr("idx", "" + ap.type_index);
break;
case // 0x11
CLASS_TYPE_PARAMETER_BOUND:
te.setName("CLASS_TYPE_PARAMETER_BOUND");
te.setAttr("idx1", "" + ap.parameter_index);
te.setAttr("idx2", "" + ap.bound_index);
break;
case // 0x12
METHOD_TYPE_PARAMETER_BOUND:
te.setName("METHOD_TYPE_PARAMETER_BOUND");
te.setAttr("idx1", "" + ap.parameter_index);
te.setAttr("idx2", "" + ap.bound_index);
break;
case // 0x13
FIELD:
te.setName("FIELD");
break;
case // 0x14
METHOD_RETURN:
te.setName("METHOD_RETURN");
break;
case // 0x15
METHOD_RECEIVER:
te.setName("METHOD_RECEIVER");
break;
case // 0x16
METHOD_FORMAL_PARAMETER:
te.setName("METHOD_FORMAL_PARAMETER");
te.setAttr("idx", "" + ap.parameter_index);
break;
case // 0x17
THROWS:
te.setName("THROWS");
te.setAttr("idx", "" + ap.type_index);
break;
case // 0x40
LOCAL_VARIABLE:
te.setName("LOCAL_VARIABLE");
for (int i = 0; i < ap.lvarIndex.length; i++) {
te.setAttr("lvar_idx_" + i, "" + ap.lvarIndex[i]);
te.setAttr("lvar_len_" + i, "" + ap.lvarLength[i]);
te.setAttr("lvar_off_" + i, "" + ap.lvarOffset[i]);
}
break;
case // 0x41
RESOURCE_VARIABLE:
te.setName("RESOURCE_VARIABLE");
for (int i = 0; i < ap.lvarIndex.length; i++) {
te.setAttr("lvar_idx_" + i, "" + ap.lvarIndex[i]);
te.setAttr("lvar_len_" + i, "" + ap.lvarLength[i]);
te.setAttr("lvar_off_" + i, "" + ap.lvarOffset[i]);
}
break;
case // 0x42
EXCEPTION_PARAMETER:
te.setName("EXCEPTION_PARAMETER");
te.setAttr("idx", "" + ap.exception_index);
break;
case // 0x43
INSTANCEOF:
te.setName("INSTANCE_OF");
te.setAttr("off", "" + ap.offset);
break;
case // 0x44
NEW:
te.setName("NEW");
te.setAttr("off", "" + ap.offset);
break;
case // 0x45
CONSTRUCTOR_REFERENCE:
te.setName("CONSTRUCTOR_REFERENCE_RECEIVER");
te.setAttr("off", "" + ap.offset);
break;
case // 0x46
METHOD_REFERENCE:
te.setName("METHOD_REFERENCE_RECEIVER");
te.setAttr("off", "" + ap.offset);
break;
case // 0x47
CAST:
te.setName("CAST");
te.setAttr("off", "" + ap.offset);
te.setAttr("idx", "" + ap.type_index);
break;
case // 0x48
CONSTRUCTOR_INVOCATION_TYPE_ARGUMENT:
te.setName("CONSTRUCTOR_INVOCATION_TYPE_ARGUMENT");
te.setAttr("off", "" + ap.offset);
te.setAttr("idx", "" + ap.type_index);
break;
case // 0x49
METHOD_INVOCATION_TYPE_ARGUMENT:
te.setName("METHOD_INVOCATION_TYPE_ARGUMENT");
te.setAttr("off", "" + ap.offset);
te.setAttr("idx", "" + ap.type_index);
break;
case // 0x4A
CONSTRUCTOR_REFERENCE_TYPE_ARGUMENT:
te.setName("CONSTRUCTOR_REFERENCE_TYPE_ARGUMENT");
te.setAttr("off", "" + ap.offset);
te.setAttr("idx", "" + ap.type_index);
break;
case // 0x4B
METHOD_REFERENCE_TYPE_ARGUMENT:
te.setName("METHOD_REFERENCE_TYPE_ARGUMENT");
te.setAttr("off", "" + ap.offset);
te.setAttr("idx", "" + ap.type_index);
break;
default:
throw new RuntimeException("not implemented");
}
te.trimToSize();
p.add(te);
}
use of xmlkit.XMLKit.Element in project jdk8u_jdk by JetBrains.
the class AnnotationsElementVisitor method visitInteger.
@Override
public String visitInteger(CONSTANT_Integer_info cnstnt, Integer p) {
String value = slist.get(p);
if (value == null) {
value = Integer.toString(cnstnt.value);
slist.set(p, value);
xpool.add(new Element("CONSTANT_Integer", new String[] { "id", p.toString() }, value));
}
return value;
}
use of xmlkit.XMLKit.Element in project jdk8u_jdk by JetBrains.
the class AnnotationsElementVisitor method visitFloat.
@Override
public String visitFloat(CONSTANT_Float_info c, Integer p) {
String value = slist.get(p);
if (value == null) {
value = Float.toString(c.value);
slist.set(p, value);
xpool.add(new Element("CONSTANT_Float", new String[] { "id", p.toString() }, value));
}
return value;
}
Aggregations