Skip to content

Commit

Permalink
Use ASM ClassReader instead of FernFlower StructClass to read qualified
Browse files Browse the repository at this point in the history
name of a class file
  • Loading branch information
jpstotz committed Jan 27, 2024
1 parent d6f07d1 commit 2519e89
Showing 1 changed file with 3 additions and 9 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -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;
Expand Down Expand Up @@ -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) {
Expand Down

0 comments on commit 2519e89

Please sign in to comment.