diff options
| author | 2025-09-12 18:45:33 +0100 | |
|---|---|---|
| committer | 2025-09-13 09:14:23 +0100 | |
| commit | cf45c6b6014f32e553e04443686dcb44bbe4cd8c (patch) | |
| tree | a8f60c1f98421eee30925d4886c85992605e11be | |
| parent | Allow you to specify the libraries in the program args rather than always usi... (diff) | |
| download | enigma-fork-cf45c6b6014f32e553e04443686dcb44bbe4cd8c.tar.gz enigma-fork-cf45c6b6014f32e553e04443686dcb44bbe4cd8c.tar.xz enigma-fork-cf45c6b6014f32e553e04443686dcb44bbe4cd8c.zip | |
Provide access to the jar index in the API
11 files changed, 149 insertions, 6 deletions
diff --git a/enigma/src/main/java/cuchaz/enigma/EnigmaProject.java b/enigma/src/main/java/cuchaz/enigma/EnigmaProject.java index ab0ce30..9495565 100644 --- a/enigma/src/main/java/cuchaz/enigma/EnigmaProject.java +++ b/enigma/src/main/java/cuchaz/enigma/EnigmaProject.java | |||
| @@ -119,6 +119,7 @@ public class EnigmaProject implements ProjectView { | |||
| 119 | return classProvider; | 119 | return classProvider; |
| 120 | } | 120 | } |
| 121 | 121 | ||
| 122 | @Override | ||
| 122 | public JarIndex getJarIndex() { | 123 | public JarIndex getJarIndex() { |
| 123 | return jarIndex; | 124 | return jarIndex; |
| 124 | } | 125 | } |
diff --git a/enigma/src/main/java/cuchaz/enigma/analysis/index/EntryIndex.java b/enigma/src/main/java/cuchaz/enigma/analysis/index/EntryIndex.java index f12bfb8..ba75b03 100644 --- a/enigma/src/main/java/cuchaz/enigma/analysis/index/EntryIndex.java +++ b/enigma/src/main/java/cuchaz/enigma/analysis/index/EntryIndex.java | |||
| @@ -6,6 +6,10 @@ import java.util.concurrent.ConcurrentMap; | |||
| 6 | 6 | ||
| 7 | import org.jetbrains.annotations.Nullable; | 7 | import org.jetbrains.annotations.Nullable; |
| 8 | 8 | ||
| 9 | import cuchaz.enigma.api.view.entry.ClassDefEntryView; | ||
| 10 | import cuchaz.enigma.api.view.entry.ClassEntryView; | ||
| 11 | import cuchaz.enigma.api.view.entry.EntryView; | ||
| 12 | import cuchaz.enigma.api.view.index.EntryIndexView; | ||
| 9 | import cuchaz.enigma.translation.representation.AccessFlags; | 13 | import cuchaz.enigma.translation.representation.AccessFlags; |
| 10 | import cuchaz.enigma.translation.representation.entry.ClassDefEntry; | 14 | import cuchaz.enigma.translation.representation.entry.ClassDefEntry; |
| 11 | import cuchaz.enigma.translation.representation.entry.ClassEntry; | 15 | import cuchaz.enigma.translation.representation.entry.ClassEntry; |
| @@ -16,7 +20,7 @@ import cuchaz.enigma.translation.representation.entry.LocalVariableEntry; | |||
| 16 | import cuchaz.enigma.translation.representation.entry.MethodDefEntry; | 20 | import cuchaz.enigma.translation.representation.entry.MethodDefEntry; |
| 17 | import cuchaz.enigma.translation.representation.entry.MethodEntry; | 21 | import cuchaz.enigma.translation.representation.entry.MethodEntry; |
| 18 | 22 | ||
| 19 | public class EntryIndex implements JarIndexer { | 23 | public class EntryIndex implements JarIndexer, EntryIndexView { |
| 20 | private final ConcurrentMap<ClassEntry, AccessFlags> classes = new ConcurrentHashMap<>(); | 24 | private final ConcurrentMap<ClassEntry, AccessFlags> classes = new ConcurrentHashMap<>(); |
| 21 | private final ConcurrentMap<FieldEntry, AccessFlags> fields = new ConcurrentHashMap<>(); | 25 | private final ConcurrentMap<FieldEntry, AccessFlags> fields = new ConcurrentHashMap<>(); |
| 22 | private final ConcurrentMap<MethodEntry, AccessFlags> methods = new ConcurrentHashMap<>(); | 26 | private final ConcurrentMap<MethodEntry, AccessFlags> methods = new ConcurrentHashMap<>(); |
| @@ -96,6 +100,7 @@ public class EntryIndex implements JarIndexer { | |||
| 96 | return definitions.get(entry); | 100 | return definitions.get(entry); |
| 97 | } | 101 | } |
| 98 | 102 | ||
| 103 | @Override | ||
| 99 | public Collection<ClassEntry> getClasses() { | 104 | public Collection<ClassEntry> getClasses() { |
| 100 | return classes.keySet(); | 105 | return classes.keySet(); |
| 101 | } | 106 | } |
| @@ -107,4 +112,39 @@ public class EntryIndex implements JarIndexer { | |||
| 107 | public Collection<FieldEntry> getFields() { | 112 | public Collection<FieldEntry> getFields() { |
| 108 | return fields.keySet(); | 113 | return fields.keySet(); |
| 109 | } | 114 | } |
| 115 | |||
| 116 | @Override | ||
| 117 | public boolean hasEntry(EntryView entry) { | ||
| 118 | if (entry instanceof ClassEntry) { | ||
| 119 | return classes.containsKey(entry); | ||
| 120 | } else if (entry instanceof FieldEntry) { | ||
| 121 | return fields.containsKey(entry); | ||
| 122 | } else if (entry instanceof MethodEntry) { | ||
| 123 | return methods.containsKey(entry); | ||
| 124 | } else { | ||
| 125 | return false; | ||
| 126 | } | ||
| 127 | } | ||
| 128 | |||
| 129 | @Override | ||
| 130 | public int getAccess(EntryView entry) { | ||
| 131 | AccessFlags access; | ||
| 132 | |||
| 133 | if (entry instanceof ClassEntry classEntry) { | ||
| 134 | access = getClassAccess(classEntry); | ||
| 135 | } else if (entry instanceof FieldEntry fieldEntry) { | ||
| 136 | access = getFieldAccess(fieldEntry); | ||
| 137 | } else if (entry instanceof MethodEntry methodEntry) { | ||
| 138 | access = getMethodAccess(methodEntry); | ||
| 139 | } else { | ||
| 140 | return 0; | ||
| 141 | } | ||
| 142 | |||
| 143 | return access == null ? 0 : access.getFlags(); | ||
| 144 | } | ||
| 145 | |||
| 146 | @Override | ||
| 147 | public ClassDefEntryView getDefinition(ClassEntryView entry) { | ||
| 148 | return getDefinition((ClassEntry) entry); | ||
| 149 | } | ||
| 110 | } | 150 | } |
diff --git a/enigma/src/main/java/cuchaz/enigma/analysis/index/InheritanceIndex.java b/enigma/src/main/java/cuchaz/enigma/analysis/index/InheritanceIndex.java index 2b29edc..abf66e6 100644 --- a/enigma/src/main/java/cuchaz/enigma/analysis/index/InheritanceIndex.java +++ b/enigma/src/main/java/cuchaz/enigma/analysis/index/InheritanceIndex.java | |||
| @@ -21,10 +21,12 @@ import java.util.Set; | |||
| 21 | import java.util.concurrent.ConcurrentHashMap; | 21 | import java.util.concurrent.ConcurrentHashMap; |
| 22 | import java.util.concurrent.ConcurrentMap; | 22 | import java.util.concurrent.ConcurrentMap; |
| 23 | 23 | ||
| 24 | import cuchaz.enigma.api.view.entry.ClassEntryView; | ||
| 25 | import cuchaz.enigma.api.view.index.InheritanceIndexView; | ||
| 24 | import cuchaz.enigma.translation.representation.entry.ClassDefEntry; | 26 | import cuchaz.enigma.translation.representation.entry.ClassDefEntry; |
| 25 | import cuchaz.enigma.translation.representation.entry.ClassEntry; | 27 | import cuchaz.enigma.translation.representation.entry.ClassEntry; |
| 26 | 28 | ||
| 27 | public class InheritanceIndex implements JarIndexer { | 29 | public class InheritanceIndex implements JarIndexer, InheritanceIndexView { |
| 28 | private final EntryIndex entryIndex; | 30 | private final EntryIndex entryIndex; |
| 29 | 31 | ||
| 30 | private final ConcurrentMap<ClassEntry, List<ClassEntry>> classParents = new ConcurrentHashMap<>(); | 32 | private final ConcurrentMap<ClassEntry, List<ClassEntry>> classParents = new ConcurrentHashMap<>(); |
| @@ -62,10 +64,20 @@ public class InheritanceIndex implements JarIndexer { | |||
| 62 | return classParents.getOrDefault(classEntry, Collections.emptyList()); | 64 | return classParents.getOrDefault(classEntry, Collections.emptyList()); |
| 63 | } | 65 | } |
| 64 | 66 | ||
| 67 | @Override | ||
| 68 | public Collection<? extends ClassEntryView> getParents(ClassEntryView entry) { | ||
| 69 | return getParents((ClassEntry) entry); | ||
| 70 | } | ||
| 71 | |||
| 65 | public Collection<ClassEntry> getChildren(ClassEntry classEntry) { | 72 | public Collection<ClassEntry> getChildren(ClassEntry classEntry) { |
| 66 | return classChildren.getOrDefault(classEntry, Collections.emptyList()); | 73 | return classChildren.getOrDefault(classEntry, Collections.emptyList()); |
| 67 | } | 74 | } |
| 68 | 75 | ||
| 76 | @Override | ||
| 77 | public Collection<? extends ClassEntryView> getChildren(ClassEntryView entry) { | ||
| 78 | return getChildren((ClassEntry) entry); | ||
| 79 | } | ||
| 80 | |||
| 69 | public Collection<ClassEntry> getDescendants(ClassEntry classEntry) { | 81 | public Collection<ClassEntry> getDescendants(ClassEntry classEntry) { |
| 70 | Collection<ClassEntry> descendants = new HashSet<>(); | 82 | Collection<ClassEntry> descendants = new HashSet<>(); |
| 71 | 83 | ||
diff --git a/enigma/src/main/java/cuchaz/enigma/analysis/index/JarIndex.java b/enigma/src/main/java/cuchaz/enigma/analysis/index/JarIndex.java index cfa177e..5c5e2c3 100644 --- a/enigma/src/main/java/cuchaz/enigma/analysis/index/JarIndex.java +++ b/enigma/src/main/java/cuchaz/enigma/analysis/index/JarIndex.java | |||
| @@ -23,6 +23,7 @@ import java.util.concurrent.ConcurrentMap; | |||
| 23 | import cuchaz.enigma.Enigma; | 23 | import cuchaz.enigma.Enigma; |
| 24 | import cuchaz.enigma.ProgressListener; | 24 | import cuchaz.enigma.ProgressListener; |
| 25 | import cuchaz.enigma.analysis.ReferenceTargetType; | 25 | import cuchaz.enigma.analysis.ReferenceTargetType; |
| 26 | import cuchaz.enigma.api.view.index.JarIndexView; | ||
| 26 | import cuchaz.enigma.classprovider.AddFramesIfNecessaryClassProvider; | 27 | import cuchaz.enigma.classprovider.AddFramesIfNecessaryClassProvider; |
| 27 | import cuchaz.enigma.classprovider.CachingClassProvider; | 28 | import cuchaz.enigma.classprovider.CachingClassProvider; |
| 28 | import cuchaz.enigma.classprovider.ClassProvider; | 29 | import cuchaz.enigma.classprovider.ClassProvider; |
| @@ -38,7 +39,7 @@ import cuchaz.enigma.translation.representation.entry.MethodEntry; | |||
| 38 | import cuchaz.enigma.translation.representation.entry.ParentedEntry; | 39 | import cuchaz.enigma.translation.representation.entry.ParentedEntry; |
| 39 | import cuchaz.enigma.utils.I18n; | 40 | import cuchaz.enigma.utils.I18n; |
| 40 | 41 | ||
| 41 | public class JarIndex implements JarIndexer { | 42 | public class JarIndex implements JarIndexer, JarIndexView { |
| 42 | private final Set<String> indexedClasses = new HashSet<>(); | 43 | private final Set<String> indexedClasses = new HashSet<>(); |
| 43 | private final EntryIndex entryIndex; | 44 | private final EntryIndex entryIndex; |
| 44 | private final InheritanceIndex inheritanceIndex; | 45 | private final InheritanceIndex inheritanceIndex; |
| @@ -188,14 +189,17 @@ public class JarIndex implements JarIndexer { | |||
| 188 | indexers.forEach(indexer -> indexer.indexLambda(callerEntry, lambda, targetType)); | 189 | indexers.forEach(indexer -> indexer.indexLambda(callerEntry, lambda, targetType)); |
| 189 | } | 190 | } |
| 190 | 191 | ||
| 192 | @Override | ||
| 191 | public EntryIndex getEntryIndex() { | 193 | public EntryIndex getEntryIndex() { |
| 192 | return entryIndex; | 194 | return entryIndex; |
| 193 | } | 195 | } |
| 194 | 196 | ||
| 197 | @Override | ||
| 195 | public InheritanceIndex getInheritanceIndex() { | 198 | public InheritanceIndex getInheritanceIndex() { |
| 196 | return this.inheritanceIndex; | 199 | return this.inheritanceIndex; |
| 197 | } | 200 | } |
| 198 | 201 | ||
| 202 | @Override | ||
| 199 | public ReferenceIndex getReferenceIndex() { | 203 | public ReferenceIndex getReferenceIndex() { |
| 200 | return referenceIndex; | 204 | return referenceIndex; |
| 201 | } | 205 | } |
diff --git a/enigma/src/main/java/cuchaz/enigma/analysis/index/ReferenceIndex.java b/enigma/src/main/java/cuchaz/enigma/analysis/index/ReferenceIndex.java index 1a406cb..f88b8e3 100644 --- a/enigma/src/main/java/cuchaz/enigma/analysis/index/ReferenceIndex.java +++ b/enigma/src/main/java/cuchaz/enigma/analysis/index/ReferenceIndex.java | |||
| @@ -8,6 +8,11 @@ import java.util.concurrent.ConcurrentMap; | |||
| 8 | 8 | ||
| 9 | import cuchaz.enigma.analysis.EntryReference; | 9 | import cuchaz.enigma.analysis.EntryReference; |
| 10 | import cuchaz.enigma.analysis.ReferenceTargetType; | 10 | import cuchaz.enigma.analysis.ReferenceTargetType; |
| 11 | import cuchaz.enigma.api.view.entry.ClassEntryView; | ||
| 12 | import cuchaz.enigma.api.view.entry.EntryReferenceView; | ||
| 13 | import cuchaz.enigma.api.view.entry.FieldEntryView; | ||
| 14 | import cuchaz.enigma.api.view.entry.MethodEntryView; | ||
| 15 | import cuchaz.enigma.api.view.index.ReferenceIndexView; | ||
| 11 | import cuchaz.enigma.translation.mapping.ResolutionStrategy; | 16 | import cuchaz.enigma.translation.mapping.ResolutionStrategy; |
| 12 | import cuchaz.enigma.translation.representation.Lambda; | 17 | import cuchaz.enigma.translation.representation.Lambda; |
| 13 | import cuchaz.enigma.translation.representation.MethodDescriptor; | 18 | import cuchaz.enigma.translation.representation.MethodDescriptor; |
| @@ -19,7 +24,7 @@ import cuchaz.enigma.translation.representation.entry.FieldEntry; | |||
| 19 | import cuchaz.enigma.translation.representation.entry.MethodDefEntry; | 24 | import cuchaz.enigma.translation.representation.entry.MethodDefEntry; |
| 20 | import cuchaz.enigma.translation.representation.entry.MethodEntry; | 25 | import cuchaz.enigma.translation.representation.entry.MethodEntry; |
| 21 | 26 | ||
| 22 | public class ReferenceIndex implements JarIndexer { | 27 | public class ReferenceIndex implements JarIndexer, ReferenceIndexView { |
| 23 | private ConcurrentMap<MethodEntry, List<MethodEntry>> methodReferences = new ConcurrentHashMap<>(); | 28 | private ConcurrentMap<MethodEntry, List<MethodEntry>> methodReferences = new ConcurrentHashMap<>(); |
| 24 | 29 | ||
| 25 | private ConcurrentMap<MethodEntry, List<EntryReference<MethodEntry, MethodDefEntry>>> referencesToMethods = new ConcurrentHashMap<>(); | 30 | private ConcurrentMap<MethodEntry, List<EntryReference<MethodEntry, MethodDefEntry>>> referencesToMethods = new ConcurrentHashMap<>(); |
| @@ -144,23 +149,53 @@ public class ReferenceIndex implements JarIndexer { | |||
| 144 | return methodReferences.getOrDefault(entry, Collections.emptyList()); | 149 | return methodReferences.getOrDefault(entry, Collections.emptyList()); |
| 145 | } | 150 | } |
| 146 | 151 | ||
| 152 | @Override | ||
| 153 | public Collection<? extends MethodEntryView> getMethodsReferencedBy(MethodEntryView entry) { | ||
| 154 | return getMethodsReferencedBy((MethodEntry) entry); | ||
| 155 | } | ||
| 156 | |||
| 147 | public Collection<EntryReference<FieldEntry, MethodDefEntry>> getReferencesToField(FieldEntry entry) { | 157 | public Collection<EntryReference<FieldEntry, MethodDefEntry>> getReferencesToField(FieldEntry entry) { |
| 148 | return referencesToFields.getOrDefault(entry, Collections.emptyList()); | 158 | return referencesToFields.getOrDefault(entry, Collections.emptyList()); |
| 149 | } | 159 | } |
| 150 | 160 | ||
| 161 | @Override | ||
| 162 | public Collection<? extends EntryReferenceView> getReferencesToField(FieldEntryView entry) { | ||
| 163 | return getReferencesToField((FieldEntry) entry); | ||
| 164 | } | ||
| 165 | |||
| 151 | public Collection<EntryReference<ClassEntry, MethodDefEntry>> getReferencesToClass(ClassEntry entry) { | 166 | public Collection<EntryReference<ClassEntry, MethodDefEntry>> getReferencesToClass(ClassEntry entry) { |
| 152 | return referencesToClasses.getOrDefault(entry, Collections.emptyList()); | 167 | return referencesToClasses.getOrDefault(entry, Collections.emptyList()); |
| 153 | } | 168 | } |
| 154 | 169 | ||
| 170 | @Override | ||
| 171 | public Collection<? extends EntryReferenceView> getReferencesToClass(ClassEntryView entry) { | ||
| 172 | return getReferencesToClass((ClassEntry) entry); | ||
| 173 | } | ||
| 174 | |||
| 155 | public Collection<EntryReference<MethodEntry, MethodDefEntry>> getReferencesToMethod(MethodEntry entry) { | 175 | public Collection<EntryReference<MethodEntry, MethodDefEntry>> getReferencesToMethod(MethodEntry entry) { |
| 156 | return referencesToMethods.getOrDefault(entry, Collections.emptyList()); | 176 | return referencesToMethods.getOrDefault(entry, Collections.emptyList()); |
| 157 | } | 177 | } |
| 158 | 178 | ||
| 179 | @Override | ||
| 180 | public Collection<? extends EntryReferenceView> getReferencesToMethod(MethodEntryView entry) { | ||
| 181 | return getReferencesToMethod((MethodEntry) entry); | ||
| 182 | } | ||
| 183 | |||
| 159 | public Collection<EntryReference<ClassEntry, FieldDefEntry>> getFieldTypeReferencesToClass(ClassEntry entry) { | 184 | public Collection<EntryReference<ClassEntry, FieldDefEntry>> getFieldTypeReferencesToClass(ClassEntry entry) { |
| 160 | return fieldTypeReferences.getOrDefault(entry, Collections.emptyList()); | 185 | return fieldTypeReferences.getOrDefault(entry, Collections.emptyList()); |
| 161 | } | 186 | } |
| 162 | 187 | ||
| 188 | @Override | ||
| 189 | public Collection<? extends EntryReferenceView> getFieldTypeReferencesToClass(ClassEntryView entry) { | ||
| 190 | return getFieldTypeReferencesToClass((ClassEntry) entry); | ||
| 191 | } | ||
| 192 | |||
| 163 | public Collection<EntryReference<ClassEntry, MethodDefEntry>> getMethodTypeReferencesToClass(ClassEntry entry) { | 193 | public Collection<EntryReference<ClassEntry, MethodDefEntry>> getMethodTypeReferencesToClass(ClassEntry entry) { |
| 164 | return methodTypeReferences.getOrDefault(entry, Collections.emptyList()); | 194 | return methodTypeReferences.getOrDefault(entry, Collections.emptyList()); |
| 165 | } | 195 | } |
| 196 | |||
| 197 | @Override | ||
| 198 | public Collection<? extends EntryReferenceView> getMethodTypeReferencesToClass(ClassEntryView entry) { | ||
| 199 | return getMethodTypeReferencesToClass((ClassEntry) entry); | ||
| 200 | } | ||
| 166 | } | 201 | } |
diff --git a/enigma/src/main/java/cuchaz/enigma/api/service/JarIndexerService.java b/enigma/src/main/java/cuchaz/enigma/api/service/JarIndexerService.java index 91c79c6..81a7ebf 100644 --- a/enigma/src/main/java/cuchaz/enigma/api/service/JarIndexerService.java +++ b/enigma/src/main/java/cuchaz/enigma/api/service/JarIndexerService.java | |||
| @@ -8,13 +8,13 @@ import java.util.function.Supplier; | |||
| 8 | 8 | ||
| 9 | import org.objectweb.asm.ClassVisitor; | 9 | import org.objectweb.asm.ClassVisitor; |
| 10 | 10 | ||
| 11 | import cuchaz.enigma.analysis.index.JarIndex; | 11 | import cuchaz.enigma.api.view.index.JarIndexView; |
| 12 | import cuchaz.enigma.classprovider.ClassProvider; | 12 | import cuchaz.enigma.classprovider.ClassProvider; |
| 13 | 13 | ||
| 14 | public interface JarIndexerService extends EnigmaService { | 14 | public interface JarIndexerService extends EnigmaService { |
| 15 | EnigmaServiceType<JarIndexerService> TYPE = EnigmaServiceType.create("jar_indexer"); | 15 | EnigmaServiceType<JarIndexerService> TYPE = EnigmaServiceType.create("jar_indexer"); |
| 16 | 16 | ||
| 17 | void acceptJar(Set<String> scope, ClassProvider classProvider, JarIndex jarIndex); | 17 | void acceptJar(Set<String> scope, ClassProvider classProvider, JarIndexView jarIndex); |
| 18 | 18 | ||
| 19 | static JarIndexerService fromVisitor(ClassVisitor visitor) { | 19 | static JarIndexerService fromVisitor(ClassVisitor visitor) { |
| 20 | return (scope, classProvider, jarIndex) -> { | 20 | return (scope, classProvider, jarIndex) -> { |
diff --git a/enigma/src/main/java/cuchaz/enigma/api/view/ProjectView.java b/enigma/src/main/java/cuchaz/enigma/api/view/ProjectView.java index 8f53d11..b72e1c3 100644 --- a/enigma/src/main/java/cuchaz/enigma/api/view/ProjectView.java +++ b/enigma/src/main/java/cuchaz/enigma/api/view/ProjectView.java | |||
| @@ -9,6 +9,7 @@ import org.objectweb.asm.tree.ClassNode; | |||
| 9 | import cuchaz.enigma.api.DataInvalidationEvent; | 9 | import cuchaz.enigma.api.DataInvalidationEvent; |
| 10 | import cuchaz.enigma.api.DataInvalidationListener; | 10 | import cuchaz.enigma.api.DataInvalidationListener; |
| 11 | import cuchaz.enigma.api.view.entry.EntryView; | 11 | import cuchaz.enigma.api.view.entry.EntryView; |
| 12 | import cuchaz.enigma.api.view.index.JarIndexView; | ||
| 12 | 13 | ||
| 13 | public interface ProjectView { | 14 | public interface ProjectView { |
| 14 | <T extends EntryView> T deobfuscate(T entry); | 15 | <T extends EntryView> T deobfuscate(T entry); |
| @@ -20,6 +21,8 @@ public interface ProjectView { | |||
| 20 | 21 | ||
| 21 | void registerForInverseMappings(); | 22 | void registerForInverseMappings(); |
| 22 | 23 | ||
| 24 | JarIndexView getJarIndex(); | ||
| 25 | |||
| 23 | Collection<String> getProjectClasses(); | 26 | Collection<String> getProjectClasses(); |
| 24 | 27 | ||
| 25 | @Nullable | 28 | @Nullable |
diff --git a/enigma/src/main/java/cuchaz/enigma/api/view/index/EntryIndexView.java b/enigma/src/main/java/cuchaz/enigma/api/view/index/EntryIndexView.java new file mode 100644 index 0000000..56bf70e --- /dev/null +++ b/enigma/src/main/java/cuchaz/enigma/api/view/index/EntryIndexView.java | |||
| @@ -0,0 +1,14 @@ | |||
| 1 | package cuchaz.enigma.api.view.index; | ||
| 2 | |||
| 3 | import java.util.Collection; | ||
| 4 | |||
| 5 | import cuchaz.enigma.api.view.entry.ClassDefEntryView; | ||
| 6 | import cuchaz.enigma.api.view.entry.ClassEntryView; | ||
| 7 | import cuchaz.enigma.api.view.entry.EntryView; | ||
| 8 | |||
| 9 | public interface EntryIndexView { | ||
| 10 | boolean hasEntry(EntryView entry); | ||
| 11 | int getAccess(EntryView entry); | ||
| 12 | ClassDefEntryView getDefinition(ClassEntryView entry); | ||
| 13 | Collection<? extends ClassEntryView> getClasses(); | ||
| 14 | } | ||
diff --git a/enigma/src/main/java/cuchaz/enigma/api/view/index/InheritanceIndexView.java b/enigma/src/main/java/cuchaz/enigma/api/view/index/InheritanceIndexView.java new file mode 100644 index 0000000..a016d11 --- /dev/null +++ b/enigma/src/main/java/cuchaz/enigma/api/view/index/InheritanceIndexView.java | |||
| @@ -0,0 +1,10 @@ | |||
| 1 | package cuchaz.enigma.api.view.index; | ||
| 2 | |||
| 3 | import java.util.Collection; | ||
| 4 | |||
| 5 | import cuchaz.enigma.api.view.entry.ClassEntryView; | ||
| 6 | |||
| 7 | public interface InheritanceIndexView { | ||
| 8 | Collection<? extends ClassEntryView> getParents(ClassEntryView entry); | ||
| 9 | Collection<? extends ClassEntryView> getChildren(ClassEntryView entry); | ||
| 10 | } | ||
diff --git a/enigma/src/main/java/cuchaz/enigma/api/view/index/JarIndexView.java b/enigma/src/main/java/cuchaz/enigma/api/view/index/JarIndexView.java new file mode 100644 index 0000000..069b115 --- /dev/null +++ b/enigma/src/main/java/cuchaz/enigma/api/view/index/JarIndexView.java | |||
| @@ -0,0 +1,7 @@ | |||
| 1 | package cuchaz.enigma.api.view.index; | ||
| 2 | |||
| 3 | public interface JarIndexView { | ||
| 4 | EntryIndexView getEntryIndex(); | ||
| 5 | InheritanceIndexView getInheritanceIndex(); | ||
| 6 | ReferenceIndexView getReferenceIndex(); | ||
| 7 | } | ||
diff --git a/enigma/src/main/java/cuchaz/enigma/api/view/index/ReferenceIndexView.java b/enigma/src/main/java/cuchaz/enigma/api/view/index/ReferenceIndexView.java new file mode 100644 index 0000000..00ab84e --- /dev/null +++ b/enigma/src/main/java/cuchaz/enigma/api/view/index/ReferenceIndexView.java | |||
| @@ -0,0 +1,17 @@ | |||
| 1 | package cuchaz.enigma.api.view.index; | ||
| 2 | |||
| 3 | import java.util.Collection; | ||
| 4 | |||
| 5 | import cuchaz.enigma.api.view.entry.ClassEntryView; | ||
| 6 | import cuchaz.enigma.api.view.entry.EntryReferenceView; | ||
| 7 | import cuchaz.enigma.api.view.entry.FieldEntryView; | ||
| 8 | import cuchaz.enigma.api.view.entry.MethodEntryView; | ||
| 9 | |||
| 10 | public interface ReferenceIndexView { | ||
| 11 | Collection<? extends MethodEntryView> getMethodsReferencedBy(MethodEntryView entry); | ||
| 12 | Collection<? extends EntryReferenceView> getReferencesToClass(ClassEntryView entry); | ||
| 13 | Collection<? extends EntryReferenceView> getReferencesToField(FieldEntryView entry); | ||
| 14 | Collection<? extends EntryReferenceView> getReferencesToMethod(MethodEntryView entry); | ||
| 15 | Collection<? extends EntryReferenceView> getFieldTypeReferencesToClass(ClassEntryView entry); | ||
| 16 | Collection<? extends EntryReferenceView> getMethodTypeReferencesToClass(ClassEntryView entry); | ||
| 17 | } | ||