From 3ebcc401d521ba6c7bc5b865e10b1d16c4c55856 Mon Sep 17 00:00:00 2001 From: ItzSomebody <23221108+ItzSomebody@users.noreply.github.com> Date: Tue, 30 Jan 2018 12:58:44 -0800 Subject: [PATCH] Class attributes now get dumped --- src/org/objectweb/asm/Attribute.java | 2 +- .../bytecode/ClassNodeDecompiler.java | 27 +++++++++++++++++++ 2 files changed, 28 insertions(+), 1 deletion(-) diff --git a/src/org/objectweb/asm/Attribute.java b/src/org/objectweb/asm/Attribute.java index 8a2a882f..ae28a512 100644 --- a/src/org/objectweb/asm/Attribute.java +++ b/src/org/objectweb/asm/Attribute.java @@ -45,7 +45,7 @@ public class Attribute { /** * 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 null. diff --git a/src/the/bytecode/club/bytecodeviewer/decompilers/bytecode/ClassNodeDecompiler.java b/src/the/bytecode/club/bytecodeviewer/decompilers/bytecode/ClassNodeDecompiler.java index 73d87fc6..d7f220c6 100644 --- a/src/the/bytecode/club/bytecodeviewer/decompilers/bytecode/ClassNodeDecompiler.java +++ b/src/the/bytecode/club/bytecodeviewer/decompilers/bytecode/ClassNodeDecompiler.java @@ -3,6 +3,7 @@ package the.bytecode.club.bytecodeviewer.decompilers.bytecode; import java.util.ArrayList; import java.util.List; +import org.objectweb.asm.Attribute; import org.objectweb.asm.Opcodes; import org.objectweb.asm.tree.ClassNode; import org.objectweb.asm.tree.FieldNode; @@ -107,6 +108,32 @@ public class ClassNodeDecompiler extends Decompiler { 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("}"); // System.out.println("Wrote end for " + cn.name + // " with prefix length: " + sb.prefix.length());