From 59e189bef2b5e6d129fb7c2c988ed0b2130e36ac Mon Sep 17 00:00:00 2001 From: lclc98 Date: Mon, 4 Jul 2016 18:14:22 +1000 Subject: Reformat --- .../cuchaz/enigma/analysis/TranslationIndex.java | 41 +++------------------- 1 file changed, 5 insertions(+), 36 deletions(-) (limited to 'src/main/java/cuchaz/enigma/analysis/TranslationIndex.java') diff --git a/src/main/java/cuchaz/enigma/analysis/TranslationIndex.java b/src/main/java/cuchaz/enigma/analysis/TranslationIndex.java index 3d8f556..275f56c 100644 --- a/src/main/java/cuchaz/enigma/analysis/TranslationIndex.java +++ b/src/main/java/cuchaz/enigma/analysis/TranslationIndex.java @@ -15,10 +15,10 @@ import com.google.common.collect.Lists; import com.google.common.collect.Maps; import com.google.common.collect.Multimap; -import java.io.*; -import java.util.*; -import java.util.zip.GZIPInputStream; -import java.util.zip.GZIPOutputStream; +import java.util.Collection; +import java.util.List; +import java.util.Map; +import java.util.Set; import cuchaz.enigma.mapping.*; import javassist.CtBehavior; @@ -26,9 +26,7 @@ import javassist.CtClass; import javassist.CtField; import javassist.bytecode.Descriptor; -public class TranslationIndex implements Serializable { - - private static final long serialVersionUID = 738687982126844179L; +public class TranslationIndex { private Map superclasses; private Multimap fieldEntries; @@ -43,7 +41,6 @@ public class TranslationIndex implements Serializable { } public TranslationIndex(TranslationIndex other, Translator translator) { - // translate the superclasses this.superclasses = Maps.newHashMap(); for (Map.Entry mapEntry : other.superclasses.entrySet()) { @@ -82,7 +79,6 @@ public class TranslationIndex implements Serializable { } public void indexClass(CtClass c, boolean indexMembers) { - ClassEntry classEntry = EntryFactory.getClassEntry(c); if (isJre(classEntry)) { return; @@ -139,7 +135,6 @@ public class TranslationIndex implements Serializable { } public List getSubclass(ClassEntry classEntry) { - // linear search is fast enough for now List subclasses = Lists.newArrayList(); for (Map.Entry entry : this.superclasses.entrySet()) { @@ -191,7 +186,6 @@ public class TranslationIndex implements Serializable { } public ClassEntry resolveEntryClass(Entry entry) { - if (entry instanceof ClassEntry) { return (ClassEntry) entry; } @@ -210,7 +204,6 @@ public class TranslationIndex implements Serializable { } public ClassEntry resolveSuperclass(Entry entry) { - // this entry could refer to a method on a class where the method is not actually implemented // travel up the inheritance tree to find the closest implementation while (!entryExists(entry)) { @@ -230,7 +223,6 @@ public class TranslationIndex implements Serializable { } public ClassEntry resolveInterface(Entry entry) { - // the interfaces for any class is a forest // so let's look at all the trees for (ClassEntry interfaceEntry : this.interfaces.get(entry.getClassEntry())) { @@ -246,27 +238,4 @@ public class TranslationIndex implements Serializable { String packageName = classEntry.getPackageName(); return packageName != null && (packageName.startsWith("java") || packageName.startsWith("javax")); } - - public void write(OutputStream out) - throws IOException { - GZIPOutputStream gzipout = new GZIPOutputStream(out); - ObjectOutputStream oout = new ObjectOutputStream(gzipout); - oout.writeObject(this.superclasses); - oout.writeObject(this.fieldEntries); - oout.writeObject(this.behaviorEntries); - gzipout.finish(); - } - - @SuppressWarnings("unchecked") - public void read(InputStream in) - throws IOException { - try { - ObjectInputStream oin = new ObjectInputStream(new GZIPInputStream(in)); - this.superclasses = (HashMap) oin.readObject(); - this.fieldEntries = (HashMultimap) oin.readObject(); - this.behaviorEntries = (HashMultimap) oin.readObject(); - } catch (ClassNotFoundException ex) { - throw new Error(ex); - } - } } -- cgit v1.2.3