use of xmlkit.XMLKit.Element in project jdk8u_jdk by JetBrains.
the class AnnotationsElementVisitor method visitRuntimeVisibleTypeAnnotations.
@Override
public Element visitRuntimeVisibleTypeAnnotations(RuntimeVisibleTypeAnnotations_attribute rvta, Element p) {
Element e = new Element(x.getCpString(rvta.attribute_name_index));
for (TypeAnnotation pa : rvta.annotations) {
parseTypeAnnotations(pa, e);
}
e.sort();
p.add(e);
return null;
}
use of xmlkit.XMLKit.Element in project jdk8u_jdk by JetBrains.
the class AnnotationsElementVisitor method visitString.
@Override
public String visitString(CONSTANT_String_info c, Integer p) {
try {
String value = slist.get(p);
if (value == null) {
value = c.getString();
slist.set(p, value);
xpool.add(new Element("CONSTANT_String", new String[] { "id", p.toString() }, value));
}
return value;
} catch (ConstantPoolException ex) {
throw new RuntimeException("Fatal error", ex);
}
}
use of xmlkit.XMLKit.Element in project jdk8u_jdk by JetBrains.
the class AnnotationsElementVisitor method doStream.
private static void doStream(String a, InputStream in, File dest, ClassReader options, String encoding) throws IOException {
File f = new File(a);
ClassReader cr = new ClassReader(options);
Element e;
if (options.verbose) {
System.out.println("Reading " + f);
}
e = cr.readFrom(in);
OutputStream out;
if (dest == null) {
out = System.out;
} else {
File outf = new File(dest, f.isAbsolute() ? f.getName() : f.getPath());
String outName = outf.getName();
File outSubdir = outf.getParentFile();
outSubdir.mkdirs();
int extPos = outName.lastIndexOf('.');
if (extPos > 0) {
outf = new File(outSubdir, outName.substring(0, extPos) + ".xml");
}
out = new FileOutputStream(outf);
}
Writer outw = makeWriter(out, encoding);
if (options.pretty || !options.keepOrder) {
e.writePrettyTo(outw);
} else {
e.writeTo(outw);
}
if (out == System.out) {
outw.write("\n");
outw.flush();
} else {
outw.close();
}
}
use of xmlkit.XMLKit.Element in project jdk8u_jdk by JetBrains.
the class AnnotationsElementVisitor method readFields.
private void readFields(ClassFile c, Element klass) throws IOException {
int len = c.fields.length;
Element fields = new Element(len);
for (Field f : c.fields) {
Element field = new Element("Field");
field.setAttr("name", getCpString(f.name_index));
field.setAttr("type", getCpString(f.descriptor.index));
field.setAttr("flags", flagString(f.access_flags.flags, field));
readAttributesFor(c, f.attributes, field);
field.trimToSize();
fields.add(field);
}
if (!keepOrder) {
fields.sort();
}
klass.addAll(fields);
}
use of xmlkit.XMLKit.Element in project jdk8u_jdk by JetBrains.
the class AnnotationsElementVisitor method visit_same_frame.
@Override
public Element visit_same_frame(same_frame sm_frm, Void p) {
Element e = new Element("SameFrame");
e.setAttr("tag", "" + sm_frm.frame_type);
return e;
}
Aggregations