From a85529d1ce6ec533809575ec84572de855464b36 Mon Sep 17 00:00:00 2001 From: jeff Date: Wed, 20 Aug 2014 01:21:52 -0400 Subject: finished reference navigation system. Still need to debug and polish it, but the basic idea seems to work. =) --- src/cuchaz/enigma/analysis/JarIndex.java | 43 ++++++++++++-------------------- 1 file changed, 16 insertions(+), 27 deletions(-) (limited to 'src/cuchaz/enigma/analysis/JarIndex.java') 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 private Set m_obfClassNames; private Ancestries m_ancestries; private Multimap m_methodImplementations; - private Multimap> m_behaviorReferences; - private Multimap> m_fieldReferences; + private Multimap> m_behaviorReferences; + private Multimap> m_fieldReferences; private Multimap m_innerClasses; private Map m_outerClasses; private Set m_anonymousClasses; @@ -108,12 +108,12 @@ public class JarIndex m_anonymousClasses.add( innerClassName ); // DEBUG - System.out.println( "ANONYMOUS: " + outerClassName + "$" + innerClassName ); + //System.out.println( "ANONYMOUS: " + outerClassName + "$" + innerClassName ); } else { // DEBUG - System.out.println( "INNER: " + outerClassName + "$" + innerClassName ); + //System.out.println( "INNER: " + outerClassName + "$" + innerClassName ); } } } @@ -172,7 +172,7 @@ public class JarIndex call.getSignature() ); callNumbers.add( calledMethodEntry ); - EntryReference reference = new EntryReference( + EntryReference reference = new EntryReference( calledMethodEntry, thisEntry, callNumbers.count( calledMethodEntry ) - 1 @@ -189,7 +189,7 @@ public class JarIndex call.getFieldName() ); callNumbers.add( calledFieldEntry ); - EntryReference reference = new EntryReference( + EntryReference reference = new EntryReference( calledFieldEntry, thisEntry, callNumbers.count( calledFieldEntry ) - 1 @@ -209,7 +209,7 @@ public class JarIndex call.getSignature() ); callNumbers.add( calledConstructorEntry ); - EntryReference reference = new EntryReference( + EntryReference reference = new EntryReference( calledConstructorEntry, thisEntry, callNumbers.count( calledConstructorEntry ) - 1 @@ -226,7 +226,7 @@ public class JarIndex call.getSignature() ); callNumbers.add( calledConstructorEntry ); - EntryReference reference = new EntryReference( + EntryReference reference = new EntryReference( calledConstructorEntry, thisEntry, callNumbers.count( calledConstructorEntry ) - 1 @@ -261,9 +261,9 @@ public class JarIndex new ClassEntry( Descriptor.toJvmName( c.getName() ) ), constructor.getMethodInfo().getDescriptor() ); - for( EntryReference reference : getBehaviorReferences( constructorEntry ) ) + for( EntryReference reference : getBehaviorReferences( constructorEntry ) ) { - callerClasses.add( reference.caller.getClassEntry() ); + callerClasses.add( reference.context.getClassEntry() ); } // is this called by exactly one class? @@ -496,26 +496,14 @@ public class JarIndex return rootNode; } - @SuppressWarnings( "unchecked" ) - public Collection> getFieldReferences( FieldEntry fieldEntry ) + public Collection> getFieldReferences( FieldEntry fieldEntry ) { - List> references = Lists.newArrayList(); - for( EntryReference reference : m_fieldReferences.get( fieldEntry ) ) - { - references.add( (EntryReference)reference ); - } - return references; + return m_fieldReferences.get( fieldEntry ); } - @SuppressWarnings( "unchecked" ) - public Collection> getBehaviorReferences( BehaviorEntry behaviorEntry ) + public Collection> getBehaviorReferences( BehaviorEntry behaviorEntry ) { - List> references = Lists.newArrayList(); - for( EntryReference reference : m_behaviorReferences.get( behaviorEntry ) ) - { - references.add( (EntryReference)reference ); - } - return references; + return m_behaviorReferences.get( behaviorEntry ); } public Collection getInnerClasses( String obfOuterClassName ) @@ -613,8 +601,9 @@ public class JarIndex } else if( thing instanceof EntryReference ) { - EntryReference reference = (EntryReference)thing; + EntryReference reference = (EntryReference)thing; reference.entry = renameThing( renames, reference.entry ); + reference.context = renameThing( renames, reference.context ); return thing; } else -- cgit v1.2.3