Class attributes now get dumped

This commit is contained in:
ItzSomebody 2018-01-30 12:58:44 -08:00
parent f936af84da
commit 3ebcc401d5
2 changed files with 28 additions and 1 deletions

View file

@ -45,7 +45,7 @@ public class Attribute {
/** /**
* The raw value of this attribute, used only for unknown attributes. * The raw value of this attribute, used only for unknown attributes.
*/ */
byte[] value; public byte[] value;
/** /**
* The next attribute in this attribute list. May be <tt>null</tt>. * The next attribute in this attribute list. May be <tt>null</tt>.

View file

@ -3,6 +3,7 @@ package the.bytecode.club.bytecodeviewer.decompilers.bytecode;
import java.util.ArrayList; import java.util.ArrayList;
import java.util.List; import java.util.List;
import org.objectweb.asm.Attribute;
import org.objectweb.asm.Opcodes; import org.objectweb.asm.Opcodes;
import org.objectweb.asm.tree.ClassNode; import org.objectweb.asm.tree.ClassNode;
import org.objectweb.asm.tree.FieldNode; import org.objectweb.asm.tree.FieldNode;
@ -107,6 +108,32 @@ public class ClassNodeDecompiler extends Decompiler {
sb.append(BytecodeViewer.nl); sb.append(BytecodeViewer.nl);
} }
if (cn.attrs != null) {
sb.append(BytecodeViewer.nl);
for (Attribute attr : cn.attrs) {
sb.append(attr.type + ": " + attr.value.toString());
}
}
if (cn.sourceDebug != null) {
sb.append(BytecodeViewer.nl);
sb.append(" ");
sb.append("SourceDebug: " + cn.sourceDebug);
}
if (cn.sourceFile != null) {
sb.append(BytecodeViewer.nl);
sb.append(" ");
sb.append("SourceFile: " + cn.sourceFile);
}
if (cn.signature != null) {
sb.append(BytecodeViewer.nl);
sb.append(" ");
sb.append("Signature: " + cn.sourceFile);
}
sb.append(BytecodeViewer.nl);
sb.append("}"); sb.append("}");
// System.out.println("Wrote end for " + cn.name + // System.out.println("Wrote end for " + cn.name +
// " with prefix length: " + sb.prefix.length()); // " with prefix length: " + sb.prefix.length());