diff options
| author | 2020-03-09 06:04:08 -0400 | |
|---|---|---|
| committer | 2020-03-09 10:04:08 +0000 | |
| commit | 58c0aeb15a65324de08a914dfa62cc68a516a4e3 (patch) | |
| tree | f45e8141c0864692051149a478c5a0a6bbe68686 /src/main/java/cuchaz/enigma/translation/representation | |
| parent | Made Enigma gui translatable (#193) (diff) | |
| download | enigma-fork-58c0aeb15a65324de08a914dfa62cc68a516a4e3.tar.gz enigma-fork-58c0aeb15a65324de08a914dfa62cc68a516a4e3.tar.xz enigma-fork-58c0aeb15a65324de08a914dfa62cc68a516a4e3.zip | |
CFR support (#192)
* Add decompiler API
* Add CFR support
Diffstat (limited to 'src/main/java/cuchaz/enigma/translation/representation')
5 files changed, 0 insertions, 38 deletions
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; | |||
| 13 | 13 | ||
| 14 | import com.google.common.base.Preconditions; | 14 | import com.google.common.base.Preconditions; |
| 15 | import com.google.common.collect.Maps; | 15 | import com.google.common.collect.Maps; |
| 16 | import com.strobel.assembler.metadata.TypeReference; | ||
| 17 | import cuchaz.enigma.translation.Translatable; | 16 | import cuchaz.enigma.translation.Translatable; |
| 18 | import cuchaz.enigma.translation.Translator; | 17 | import cuchaz.enigma.translation.Translator; |
| 19 | import cuchaz.enigma.translation.mapping.EntryMapping; | 18 | import cuchaz.enigma.translation.mapping.EntryMapping; |
| @@ -112,10 +111,6 @@ public class TypeDescriptor implements Translatable { | |||
| 112 | return new TypeDescriptor("L" + name + ";"); | 111 | return new TypeDescriptor("L" + name + ";"); |
| 113 | } | 112 | } |
| 114 | 113 | ||
| 115 | public static TypeDescriptor parse(TypeReference type) { | ||
| 116 | return new TypeDescriptor(type.getErasedSignature()); | ||
| 117 | } | ||
| 118 | |||
| 119 | @Override | 114 | @Override |
| 120 | public String toString() { | 115 | public String toString() { |
| 121 | return this.desc; | 116 | 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 @@ | |||
| 12 | package cuchaz.enigma.translation.representation.entry; | 12 | package cuchaz.enigma.translation.representation.entry; |
| 13 | 13 | ||
| 14 | import com.google.common.base.Preconditions; | 14 | import com.google.common.base.Preconditions; |
| 15 | import com.strobel.assembler.metadata.TypeDefinition; | ||
| 16 | import cuchaz.enigma.translation.Translator; | 15 | import cuchaz.enigma.translation.Translator; |
| 17 | import cuchaz.enigma.translation.mapping.EntryMapping; | 16 | import cuchaz.enigma.translation.mapping.EntryMapping; |
| 18 | import cuchaz.enigma.translation.representation.AccessFlags; | 17 | import cuchaz.enigma.translation.representation.AccessFlags; |
| @@ -53,15 +52,6 @@ public class ClassDefEntry extends ClassEntry implements DefEntry<ClassEntry> { | |||
| 53 | return new ClassDefEntry(name, Signature.createSignature(signature), new AccessFlags(access), superClass, interfaceClasses); | 52 | return new ClassDefEntry(name, Signature.createSignature(signature), new AccessFlags(access), superClass, interfaceClasses); |
| 54 | } | 53 | } |
| 55 | 54 | ||
| 56 | public static ClassDefEntry parse(TypeDefinition def) { | ||
| 57 | String name = def.getInternalName(); | ||
| 58 | Signature signature = Signature.createSignature(def.getSignature()); | ||
| 59 | AccessFlags access = new AccessFlags(def.getModifiers()); | ||
| 60 | ClassEntry superClass = def.getBaseType() != null ? ClassEntry.parse(def.getBaseType()) : null; | ||
| 61 | ClassEntry[] interfaces = def.getExplicitInterfaces().stream().map(ClassEntry::parse).toArray(ClassEntry[]::new); | ||
| 62 | return new ClassDefEntry(name, signature, access, superClass, interfaces); | ||
| 63 | } | ||
| 64 | |||
| 65 | public Signature getSignature() { | 55 | public Signature getSignature() { |
| 66 | return signature; | 56 | return signature; |
| 67 | } | 57 | } |
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 @@ | |||
| 11 | 11 | ||
| 12 | package cuchaz.enigma.translation.representation.entry; | 12 | package cuchaz.enigma.translation.representation.entry; |
| 13 | 13 | ||
| 14 | import com.strobel.assembler.metadata.TypeReference; | ||
| 15 | import cuchaz.enigma.throwables.IllegalNameException; | 14 | import cuchaz.enigma.throwables.IllegalNameException; |
| 16 | import cuchaz.enigma.translation.Translator; | 15 | import cuchaz.enigma.translation.Translator; |
| 17 | import cuchaz.enigma.translation.mapping.EntryMapping; | 16 | import cuchaz.enigma.translation.mapping.EntryMapping; |
| @@ -47,10 +46,6 @@ public class ClassEntry extends ParentedEntry<ClassEntry> implements Comparable< | |||
| 47 | } | 46 | } |
| 48 | } | 47 | } |
| 49 | 48 | ||
| 50 | public static ClassEntry parse(TypeReference typeReference) { | ||
| 51 | return new ClassEntry(typeReference.getInternalName()); | ||
| 52 | } | ||
| 53 | |||
| 54 | @Override | 49 | @Override |
| 55 | public Class<ClassEntry> getParentType() { | 50 | public Class<ClassEntry> getParentType() { |
| 56 | return ClassEntry.class; | 51 | 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 @@ | |||
| 12 | package cuchaz.enigma.translation.representation.entry; | 12 | package cuchaz.enigma.translation.representation.entry; |
| 13 | 13 | ||
| 14 | import com.google.common.base.Preconditions; | 14 | import com.google.common.base.Preconditions; |
| 15 | import com.strobel.assembler.metadata.FieldDefinition; | ||
| 16 | import cuchaz.enigma.translation.Translator; | 15 | import cuchaz.enigma.translation.Translator; |
| 17 | import cuchaz.enigma.translation.mapping.EntryMapping; | 16 | import cuchaz.enigma.translation.mapping.EntryMapping; |
| 18 | import cuchaz.enigma.translation.representation.AccessFlags; | 17 | import cuchaz.enigma.translation.representation.AccessFlags; |
| @@ -41,14 +40,6 @@ public class FieldDefEntry extends FieldEntry implements DefEntry<ClassEntry> { | |||
| 41 | return new FieldDefEntry(owner, name, new TypeDescriptor(desc), Signature.createTypedSignature(signature), new AccessFlags(access), null); | 40 | return new FieldDefEntry(owner, name, new TypeDescriptor(desc), Signature.createTypedSignature(signature), new AccessFlags(access), null); |
| 42 | } | 41 | } |
| 43 | 42 | ||
| 44 | public static FieldDefEntry parse(FieldDefinition definition) { | ||
| 45 | ClassEntry owner = ClassEntry.parse(definition.getDeclaringType()); | ||
| 46 | TypeDescriptor descriptor = new TypeDescriptor(definition.getErasedSignature()); | ||
| 47 | Signature signature = Signature.createTypedSignature(definition.getSignature()); | ||
| 48 | AccessFlags access = new AccessFlags(definition.getModifiers()); | ||
| 49 | return new FieldDefEntry(owner, definition.getName(), descriptor, signature, access, null); | ||
| 50 | } | ||
| 51 | |||
| 52 | @Override | 43 | @Override |
| 53 | public AccessFlags getAccess() { | 44 | public AccessFlags getAccess() { |
| 54 | return access; | 45 | 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 @@ | |||
| 12 | package cuchaz.enigma.translation.representation.entry; | 12 | package cuchaz.enigma.translation.representation.entry; |
| 13 | 13 | ||
| 14 | import com.google.common.base.Preconditions; | 14 | import com.google.common.base.Preconditions; |
| 15 | import com.strobel.assembler.metadata.MethodDefinition; | ||
| 16 | import cuchaz.enigma.translation.Translator; | 15 | import cuchaz.enigma.translation.Translator; |
| 17 | import cuchaz.enigma.translation.mapping.EntryMapping; | 16 | import cuchaz.enigma.translation.mapping.EntryMapping; |
| 18 | import cuchaz.enigma.translation.representation.AccessFlags; | 17 | import cuchaz.enigma.translation.representation.AccessFlags; |
| @@ -41,14 +40,6 @@ public class MethodDefEntry extends MethodEntry implements DefEntry<ClassEntry> | |||
| 41 | return new MethodDefEntry(owner, name, new MethodDescriptor(desc), Signature.createSignature(signature), new AccessFlags(access), null); | 40 | return new MethodDefEntry(owner, name, new MethodDescriptor(desc), Signature.createSignature(signature), new AccessFlags(access), null); |
| 42 | } | 41 | } |
| 43 | 42 | ||
| 44 | public static MethodDefEntry parse(MethodDefinition definition) { | ||
| 45 | ClassEntry classEntry = ClassEntry.parse(definition.getDeclaringType()); | ||
| 46 | MethodDescriptor descriptor = new MethodDescriptor(definition.getErasedSignature()); | ||
| 47 | Signature signature = Signature.createSignature(definition.getSignature()); | ||
| 48 | AccessFlags access = new AccessFlags(definition.getModifiers()); | ||
| 49 | return new MethodDefEntry(classEntry, definition.getName(), descriptor, signature, access, null); | ||
| 50 | } | ||
| 51 | |||
| 52 | @Override | 43 | @Override |
| 53 | public AccessFlags getAccess() { | 44 | public AccessFlags getAccess() { |
| 54 | return access; | 45 | return access; |