From 2519e89cc417ce29fb959e2e46784c180a76bf62 Mon Sep 17 00:00:00 2001 From: "Jan S." Date: Sat, 27 Jan 2024 16:37:19 +0100 Subject: [PATCH] Use ASM ClassReader instead of FernFlower StructClass to read qualified name of a class file --- .../org/sf/feeling/decompiler/util/ClassUtil.java | 12 +++--------- 1 file changed, 3 insertions(+), 9 deletions(-) diff --git a/org.sf.feeling.decompiler/src/org/sf/feeling/decompiler/util/ClassUtil.java b/org.sf.feeling.decompiler/src/org/sf/feeling/decompiler/util/ClassUtil.java index e504d204..fd3eadcc 100644 --- a/org.sf.feeling.decompiler/src/org/sf/feeling/decompiler/util/ClassUtil.java +++ b/org.sf.feeling.decompiler/src/org/sf/feeling/decompiler/util/ClassUtil.java @@ -18,9 +18,7 @@ import java.util.Optional; import java.util.stream.Stream; -import org.jetbrains.java.decompiler.struct.StructClass; -import org.jetbrains.java.decompiler.struct.lazy.LazyLoader; -import org.jetbrains.java.decompiler.util.DataInputFullStream; +import org.objectweb.asm.ClassReader; import org.sf.feeling.decompiler.JavaDecompilerPlugin; import org.sf.feeling.decompiler.editor.IDecompiler; import org.sf.feeling.decompiler.editor.IDecompilerDescriptor; @@ -107,12 +105,8 @@ public static boolean isClassFile(byte[] classData) { * Uses FernFlower library to read the class and extract it's qualified name */ public static String getClassQualifiedName(byte[] classData) throws IOException { - StructClass structClass; - try (DataInputFullStream in = new DataInputFullStream(classData)) { - structClass = StructClass.create(in, true, new LazyLoader(null)); - } - structClass.releaseResources(); - return structClass.qualifiedName; + ClassReader classReader = new ClassReader(classData); + return classReader.getClassName(); } public static IDecompiler getDebugDecompiler(int level, boolean debug) {