diff options
| author | 2014-08-20 01:21:52 -0400 | |
|---|---|---|
| committer | 2014-08-20 01:21:52 -0400 | |
| commit | a85529d1ce6ec533809575ec84572de855464b36 (patch) | |
| tree | 8f1894c272edf0e7eb22aec2f3af41f6bd19c092 /src/cuchaz/enigma/analysis/JarIndex.java | |
| parent | started new reference navigation system (diff) | |
| download | enigma-fork-a85529d1ce6ec533809575ec84572de855464b36.tar.gz enigma-fork-a85529d1ce6ec533809575ec84572de855464b36.tar.xz enigma-fork-a85529d1ce6ec533809575ec84572de855464b36.zip | |
finished reference navigation system. Still need to debug and polish it, but the basic idea seems to work. =)
Diffstat (limited to 'src/cuchaz/enigma/analysis/JarIndex.java')
| -rw-r--r-- | src/cuchaz/enigma/analysis/JarIndex.java | 43 |
1 files changed, 16 insertions, 27 deletions
diff --git a/src/cuchaz/enigma/analysis/JarIndex.java b/src/cuchaz/enigma/analysis/JarIndex.java index f1c29c5..f408d93 100644 --- a/src/cuchaz/enigma/analysis/JarIndex.java +++ b/src/cuchaz/enigma/analysis/JarIndex.java | |||
| @@ -56,8 +56,8 @@ public class JarIndex | |||
| 56 | private Set<String> m_obfClassNames; | 56 | private Set<String> m_obfClassNames; |
| 57 | private Ancestries m_ancestries; | 57 | private Ancestries m_ancestries; |
| 58 | private Multimap<String,MethodEntry> m_methodImplementations; | 58 | private Multimap<String,MethodEntry> m_methodImplementations; |
| 59 | private Multimap<BehaviorEntry,EntryReference<? extends Entry>> m_behaviorReferences; | 59 | private Multimap<BehaviorEntry,EntryReference<BehaviorEntry,BehaviorEntry>> m_behaviorReferences; |
| 60 | private Multimap<FieldEntry,EntryReference<? extends Entry>> m_fieldReferences; | 60 | private Multimap<FieldEntry,EntryReference<FieldEntry,BehaviorEntry>> m_fieldReferences; |
| 61 | private Multimap<String,String> m_innerClasses; | 61 | private Multimap<String,String> m_innerClasses; |
| 62 | private Map<String,String> m_outerClasses; | 62 | private Map<String,String> m_outerClasses; |
| 63 | private Set<String> m_anonymousClasses; | 63 | private Set<String> m_anonymousClasses; |
| @@ -108,12 +108,12 @@ public class JarIndex | |||
| 108 | m_anonymousClasses.add( innerClassName ); | 108 | m_anonymousClasses.add( innerClassName ); |
| 109 | 109 | ||
| 110 | // DEBUG | 110 | // DEBUG |
| 111 | System.out.println( "ANONYMOUS: " + outerClassName + "$" + innerClassName ); | 111 | //System.out.println( "ANONYMOUS: " + outerClassName + "$" + innerClassName ); |
| 112 | } | 112 | } |
| 113 | else | 113 | else |
| 114 | { | 114 | { |
| 115 | // DEBUG | 115 | // DEBUG |
| 116 | System.out.println( "INNER: " + outerClassName + "$" + innerClassName ); | 116 | //System.out.println( "INNER: " + outerClassName + "$" + innerClassName ); |
| 117 | } | 117 | } |
| 118 | } | 118 | } |
| 119 | } | 119 | } |
| @@ -172,7 +172,7 @@ public class JarIndex | |||
| 172 | call.getSignature() | 172 | call.getSignature() |
| 173 | ); | 173 | ); |
| 174 | callNumbers.add( calledMethodEntry ); | 174 | callNumbers.add( calledMethodEntry ); |
| 175 | EntryReference<MethodEntry> reference = new EntryReference<MethodEntry>( | 175 | EntryReference<BehaviorEntry,BehaviorEntry> reference = new EntryReference<BehaviorEntry,BehaviorEntry>( |
| 176 | calledMethodEntry, | 176 | calledMethodEntry, |
| 177 | thisEntry, | 177 | thisEntry, |
| 178 | callNumbers.count( calledMethodEntry ) - 1 | 178 | callNumbers.count( calledMethodEntry ) - 1 |
| @@ -189,7 +189,7 @@ public class JarIndex | |||
| 189 | call.getFieldName() | 189 | call.getFieldName() |
| 190 | ); | 190 | ); |
| 191 | callNumbers.add( calledFieldEntry ); | 191 | callNumbers.add( calledFieldEntry ); |
| 192 | EntryReference<FieldEntry> reference = new EntryReference<FieldEntry>( | 192 | EntryReference<FieldEntry,BehaviorEntry> reference = new EntryReference<FieldEntry,BehaviorEntry>( |
| 193 | calledFieldEntry, | 193 | calledFieldEntry, |
| 194 | thisEntry, | 194 | thisEntry, |
| 195 | callNumbers.count( calledFieldEntry ) - 1 | 195 | callNumbers.count( calledFieldEntry ) - 1 |
| @@ -209,7 +209,7 @@ public class JarIndex | |||
| 209 | call.getSignature() | 209 | call.getSignature() |
| 210 | ); | 210 | ); |
| 211 | callNumbers.add( calledConstructorEntry ); | 211 | callNumbers.add( calledConstructorEntry ); |
| 212 | EntryReference<ConstructorEntry> reference = new EntryReference<ConstructorEntry>( | 212 | EntryReference<BehaviorEntry,BehaviorEntry> reference = new EntryReference<BehaviorEntry,BehaviorEntry>( |
| 213 | calledConstructorEntry, | 213 | calledConstructorEntry, |
| 214 | thisEntry, | 214 | thisEntry, |
| 215 | callNumbers.count( calledConstructorEntry ) - 1 | 215 | callNumbers.count( calledConstructorEntry ) - 1 |
| @@ -226,7 +226,7 @@ public class JarIndex | |||
| 226 | call.getSignature() | 226 | call.getSignature() |
| 227 | ); | 227 | ); |
| 228 | callNumbers.add( calledConstructorEntry ); | 228 | callNumbers.add( calledConstructorEntry ); |
| 229 | EntryReference<ConstructorEntry> reference = new EntryReference<ConstructorEntry>( | 229 | EntryReference<BehaviorEntry,BehaviorEntry> reference = new EntryReference<BehaviorEntry,BehaviorEntry>( |
| 230 | calledConstructorEntry, | 230 | calledConstructorEntry, |
| 231 | thisEntry, | 231 | thisEntry, |
| 232 | callNumbers.count( calledConstructorEntry ) - 1 | 232 | callNumbers.count( calledConstructorEntry ) - 1 |
| @@ -261,9 +261,9 @@ public class JarIndex | |||
| 261 | new ClassEntry( Descriptor.toJvmName( c.getName() ) ), | 261 | new ClassEntry( Descriptor.toJvmName( c.getName() ) ), |
| 262 | constructor.getMethodInfo().getDescriptor() | 262 | constructor.getMethodInfo().getDescriptor() |
| 263 | ); | 263 | ); |
| 264 | for( EntryReference<BehaviorEntry> reference : getBehaviorReferences( constructorEntry ) ) | 264 | for( EntryReference<BehaviorEntry,BehaviorEntry> reference : getBehaviorReferences( constructorEntry ) ) |
| 265 | { | 265 | { |
| 266 | callerClasses.add( reference.caller.getClassEntry() ); | 266 | callerClasses.add( reference.context.getClassEntry() ); |
| 267 | } | 267 | } |
| 268 | 268 | ||
| 269 | // is this called by exactly one class? | 269 | // is this called by exactly one class? |
| @@ -496,26 +496,14 @@ public class JarIndex | |||
| 496 | return rootNode; | 496 | return rootNode; |
| 497 | } | 497 | } |
| 498 | 498 | ||
| 499 | @SuppressWarnings( "unchecked" ) | 499 | public Collection<EntryReference<FieldEntry,BehaviorEntry>> getFieldReferences( FieldEntry fieldEntry ) |
| 500 | public Collection<EntryReference<FieldEntry>> getFieldReferences( FieldEntry fieldEntry ) | ||
| 501 | { | 500 | { |
| 502 | List<EntryReference<FieldEntry>> references = Lists.newArrayList(); | 501 | return m_fieldReferences.get( fieldEntry ); |
| 503 | for( EntryReference<? extends Entry> reference : m_fieldReferences.get( fieldEntry ) ) | ||
| 504 | { | ||
| 505 | references.add( (EntryReference<FieldEntry>)reference ); | ||
| 506 | } | ||
| 507 | return references; | ||
| 508 | } | 502 | } |
| 509 | 503 | ||
| 510 | @SuppressWarnings( "unchecked" ) | 504 | public Collection<EntryReference<BehaviorEntry,BehaviorEntry>> getBehaviorReferences( BehaviorEntry behaviorEntry ) |
| 511 | public Collection<EntryReference<BehaviorEntry>> getBehaviorReferences( BehaviorEntry behaviorEntry ) | ||
| 512 | { | 505 | { |
| 513 | List<EntryReference<BehaviorEntry>> references = Lists.newArrayList(); | 506 | return m_behaviorReferences.get( behaviorEntry ); |
| 514 | for( EntryReference<? extends Entry> reference : m_behaviorReferences.get( behaviorEntry ) ) | ||
| 515 | { | ||
| 516 | references.add( (EntryReference<BehaviorEntry>)reference ); | ||
| 517 | } | ||
| 518 | return references; | ||
| 519 | } | 507 | } |
| 520 | 508 | ||
| 521 | public Collection<String> getInnerClasses( String obfOuterClassName ) | 509 | public Collection<String> getInnerClasses( String obfOuterClassName ) |
| @@ -613,8 +601,9 @@ public class JarIndex | |||
| 613 | } | 601 | } |
| 614 | else if( thing instanceof EntryReference ) | 602 | else if( thing instanceof EntryReference ) |
| 615 | { | 603 | { |
| 616 | EntryReference<Entry> reference = (EntryReference<Entry>)thing; | 604 | EntryReference<Entry,Entry> reference = (EntryReference<Entry,Entry>)thing; |
| 617 | reference.entry = renameThing( renames, reference.entry ); | 605 | reference.entry = renameThing( renames, reference.entry ); |
| 606 | reference.context = renameThing( renames, reference.context ); | ||
| 618 | return thing; | 607 | return thing; |
| 619 | } | 608 | } |
| 620 | else | 609 | else |