summaryrefslogtreecommitdiff
path: root/src/test/java/cuchaz/enigma/TestSourceIndex.java
diff options
context:
space:
mode:
Diffstat (limited to 'src/test/java/cuchaz/enigma/TestSourceIndex.java')
-rw-r--r--src/test/java/cuchaz/enigma/TestSourceIndex.java12
1 files changed, 4 insertions, 8 deletions
diff --git a/src/test/java/cuchaz/enigma/TestSourceIndex.java b/src/test/java/cuchaz/enigma/TestSourceIndex.java
index b1d1182..b201608 100644
--- a/src/test/java/cuchaz/enigma/TestSourceIndex.java
+++ b/src/test/java/cuchaz/enigma/TestSourceIndex.java
@@ -12,9 +12,8 @@
12package cuchaz.enigma; 12package cuchaz.enigma;
13 13
14import com.google.common.collect.Sets; 14import com.google.common.collect.Sets;
15import com.strobel.decompiler.languages.java.ast.CompilationUnit;
16import cuchaz.enigma.analysis.ClassCache; 15import cuchaz.enigma.analysis.ClassCache;
17import cuchaz.enigma.analysis.SourceIndex; 16import cuchaz.enigma.source.*;
18import cuchaz.enigma.analysis.index.JarIndex; 17import cuchaz.enigma.analysis.index.JarIndex;
19import cuchaz.enigma.translation.representation.entry.ClassEntry; 18import cuchaz.enigma.translation.representation.entry.ClassEntry;
20import org.junit.Test; 19import org.junit.Test;
@@ -53,8 +52,7 @@ public class TestSourceIndex {
53 ClassCache classCache = project.getClassCache(); 52 ClassCache classCache = project.getClassCache();
54 JarIndex index = project.getJarIndex(); 53 JarIndex index = project.getJarIndex();
55 54
56 CompiledSourceTypeLoader typeLoader = new CompiledSourceTypeLoader(classCache); 55 Decompiler decompiler = Decompilers.PROCYON.create(classCache, new SourceSettings(false, false));
57 SourceProvider sourceProvider = new SourceProvider(SourceProvider.createSettings(), typeLoader);
58 56
59 // get all classes that aren't inner classes 57 // get all classes that aren't inner classes
60 Set<ClassEntry> classEntries = Sets.newHashSet(); 58 Set<ClassEntry> classEntries = Sets.newHashSet();
@@ -66,10 +64,8 @@ public class TestSourceIndex {
66 64
67 for (ClassEntry obfClassEntry : classEntries) { 65 for (ClassEntry obfClassEntry : classEntries) {
68 try { 66 try {
69 CompilationUnit tree = sourceProvider.getSources(obfClassEntry.getName()); 67 Source source = decompiler.getSource(obfClassEntry.getName());
70 String source = sourceProvider.writeSourceToString(tree); 68 source.index();
71
72 SourceIndex.buildIndex(source, tree, true);
73 } catch (Throwable t) { 69 } catch (Throwable t) {
74 throw new Error("Unable to index " + obfClassEntry, t); 70 throw new Error("Unable to index " + obfClassEntry, t);
75 } 71 }