summaryrefslogtreecommitdiff
path: root/src/cuchaz/enigma/Deobfuscator.java
diff options
context:
space:
mode:
authorGravatar jeff2014-08-18 22:09:24 -0400
committerGravatar jeff2014-08-18 22:09:24 -0400
commit58fe3a4ec77507345bc2a96857b04534bcb845a7 (patch)
tree7f560c031c32c4d851b1b470fe38089e7915734b /src/cuchaz/enigma/Deobfuscator.java
parentfixed about dialog (diff)
downloadenigma-fork-58fe3a4ec77507345bc2a96857b04534bcb845a7.tar.gz
enigma-fork-58fe3a4ec77507345bc2a96857b04534bcb845a7.tar.xz
enigma-fork-58fe3a4ec77507345bc2a96857b04534bcb845a7.zip
fixed type caching after rename
allowed enums constants to be renamable
Diffstat (limited to 'src/cuchaz/enigma/Deobfuscator.java')
-rw-r--r--src/cuchaz/enigma/Deobfuscator.java13
1 files changed, 10 insertions, 3 deletions
diff --git a/src/cuchaz/enigma/Deobfuscator.java b/src/cuchaz/enigma/Deobfuscator.java
index 323aa2e..293e1c2 100644
--- a/src/cuchaz/enigma/Deobfuscator.java
+++ b/src/cuchaz/enigma/Deobfuscator.java
@@ -29,6 +29,7 @@ import com.strobel.decompiler.languages.java.ast.InsertParenthesesVisitor;
29import cuchaz.enigma.analysis.JarIndex; 29import cuchaz.enigma.analysis.JarIndex;
30import cuchaz.enigma.analysis.SourceIndex; 30import cuchaz.enigma.analysis.SourceIndex;
31import cuchaz.enigma.analysis.SourceIndexVisitor; 31import cuchaz.enigma.analysis.SourceIndexVisitor;
32import cuchaz.enigma.analysis.TreeDumpVisitor;
32import cuchaz.enigma.mapping.ArgumentEntry; 33import cuchaz.enigma.mapping.ArgumentEntry;
33import cuchaz.enigma.mapping.ClassEntry; 34import cuchaz.enigma.mapping.ClassEntry;
34import cuchaz.enigma.mapping.ClassMapping; 35import cuchaz.enigma.mapping.ClassMapping;
@@ -49,6 +50,7 @@ public class Deobfuscator
49 private JarIndex m_jarIndex; 50 private JarIndex m_jarIndex;
50 private Mappings m_mappings; 51 private Mappings m_mappings;
51 private Renamer m_renamer; 52 private Renamer m_renamer;
53 private TranslatingTypeLoader m_typeLoader;
52 54
53 public Deobfuscator( File file ) 55 public Deobfuscator( File file )
54 throws IOException 56 throws IOException
@@ -93,12 +95,13 @@ public class Deobfuscator
93 m_renamer = new Renamer( m_jarIndex, m_mappings ); 95 m_renamer = new Renamer( m_jarIndex, m_mappings );
94 96
95 // update decompiler options 97 // update decompiler options
96 m_settings.setTypeLoader( new TranslatingTypeLoader( 98 m_typeLoader = new TranslatingTypeLoader(
97 m_jar, 99 m_jar,
98 m_jarIndex, 100 m_jarIndex,
99 getTranslator( TranslationDirection.Obfuscating ), 101 getTranslator( TranslationDirection.Obfuscating ),
100 getTranslator( TranslationDirection.Deobfuscating ) 102 getTranslator( TranslationDirection.Deobfuscating )
101 ) ); 103 );
104 m_settings.setTypeLoader( m_typeLoader );
102 } 105 }
103 106
104 public Translator getTranslator( TranslationDirection direction ) 107 public Translator getTranslator( TranslationDirection direction )
@@ -158,7 +161,8 @@ public class Deobfuscator
158 // render the AST into source 161 // render the AST into source
159 StringWriter buf = new StringWriter(); 162 StringWriter buf = new StringWriter();
160 root.acceptVisitor( new InsertParenthesesVisitor(), null ); 163 root.acceptVisitor( new InsertParenthesesVisitor(), null );
161 //root.acceptVisitor( new TreeDumpVisitor( new File( "tree.txt" ) ), null ); 164 // DEBUG
165 root.acceptVisitor( new TreeDumpVisitor( new File( "tree.txt" ) ), null );
162 root.acceptVisitor( new JavaOutputVisitor( new PlainTextOutput( buf ), m_settings ), null ); 166 root.acceptVisitor( new JavaOutputVisitor( new PlainTextOutput( buf ), m_settings ), null );
163 167
164 // build the source index 168 // build the source index
@@ -196,6 +200,9 @@ public class Deobfuscator
196 { 200 {
197 throw new Error( "Unknown entry type: " + obfEntry.getClass().getName() ); 201 throw new Error( "Unknown entry type: " + obfEntry.getClass().getName() );
198 } 202 }
203
204 // clear the type loader cache
205 m_typeLoader.clearCache();
199 } 206 }
200 207
201 public Entry obfuscateEntry( Entry deobfEntry ) 208 public Entry obfuscateEntry( Entry deobfEntry )