From 58c0aeb15a65324de08a914dfa62cc68a516a4e3 Mon Sep 17 00:00:00 2001 From: Runemoro Date: Mon, 9 Mar 2020 06:04:08 -0400 Subject: CFR support (#192) * Add decompiler API * Add CFR support--- .../enigma/translation/representation/TypeDescriptor.java | 5 ----- .../enigma/translation/representation/entry/ClassDefEntry.java | 10 ---------- .../enigma/translation/representation/entry/ClassEntry.java | 5 ----- .../enigma/translation/representation/entry/FieldDefEntry.java | 9 --------- .../translation/representation/entry/MethodDefEntry.java | 9 --------- 5 files changed, 38 deletions(-) (limited to 'src/main/java/cuchaz/enigma/translation') diff --git a/src/main/java/cuchaz/enigma/translation/representation/TypeDescriptor.java b/src/main/java/cuchaz/enigma/translation/representation/TypeDescriptor.java index 719d693..f7ba849 100644 --- a/src/main/java/cuchaz/enigma/translation/representation/TypeDescriptor.java +++ b/src/main/java/cuchaz/enigma/translation/representation/TypeDescriptor.java @@ -13,7 +13,6 @@ package cuchaz.enigma.translation.representation; import com.google.common.base.Preconditions; import com.google.common.collect.Maps; -import com.strobel.assembler.metadata.TypeReference; import cuchaz.enigma.translation.Translatable; import cuchaz.enigma.translation.Translator; import cuchaz.enigma.translation.mapping.EntryMapping; @@ -112,10 +111,6 @@ public class TypeDescriptor implements Translatable { return new TypeDescriptor("L" + name + ";"); } - public static TypeDescriptor parse(TypeReference type) { - return new TypeDescriptor(type.getErasedSignature()); - } - @Override public String toString() { return this.desc; diff --git a/src/main/java/cuchaz/enigma/translation/representation/entry/ClassDefEntry.java b/src/main/java/cuchaz/enigma/translation/representation/entry/ClassDefEntry.java index 4b245bc..6930765 100644 --- a/src/main/java/cuchaz/enigma/translation/representation/entry/ClassDefEntry.java +++ b/src/main/java/cuchaz/enigma/translation/representation/entry/ClassDefEntry.java @@ -12,7 +12,6 @@ package cuchaz.enigma.translation.representation.entry; import com.google.common.base.Preconditions; -import com.strobel.assembler.metadata.TypeDefinition; import cuchaz.enigma.translation.Translator; import cuchaz.enigma.translation.mapping.EntryMapping; import cuchaz.enigma.translation.representation.AccessFlags; @@ -53,15 +52,6 @@ public class ClassDefEntry extends ClassEntry implements DefEntry { return new ClassDefEntry(name, Signature.createSignature(signature), new AccessFlags(access), superClass, interfaceClasses); } - public static ClassDefEntry parse(TypeDefinition def) { - String name = def.getInternalName(); - Signature signature = Signature.createSignature(def.getSignature()); - AccessFlags access = new AccessFlags(def.getModifiers()); - ClassEntry superClass = def.getBaseType() != null ? ClassEntry.parse(def.getBaseType()) : null; - ClassEntry[] interfaces = def.getExplicitInterfaces().stream().map(ClassEntry::parse).toArray(ClassEntry[]::new); - return new ClassDefEntry(name, signature, access, superClass, interfaces); - } - public Signature getSignature() { return signature; } diff --git a/src/main/java/cuchaz/enigma/translation/representation/entry/ClassEntry.java b/src/main/java/cuchaz/enigma/translation/representation/entry/ClassEntry.java index 23ce4a2..74298e4 100644 --- a/src/main/java/cuchaz/enigma/translation/representation/entry/ClassEntry.java +++ b/src/main/java/cuchaz/enigma/translation/representation/entry/ClassEntry.java @@ -11,7 +11,6 @@ package cuchaz.enigma.translation.representation.entry; -import com.strobel.assembler.metadata.TypeReference; import cuchaz.enigma.throwables.IllegalNameException; import cuchaz.enigma.translation.Translator; import cuchaz.enigma.translation.mapping.EntryMapping; @@ -47,10 +46,6 @@ public class ClassEntry extends ParentedEntry implements Comparable< } } - public static ClassEntry parse(TypeReference typeReference) { - return new ClassEntry(typeReference.getInternalName()); - } - @Override public Class getParentType() { return ClassEntry.class; diff --git a/src/main/java/cuchaz/enigma/translation/representation/entry/FieldDefEntry.java b/src/main/java/cuchaz/enigma/translation/representation/entry/FieldDefEntry.java index 46c0b00..f9282b2 100644 --- a/src/main/java/cuchaz/enigma/translation/representation/entry/FieldDefEntry.java +++ b/src/main/java/cuchaz/enigma/translation/representation/entry/FieldDefEntry.java @@ -12,7 +12,6 @@ package cuchaz.enigma.translation.representation.entry; import com.google.common.base.Preconditions; -import com.strobel.assembler.metadata.FieldDefinition; import cuchaz.enigma.translation.Translator; import cuchaz.enigma.translation.mapping.EntryMapping; import cuchaz.enigma.translation.representation.AccessFlags; @@ -41,14 +40,6 @@ public class FieldDefEntry extends FieldEntry implements DefEntry { return new FieldDefEntry(owner, name, new TypeDescriptor(desc), Signature.createTypedSignature(signature), new AccessFlags(access), null); } - public static FieldDefEntry parse(FieldDefinition definition) { - ClassEntry owner = ClassEntry.parse(definition.getDeclaringType()); - TypeDescriptor descriptor = new TypeDescriptor(definition.getErasedSignature()); - Signature signature = Signature.createTypedSignature(definition.getSignature()); - AccessFlags access = new AccessFlags(definition.getModifiers()); - return new FieldDefEntry(owner, definition.getName(), descriptor, signature, access, null); - } - @Override public AccessFlags getAccess() { return access; diff --git a/src/main/java/cuchaz/enigma/translation/representation/entry/MethodDefEntry.java b/src/main/java/cuchaz/enigma/translation/representation/entry/MethodDefEntry.java index 280b605..4e75a5c 100644 --- a/src/main/java/cuchaz/enigma/translation/representation/entry/MethodDefEntry.java +++ b/src/main/java/cuchaz/enigma/translation/representation/entry/MethodDefEntry.java @@ -12,7 +12,6 @@ package cuchaz.enigma.translation.representation.entry; import com.google.common.base.Preconditions; -import com.strobel.assembler.metadata.MethodDefinition; import cuchaz.enigma.translation.Translator; import cuchaz.enigma.translation.mapping.EntryMapping; import cuchaz.enigma.translation.representation.AccessFlags; @@ -41,14 +40,6 @@ public class MethodDefEntry extends MethodEntry implements DefEntry return new MethodDefEntry(owner, name, new MethodDescriptor(desc), Signature.createSignature(signature), new AccessFlags(access), null); } - public static MethodDefEntry parse(MethodDefinition definition) { - ClassEntry classEntry = ClassEntry.parse(definition.getDeclaringType()); - MethodDescriptor descriptor = new MethodDescriptor(definition.getErasedSignature()); - Signature signature = Signature.createSignature(definition.getSignature()); - AccessFlags access = new AccessFlags(definition.getModifiers()); - return new MethodDefEntry(classEntry, definition.getName(), descriptor, signature, access, null); - } - @Override public AccessFlags getAccess() { return access; -- cgit v1.2.3