From 237b2ed2a6b6f537cdbdf9fc9c6d0c7743f34375 Mon Sep 17 00:00:00 2001 From: jeff Date: Thu, 21 Aug 2014 01:10:37 -0400 Subject: fixed call graph searching added system to navigate multiple tokens for the same entry in a behavior --- src/cuchaz/enigma/analysis/JarIndex.java | 30 +++++++++++++----------------- 1 file changed, 13 insertions(+), 17 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 f408d93..315a286 100644 --- a/src/cuchaz/enigma/analysis/JarIndex.java +++ b/src/cuchaz/enigma/analysis/JarIndex.java @@ -146,10 +146,15 @@ public class JarIndex } else if( behavior instanceof CtConstructor ) { - thisEntry = new ConstructorEntry( - new ClassEntry( className ), - behavior.getSignature() - ); + boolean isStatic = behavior.getName().equals( "" ); + if( isStatic ) + { + thisEntry = new ConstructorEntry( new ClassEntry( className ) ); + } + else + { + thisEntry = new ConstructorEntry( new ClassEntry( className ), behavior.getSignature() ); + } } else { @@ -159,7 +164,6 @@ public class JarIndex // index method calls try { - final Multiset callNumbers = HashMultiset.create(); behavior.instrument( new ExprEditor( ) { @Override @@ -171,11 +175,9 @@ public class JarIndex call.getMethodName(), call.getSignature() ); - callNumbers.add( calledMethodEntry ); EntryReference reference = new EntryReference( calledMethodEntry, - thisEntry, - callNumbers.count( calledMethodEntry ) - 1 + thisEntry ); m_behaviorReferences.put( calledMethodEntry, reference ); } @@ -188,11 +190,9 @@ public class JarIndex new ClassEntry( className ), call.getFieldName() ); - callNumbers.add( calledFieldEntry ); EntryReference reference = new EntryReference( calledFieldEntry, - thisEntry, - callNumbers.count( calledFieldEntry ) - 1 + thisEntry ); m_fieldReferences.put( calledFieldEntry, reference ); } @@ -208,11 +208,9 @@ public class JarIndex new ClassEntry( className ), call.getSignature() ); - callNumbers.add( calledConstructorEntry ); EntryReference reference = new EntryReference( calledConstructorEntry, - thisEntry, - callNumbers.count( calledConstructorEntry ) - 1 + thisEntry ); m_behaviorReferences.put( calledConstructorEntry, reference ); } @@ -225,11 +223,9 @@ public class JarIndex new ClassEntry( className ), call.getSignature() ); - callNumbers.add( calledConstructorEntry ); EntryReference reference = new EntryReference( calledConstructorEntry, - thisEntry, - callNumbers.count( calledConstructorEntry ) - 1 + thisEntry ); m_behaviorReferences.put( calledConstructorEntry, reference ); } -- cgit v1.2.3