From ba7a354efae7d49833c887cf147ac940c975a1fa Mon Sep 17 00:00:00 2001 From: Gegy Date: Wed, 30 Jan 2019 21:05:32 +0200 Subject: Remap sources (#106) * Source remapping beginnings * Fix navigation to remapped classes * Translate identifier info reference * Remap local variables with default names in source * Caching translator * Fix lack of highlighting for first opened class * Fix unicode variable names * Unicode checker shouldn't be checking just alphanumeric * Fix package tree being built from obf names * Don't index `this` as method call for method::reference * Apply proposed names * Fix source export issues * Replace unicode var names at bytecode level uniquely * Drop imports from editor source * Class selector fixes * Delta keep track of base mappings to enable lookup of old names * Optimize source remapping by remapping source with a StringBuffer instead of copying * Bump version --- src/test/java/cuchaz/enigma/TestSourceIndex.java | 9 ++++++--- 1 file changed, 6 insertions(+), 3 deletions(-) (limited to 'src/test/java/cuchaz/enigma/TestSourceIndex.java') diff --git a/src/test/java/cuchaz/enigma/TestSourceIndex.java b/src/test/java/cuchaz/enigma/TestSourceIndex.java index a5f5f71..ce5d631 100644 --- a/src/test/java/cuchaz/enigma/TestSourceIndex.java +++ b/src/test/java/cuchaz/enigma/TestSourceIndex.java @@ -13,6 +13,7 @@ package cuchaz.enigma; import com.google.common.collect.Sets; import com.strobel.decompiler.languages.java.ast.CompilationUnit; +import cuchaz.enigma.analysis.SourceIndex; import cuchaz.enigma.translation.representation.entry.ClassEntry; import org.junit.Test; @@ -50,11 +51,13 @@ public class TestSourceIndex { } } + SourceProvider sourceProvider = deobfuscator.getObfSourceProvider(); for (ClassEntry obfClassEntry : classEntries) { try { - CompilationUnit tree = deobfuscator.getSourceTree(obfClassEntry.getName()); - String source = deobfuscator.getSource(tree); - deobfuscator.getSourceIndex(tree, source); + CompilationUnit tree = sourceProvider.getSources(obfClassEntry.getName()); + String source = sourceProvider.writeSourceToString(tree); + + SourceIndex.buildIndex(source, tree, true); } catch (Throwable t) { throw new Error("Unable to index " + obfClassEntry, t); } -- cgit v1.2.3