From a88175ffc95792b88a8724f66db6dda2b8cc32ee Mon Sep 17 00:00:00 2001 From: gegy1000 Date: Tue, 17 Jul 2018 19:14:08 +0200 Subject: ASM Based Class Translator (#1) * Initial port to ASM * Package updates * Annotation + inner class translation * Fix inner class mapping * More bytecode translation * Signature refactoring * Fix highlighting of mapped names * Fix parameter name offset * Fix anonymous class generation * Fix issues with inner class signature transformation * Fix bridged method detection * Fix compile issues * Resolve all failed tests * Apply deobfuscated name to transformed classes * Fix class signatures not being translated * Fix frame array type translation * Fix frame array type translation * Fix array translation in method calls * Fix method reference and bridge detection * Fix handling of null deobf mappings * Parameter translation in interfaces * Fix enum parameter index offset * Fix parsed local variable indexing * Fix stackoverflow on rebuilding method names * Ignore invalid decompiled variable indices * basic source jar * Output directly to file on source export * Make decompile parallel * fix incorrect super calls * Use previous save state to delete old mapping files * Fix old mappings not properly being removed * Fix old mappings not properly being removed * make isMethodProvider public (cherry picked from commit ebad6a9) * speed up Deobfuscator's getSources by using a single TranslatingTypeloader and caching the ClassLoaderTypeloader * ignore .idea project folders * move SynchronizedTypeLoader to a non-inner * fix signature remap of inners for now * index & resolve method/field references for usages view * Allow reader/writer subclasses to provide the underlying file operations * fix giving obf classes a name not removing them from the panel * buffer the ParsedJar class entry inputstream, allow use with a jarinputstream * make CachingClasspathTypeLoader public * make CachingClasspathTypeLoader public * support enum switches with obfuscated SwitchMaps --- .../cuchaz/enigma/mapping/entry/ClassDefEntry.java | 37 +++++ .../cuchaz/enigma/mapping/entry/ClassEntry.java | 175 +++++++++++++++++++++ .../java/cuchaz/enigma/mapping/entry/Entry.java | 22 +++ .../cuchaz/enigma/mapping/entry/EntryFactory.java | 49 ++++++ .../cuchaz/enigma/mapping/entry/FieldDefEntry.java | 43 +++++ .../cuchaz/enigma/mapping/entry/FieldEntry.java | 77 +++++++++ .../mapping/entry/LocalVariableDefEntry.java | 57 +++++++ .../enigma/mapping/entry/LocalVariableEntry.java | 82 ++++++++++ .../enigma/mapping/entry/MethodDefEntry.java | 54 +++++++ .../cuchaz/enigma/mapping/entry/MethodEntry.java | 80 ++++++++++ .../enigma/mapping/entry/ProcyonEntryFactory.java | 48 ++++++ .../enigma/mapping/entry/ReferencedEntryPool.java | 53 +++++++ 12 files changed, 777 insertions(+) create mode 100644 src/main/java/cuchaz/enigma/mapping/entry/ClassDefEntry.java create mode 100644 src/main/java/cuchaz/enigma/mapping/entry/ClassEntry.java create mode 100644 src/main/java/cuchaz/enigma/mapping/entry/Entry.java create mode 100644 src/main/java/cuchaz/enigma/mapping/entry/EntryFactory.java create mode 100644 src/main/java/cuchaz/enigma/mapping/entry/FieldDefEntry.java create mode 100644 src/main/java/cuchaz/enigma/mapping/entry/FieldEntry.java create mode 100644 src/main/java/cuchaz/enigma/mapping/entry/LocalVariableDefEntry.java create mode 100644 src/main/java/cuchaz/enigma/mapping/entry/LocalVariableEntry.java create mode 100644 src/main/java/cuchaz/enigma/mapping/entry/MethodDefEntry.java create mode 100644 src/main/java/cuchaz/enigma/mapping/entry/MethodEntry.java create mode 100644 src/main/java/cuchaz/enigma/mapping/entry/ProcyonEntryFactory.java create mode 100644 src/main/java/cuchaz/enigma/mapping/entry/ReferencedEntryPool.java (limited to 'src/main/java/cuchaz/enigma/mapping/entry') diff --git a/src/main/java/cuchaz/enigma/mapping/entry/ClassDefEntry.java b/src/main/java/cuchaz/enigma/mapping/entry/ClassDefEntry.java new file mode 100644 index 0000000..ac1fe2a --- /dev/null +++ b/src/main/java/cuchaz/enigma/mapping/entry/ClassDefEntry.java @@ -0,0 +1,37 @@ +/******************************************************************************* + * Copyright (c) 2015 Jeff Martin. + * All rights reserved. This program and the accompanying materials + * are made available under the terms of the GNU Lesser General Public + * License v3.0 which accompanies this distribution, and is available at + * http://www.gnu.org/licenses/lgpl.html + *
+ * Contributors: + * Jeff Martin - initial API and implementation + ******************************************************************************/ + +package cuchaz.enigma.mapping.entry; + +import com.google.common.base.Preconditions; +import cuchaz.enigma.bytecode.AccessFlags; +import cuchaz.enigma.mapping.Signature; + +public class ClassDefEntry extends ClassEntry { + private final AccessFlags access; + private final Signature signature; + + public ClassDefEntry(String className, Signature signature, AccessFlags access) { + super(className); + Preconditions.checkNotNull(signature, "Class signature cannot be null"); + Preconditions.checkNotNull(access, "Class access cannot be null"); + this.signature = signature; + this.access = access; + } + + public Signature getSignature() { + return signature; + } + + public AccessFlags getAccess() { + return access; + } +} diff --git a/src/main/java/cuchaz/enigma/mapping/entry/ClassEntry.java b/src/main/java/cuchaz/enigma/mapping/entry/ClassEntry.java new file mode 100644 index 0000000..c795825 --- /dev/null +++ b/src/main/java/cuchaz/enigma/mapping/entry/ClassEntry.java @@ -0,0 +1,175 @@ +/******************************************************************************* + * Copyright (c) 2015 Jeff Martin. + * All rights reserved. This program and the accompanying materials + * are made available under the terms of the GNU Lesser General Public + * License v3.0 which accompanies this distribution, and is available at + * http://www.gnu.org/licenses/lgpl.html + *
+ * Contributors:
+ * Jeff Martin - initial API and implementation
+ ******************************************************************************/
+
+package cuchaz.enigma.mapping.entry;
+
+import com.google.common.base.Preconditions;
+import com.google.common.collect.Lists;
+
+import java.util.List;
+
+public class ClassEntry implements Entry {
+
+ private final String name;
+
+ public ClassEntry(String className) {
+ Preconditions.checkNotNull(className, "Class name cannot be null");
+
+ if (className.indexOf('.') >= 0) {
+ throw new IllegalArgumentException("Class name must be in JVM format. ie, path/to/package/class$inner : " + className);
+ }
+
+ this.name = className;
+
+ if (isInnerClass() && getInnermostClassName().indexOf('/') >= 0) {
+ throw new IllegalArgumentException("Inner class must not have a package: " + className);
+ }
+ }
+
+ public ClassEntry(ClassEntry other) {
+ this.name = other.name;
+ }
+
+ @Override
+ public String getName() {
+ return this.name;
+ }
+
+ @Override
+ public String getClassName() {
+ return this.name;
+ }
+
+ @Override
+ public ClassEntry getOwnerClassEntry() {
+ return this;
+ }
+
+ @Override
+ public ClassEntry updateOwnership(ClassEntry classEntry) {
+ return classEntry;
+ }
+
+ @Override
+ public int hashCode() {
+ return this.name.hashCode();
+ }
+
+ @Override
+ public boolean equals(Object other) {
+ return other instanceof ClassEntry && equals((ClassEntry) other);
+ }
+
+ public boolean equals(ClassEntry other) {
+ return other != null && this.name.equals(other.name);
+ }
+
+ @Override
+ public String toString() {
+ return this.name;
+ }
+
+ public boolean isArray() {
+ return this.name.lastIndexOf('[') >= 0;
+ }
+
+ public boolean isInnerClass() {
+ return this.name.lastIndexOf('$') >= 0;
+ }
+
+ public List
+ * Contributors:
+ * Jeff Martin - initial API and implementation
+ ******************************************************************************/
+
+package cuchaz.enigma.mapping.entry;
+
+public interface Entry {
+ String getName();
+
+ String getClassName();
+
+ ClassEntry getOwnerClassEntry();
+
+ Entry updateOwnership(ClassEntry classEntry);
+}
diff --git a/src/main/java/cuchaz/enigma/mapping/entry/EntryFactory.java b/src/main/java/cuchaz/enigma/mapping/entry/EntryFactory.java
new file mode 100644
index 0000000..5bd159f
--- /dev/null
+++ b/src/main/java/cuchaz/enigma/mapping/entry/EntryFactory.java
@@ -0,0 +1,49 @@
+/*******************************************************************************
+ * Copyright (c) 2015 Jeff Martin.
+ * All rights reserved. This program and the accompanying materials
+ * are made available under the terms of the GNU Lesser General Public
+ * License v3.0 which accompanies this distribution, and is available at
+ * http://www.gnu.org/licenses/lgpl.html
+ *
+ * Contributors:
+ * Jeff Martin - initial API and implementation
+ ******************************************************************************/
+
+package cuchaz.enigma.mapping.entry;
+
+import cuchaz.enigma.analysis.JarIndex;
+import cuchaz.enigma.mapping.ClassMapping;
+import cuchaz.enigma.mapping.FieldMapping;
+import cuchaz.enigma.mapping.MethodDescriptor;
+import cuchaz.enigma.mapping.MethodMapping;
+
+public class EntryFactory {
+ public static ClassEntry getObfClassEntry(JarIndex jarIndex, ClassMapping classMapping) {
+ ClassEntry obfClassEntry = new ClassEntry(classMapping.getObfFullName());
+ return obfClassEntry.buildClassEntry(jarIndex.getObfClassChain(obfClassEntry));
+ }
+
+ private static ClassEntry getObfClassEntry(ClassMapping classMapping) {
+ return new ClassEntry(classMapping.getObfFullName());
+ }
+
+ public static ClassEntry getDeobfClassEntry(ClassMapping classMapping) {
+ return new ClassEntry(classMapping.getDeobfName());
+ }
+
+ public static FieldEntry getObfFieldEntry(ClassMapping classMapping, FieldMapping fieldMapping) {
+ return new FieldEntry(getObfClassEntry(classMapping), fieldMapping.getObfName(), fieldMapping.getObfDesc());
+ }
+
+ public static MethodEntry getMethodEntry(ClassEntry classEntry, String name, MethodDescriptor desc) {
+ return new MethodEntry(classEntry, name, desc);
+ }
+
+ public static MethodEntry getObfMethodEntry(ClassEntry classEntry, MethodMapping methodMapping) {
+ return getMethodEntry(classEntry, methodMapping.getObfName(), methodMapping.getObfDesc());
+ }
+
+ public static MethodEntry getObfMethodEntry(ClassMapping classMapping, MethodMapping methodMapping) {
+ return getObfMethodEntry(getObfClassEntry(classMapping), methodMapping);
+ }
+}
diff --git a/src/main/java/cuchaz/enigma/mapping/entry/FieldDefEntry.java b/src/main/java/cuchaz/enigma/mapping/entry/FieldDefEntry.java
new file mode 100644
index 0000000..d18115b
--- /dev/null
+++ b/src/main/java/cuchaz/enigma/mapping/entry/FieldDefEntry.java
@@ -0,0 +1,43 @@
+/*******************************************************************************
+ * Copyright (c) 2015 Jeff Martin.
+ * All rights reserved. This program and the accompanying materials
+ * are made available under the terms of the GNU Lesser General Public
+ * License v3.0 which accompanies this distribution, and is available at
+ * http://www.gnu.org/licenses/lgpl.html
+ *
+ * Contributors:
+ * Jeff Martin - initial API and implementation
+ ******************************************************************************/
+
+package cuchaz.enigma.mapping.entry;
+
+import com.google.common.base.Preconditions;
+import cuchaz.enigma.bytecode.AccessFlags;
+import cuchaz.enigma.mapping.Signature;
+import cuchaz.enigma.mapping.TypeDescriptor;
+
+public class FieldDefEntry extends FieldEntry {
+ private final AccessFlags access;
+ private final Signature signature;
+
+ public FieldDefEntry(ClassEntry ownerEntry, String name, TypeDescriptor desc, Signature signature, AccessFlags access) {
+ super(ownerEntry, name, desc);
+ Preconditions.checkNotNull(access, "Field access cannot be null");
+ Preconditions.checkNotNull(signature, "Field signature cannot be null");
+ this.access = access;
+ this.signature = signature;
+ }
+
+ public AccessFlags getAccess() {
+ return access;
+ }
+
+ public Signature getSignature() {
+ return signature;
+ }
+
+ @Override
+ public FieldDefEntry updateOwnership(ClassEntry owner) {
+ return new FieldDefEntry(owner, this.name, this.desc, signature, access);
+ }
+}
diff --git a/src/main/java/cuchaz/enigma/mapping/entry/FieldEntry.java b/src/main/java/cuchaz/enigma/mapping/entry/FieldEntry.java
new file mode 100644
index 0000000..b6e1554
--- /dev/null
+++ b/src/main/java/cuchaz/enigma/mapping/entry/FieldEntry.java
@@ -0,0 +1,77 @@
+/*******************************************************************************
+ * Copyright (c) 2015 Jeff Martin.
+ * All rights reserved. This program and the accompanying materials
+ * are made available under the terms of the GNU Lesser General Public
+ * License v3.0 which accompanies this distribution, and is available at
+ * http://www.gnu.org/licenses/lgpl.html
+ *
+ * Contributors:
+ * Jeff Martin - initial API and implementation
+ ******************************************************************************/
+
+package cuchaz.enigma.mapping.entry;
+
+import com.google.common.base.Preconditions;
+import cuchaz.enigma.mapping.TypeDescriptor;
+import cuchaz.enigma.utils.Utils;
+
+public class FieldEntry implements Entry {
+
+ protected final ClassEntry ownerEntry;
+ protected final String name;
+ protected final TypeDescriptor desc;
+
+ // NOTE: this argument order is important for the MethodReader/MethodWriter
+ public FieldEntry(ClassEntry ownerEntry, String name, TypeDescriptor desc) {
+ Preconditions.checkNotNull(ownerEntry, "Owner cannot be null");
+ Preconditions.checkNotNull(name, "Field name cannot be null");
+ Preconditions.checkNotNull(desc, "Field descriptor cannot be null");
+
+ this.ownerEntry = ownerEntry;
+ this.name = name;
+ this.desc = desc;
+ }
+
+ @Override
+ public ClassEntry getOwnerClassEntry() {
+ return this.ownerEntry;
+ }
+
+ @Override
+ public String getName() {
+ return this.name;
+ }
+
+ @Override
+ public String getClassName() {
+ return this.ownerEntry.getName();
+ }
+
+ public TypeDescriptor getDesc() {
+ return this.desc;
+ }
+
+ @Override
+ public FieldEntry updateOwnership(ClassEntry owner) {
+ return new FieldEntry(owner, this.name, this.desc);
+ }
+
+ @Override
+ public int hashCode() {
+ return Utils.combineHashesOrdered(this.ownerEntry, this.name, this.desc);
+ }
+
+ @Override
+ public boolean equals(Object other) {
+ return other instanceof FieldEntry && equals((FieldEntry) other);
+ }
+
+ public boolean equals(FieldEntry other) {
+ return this.ownerEntry.equals(other.ownerEntry) && this.name.equals(other.name) && this.desc.equals(other.desc);
+ }
+
+ @Override
+ public String toString() {
+ return this.ownerEntry.getName() + "." + this.name + ":" + this.desc;
+ }
+}
diff --git a/src/main/java/cuchaz/enigma/mapping/entry/LocalVariableDefEntry.java b/src/main/java/cuchaz/enigma/mapping/entry/LocalVariableDefEntry.java
new file mode 100644
index 0000000..7742272
--- /dev/null
+++ b/src/main/java/cuchaz/enigma/mapping/entry/LocalVariableDefEntry.java
@@ -0,0 +1,57 @@
+package cuchaz.enigma.mapping.entry;
+
+import com.google.common.base.Preconditions;
+import cuchaz.enigma.mapping.TypeDescriptor;
+import cuchaz.enigma.utils.Utils;
+
+/**
+ * TypeDescriptor...
+ * Created by Thog
+ * 19/10/2016
+ */
+public class LocalVariableDefEntry extends LocalVariableEntry {
+
+ protected final MethodDefEntry ownerEntry;
+ protected final TypeDescriptor desc;
+
+ public LocalVariableDefEntry(MethodDefEntry ownerEntry, int index, String name, TypeDescriptor desc) {
+ super(ownerEntry, index, name);
+ Preconditions.checkNotNull(desc, "Variable desc cannot be null");
+
+ this.ownerEntry = ownerEntry;
+ this.desc = desc;
+ }
+
+ @Override
+ public MethodDefEntry getOwnerEntry() {
+ return this.ownerEntry;
+ }
+
+ public TypeDescriptor getDesc() {
+ return desc;
+ }
+
+ @Override
+ public LocalVariableDefEntry updateOwnership(ClassEntry classEntry) {
+ return new LocalVariableDefEntry(ownerEntry.updateOwnership(classEntry), index, name, desc);
+ }
+
+ @Override
+ public int hashCode() {
+ return Utils.combineHashesOrdered(this.ownerEntry, this.desc.hashCode(), this.name.hashCode(), Integer.hashCode(this.index));
+ }
+
+ @Override
+ public boolean equals(Object other) {
+ return other instanceof LocalVariableDefEntry && equals((LocalVariableDefEntry) other);
+ }
+
+ public boolean equals(LocalVariableDefEntry other) {
+ return this.ownerEntry.equals(other.ownerEntry) && this.desc.equals(other.desc) && this.name.equals(other.name) && this.index == other.index;
+ }
+
+ @Override
+ public String toString() {
+ return this.ownerEntry + "(" + this.index + ":" + this.name + ":" + this.desc + ")";
+ }
+}
diff --git a/src/main/java/cuchaz/enigma/mapping/entry/LocalVariableEntry.java b/src/main/java/cuchaz/enigma/mapping/entry/LocalVariableEntry.java
new file mode 100644
index 0000000..a794d0a
--- /dev/null
+++ b/src/main/java/cuchaz/enigma/mapping/entry/LocalVariableEntry.java
@@ -0,0 +1,82 @@
+package cuchaz.enigma.mapping.entry;
+
+import com.google.common.base.Preconditions;
+import cuchaz.enigma.mapping.MethodDescriptor;
+import cuchaz.enigma.utils.Utils;
+
+/**
+ * TypeDescriptor...
+ * Created by Thog
+ * 19/10/2016
+ */
+public class LocalVariableEntry implements Entry {
+
+ protected final MethodEntry ownerEntry;
+ protected final String name;
+ protected final int index;
+
+ public LocalVariableEntry(MethodEntry ownerEntry, int index, String name) {
+ Preconditions.checkNotNull(ownerEntry, "Variable owner cannot be null");
+ Preconditions.checkNotNull(name, "Variable name cannot be null");
+ Preconditions.checkArgument(index >= 0, "Index must be positive");
+
+ this.ownerEntry = ownerEntry;
+ this.name = name;
+ this.index = index;
+ }
+
+ public MethodEntry getOwnerEntry() {
+ return this.ownerEntry;
+ }
+
+ public int getIndex() {
+ return index;
+ }
+
+ @Override
+ public String getName() {
+ return this.name;
+ }
+
+ @Override
+ public ClassEntry getOwnerClassEntry() {
+ return this.ownerEntry.getOwnerClassEntry();
+ }
+
+ @Override
+ public String getClassName() {
+ return this.ownerEntry.getClassName();
+ }
+
+ @Override
+ public LocalVariableEntry updateOwnership(ClassEntry classEntry) {
+ return new LocalVariableEntry(ownerEntry.updateOwnership(classEntry), index, name);
+ }
+
+ public String getMethodName() {
+ return this.ownerEntry.getName();
+ }
+
+ public MethodDescriptor getMethodDesc() {
+ return this.ownerEntry.getDesc();
+ }
+
+ @Override
+ public int hashCode() {
+ return Utils.combineHashesOrdered(this.ownerEntry, this.name.hashCode(), Integer.hashCode(this.index));
+ }
+
+ @Override
+ public boolean equals(Object other) {
+ return other instanceof LocalVariableEntry && equals((LocalVariableEntry) other);
+ }
+
+ public boolean equals(LocalVariableEntry other) {
+ return this.ownerEntry.equals(other.ownerEntry) && this.name.equals(other.name) && this.index == other.index;
+ }
+
+ @Override
+ public String toString() {
+ return this.ownerEntry + "(" + this.index + ":" + this.name + ")";
+ }
+}
diff --git a/src/main/java/cuchaz/enigma/mapping/entry/MethodDefEntry.java b/src/main/java/cuchaz/enigma/mapping/entry/MethodDefEntry.java
new file mode 100644
index 0000000..bb7c85e
--- /dev/null
+++ b/src/main/java/cuchaz/enigma/mapping/entry/MethodDefEntry.java
@@ -0,0 +1,54 @@
+/*******************************************************************************
+ * Copyright (c) 2015 Jeff Martin.
+ * All rights reserved. This program and the accompanying materials
+ * are made available under the terms of the GNU Lesser General Public
+ * License v3.0 which accompanies this distribution, and is available at
+ * http://www.gnu.org/licenses/lgpl.html
+ *
+ * Contributors:
+ * Jeff Martin - initial API and implementation
+ ******************************************************************************/
+
+package cuchaz.enigma.mapping.entry;
+
+import com.google.common.base.Preconditions;
+import cuchaz.enigma.bytecode.AccessFlags;
+import cuchaz.enigma.mapping.MethodDescriptor;
+import cuchaz.enigma.mapping.Signature;
+
+public class MethodDefEntry extends MethodEntry {
+
+ private final AccessFlags access;
+ private final Signature signature;
+
+ public MethodDefEntry(ClassEntry classEntry, String name, MethodDescriptor descriptor, Signature signature, AccessFlags access) {
+ super(classEntry, name, descriptor);
+ Preconditions.checkNotNull(access, "Method access cannot be null");
+ Preconditions.checkNotNull(signature, "Method signature cannot be null");
+ this.access = access;
+ this.signature = signature;
+ }
+
+ public AccessFlags getAccess() {
+ return access;
+ }
+
+ public Signature getSignature() {
+ return signature;
+ }
+
+ public int getVariableOffset(ClassDefEntry ownerEntry) {
+ // Enum constructors have an implicit "name" and "ordinal" parameter as well as "this"
+ if (ownerEntry.getAccess().isEnum() && getName().startsWith("<")) {
+ return 3;
+ } else {
+ // If we're not static, "this" is bound to index 0
+ return getAccess().isStatic() ? 0 : 1;
+ }
+ }
+
+ @Override
+ public MethodDefEntry updateOwnership(ClassEntry classEntry) {
+ return new MethodDefEntry(new ClassEntry(classEntry.getName()), name, descriptor, signature, access);
+ }
+}
diff --git a/src/main/java/cuchaz/enigma/mapping/entry/MethodEntry.java b/src/main/java/cuchaz/enigma/mapping/entry/MethodEntry.java
new file mode 100644
index 0000000..1abc5b1
--- /dev/null
+++ b/src/main/java/cuchaz/enigma/mapping/entry/MethodEntry.java
@@ -0,0 +1,80 @@
+/*******************************************************************************
+ * Copyright (c) 2015 Jeff Martin.
+ * All rights reserved. This program and the accompanying materials
+ * are made available under the terms of the GNU Lesser General Public
+ * License v3.0 which accompanies this distribution, and is available at
+ * http://www.gnu.org/licenses/lgpl.html
+ *
+ * Contributors:
+ * Jeff Martin - initial API and implementation
+ ******************************************************************************/
+
+package cuchaz.enigma.mapping.entry;
+
+import com.google.common.base.Preconditions;
+import cuchaz.enigma.mapping.MethodDescriptor;
+import cuchaz.enigma.utils.Utils;
+
+public class MethodEntry implements Entry {
+
+ protected final ClassEntry classEntry;
+ protected final String name;
+ protected final MethodDescriptor descriptor;
+
+ public MethodEntry(ClassEntry classEntry, String name, MethodDescriptor descriptor) {
+ Preconditions.checkNotNull(classEntry, "Class cannot be null");
+ Preconditions.checkNotNull(name, "Method name cannot be null");
+ Preconditions.checkNotNull(descriptor, "Method descriptor cannot be null");
+
+ this.classEntry = classEntry;
+ this.name = name;
+ this.descriptor = descriptor;
+ }
+
+ @Override
+ public ClassEntry getOwnerClassEntry() {
+ return this.classEntry;
+ }
+
+ @Override
+ public String getName() {
+ return this.name;
+ }
+
+ public MethodDescriptor getDesc() {
+ return this.descriptor;
+ }
+
+ public boolean isConstructor() {
+ return name.equals("
+ * Contributors:
+ * Jeff Martin - initial API and implementation
+ ******************************************************************************/
+
+package cuchaz.enigma.mapping.entry;
+
+import com.strobel.assembler.metadata.FieldDefinition;
+import com.strobel.assembler.metadata.MemberReference;
+import com.strobel.assembler.metadata.MethodDefinition;
+import cuchaz.enigma.bytecode.AccessFlags;
+import cuchaz.enigma.mapping.MethodDescriptor;
+import cuchaz.enigma.mapping.Signature;
+import cuchaz.enigma.mapping.TypeDescriptor;
+
+public class ProcyonEntryFactory {
+ private final ReferencedEntryPool entryPool;
+
+ public ProcyonEntryFactory(ReferencedEntryPool entryPool) {
+ this.entryPool = entryPool;
+ }
+
+ public FieldEntry getFieldEntry(MemberReference def) {
+ ClassEntry classEntry = entryPool.getClass(def.getDeclaringType().getInternalName());
+ return entryPool.getField(classEntry, def.getName(), def.getErasedSignature());
+ }
+
+ public FieldDefEntry getFieldDefEntry(FieldDefinition def) {
+ ClassEntry classEntry = entryPool.getClass(def.getDeclaringType().getInternalName());
+ return new FieldDefEntry(classEntry, def.getName(), new TypeDescriptor(def.getErasedSignature()), Signature.createTypedSignature(def.getSignature()), new AccessFlags(def.getModifiers()));
+ }
+
+ public MethodEntry getMethodEntry(MemberReference def) {
+ ClassEntry classEntry = entryPool.getClass(def.getDeclaringType().getInternalName());
+ return entryPool.getMethod(classEntry, def.getName(), def.getErasedSignature());
+ }
+
+ public MethodDefEntry getMethodDefEntry(MethodDefinition def) {
+ ClassEntry classEntry = entryPool.getClass(def.getDeclaringType().getInternalName());
+ return new MethodDefEntry(classEntry, def.getName(), new MethodDescriptor(def.getErasedSignature()), Signature.createSignature(def.getSignature()), new AccessFlags(def.getModifiers()));
+ }
+}
diff --git a/src/main/java/cuchaz/enigma/mapping/entry/ReferencedEntryPool.java b/src/main/java/cuchaz/enigma/mapping/entry/ReferencedEntryPool.java
new file mode 100644
index 0000000..338d209
--- /dev/null
+++ b/src/main/java/cuchaz/enigma/mapping/entry/ReferencedEntryPool.java
@@ -0,0 +1,53 @@
+/*******************************************************************************
+ * Copyright (c) 2015 Jeff Martin.
+ * All rights reserved. This program and the accompanying materials
+ * are made available under the terms of the GNU Lesser General Public
+ * License v3.0 which accompanies this distribution, and is available at
+ * http://www.gnu.org/licenses/lgpl.html
+ *
+ * Contributors:
+ * Jeff Martin - initial API and implementation
+ ******************************************************************************/
+
+package cuchaz.enigma.mapping.entry;
+
+import cuchaz.enigma.mapping.MethodDescriptor;
+import cuchaz.enigma.mapping.TypeDescriptor;
+
+import java.util.HashMap;
+import java.util.Map;
+
+public class ReferencedEntryPool {
+ private final Map