summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorGravatar jeff2014-09-18 23:03:19 -0400
committerGravatar jeff2014-09-18 23:03:19 -0400
commit725da3d2b3c4e4410ccbd661e83230b357428fab (patch)
treecf7075fad922eb6b8a96b21f27e965087b414f22
parentfixed crash with jar loading (diff)
downloadenigma-fork-725da3d2b3c4e4410ccbd661e83230b357428fab.tar.gz
enigma-fork-725da3d2b3c4e4410ccbd661e83230b357428fab.tar.xz
enigma-fork-725da3d2b3c4e4410ccbd661e83230b357428fab.zip
fixed issue with inner class detection
-rw-r--r--src/cuchaz/enigma/analysis/JarIndex.java15
1 files changed, 10 insertions, 5 deletions
diff --git a/src/cuchaz/enigma/analysis/JarIndex.java b/src/cuchaz/enigma/analysis/JarIndex.java
index f484316..6c955bc 100644
--- a/src/cuchaz/enigma/analysis/JarIndex.java
+++ b/src/cuchaz/enigma/analysis/JarIndex.java
@@ -417,12 +417,11 @@ public class JarIndex
417 continue; 417 continue;
418 } 418 }
419 419
420 ClassEntry classEntry = new ClassEntry( Descriptor.toJvmName( c.getName() ) );
421 ConstructorEntry constructorEntry = new ConstructorEntry( classEntry, constructor.getMethodInfo().getDescriptor() );
422
420 // who calls this constructor? 423 // who calls this constructor?
421 Set<ClassEntry> callerClasses = Sets.newHashSet(); 424 Set<ClassEntry> callerClasses = Sets.newHashSet();
422 ConstructorEntry constructorEntry = new ConstructorEntry(
423 new ClassEntry( Descriptor.toJvmName( c.getName() ) ),
424 constructor.getMethodInfo().getDescriptor()
425 );
426 for( EntryReference<BehaviorEntry,BehaviorEntry> reference : getBehaviorReferences( constructorEntry ) ) 425 for( EntryReference<BehaviorEntry,BehaviorEntry> reference : getBehaviorReferences( constructorEntry ) )
427 { 426 {
428 callerClasses.add( reference.context.getClassEntry() ); 427 callerClasses.add( reference.context.getClassEntry() );
@@ -431,7 +430,13 @@ public class JarIndex
431 // is this called by exactly one class? 430 // is this called by exactly one class?
432 if( callerClasses.size() == 1 ) 431 if( callerClasses.size() == 1 )
433 { 432 {
434 return callerClasses.iterator().next().getName(); 433 ClassEntry callerClassEntry = callerClasses.iterator().next();
434
435 // does this class make sense as an outer class?
436 if( !callerClassEntry.equals( classEntry ) )
437 {
438 return callerClassEntry.getName();
439 }
435 } 440 }
436 else if( callerClasses.size() > 1 ) 441 else if( callerClasses.size() > 1 )
437 { 442 {