diff options
| author | 2014-08-14 00:46:16 -0400 | |
|---|---|---|
| committer | 2014-08-14 00:46:16 -0400 | |
| commit | 580fbf899accb4181c1ca1e41abbcc2b7404c870 (patch) | |
| tree | f4acc14a5fb5453b1436aca6a558beb71bd6c2c4 | |
| parent | remove old debug messages (diff) | |
| download | enigma-fork-580fbf899accb4181c1ca1e41abbcc2b7404c870.tar.gz enigma-fork-580fbf899accb4181c1ca1e41abbcc2b7404c870.tar.xz enigma-fork-580fbf899accb4181c1ca1e41abbcc2b7404c870.zip | |
fixed bug with method inheritance detection
| -rw-r--r-- | src/cuchaz/enigma/analysis/JarIndex.java | 22 | ||||
| -rw-r--r-- | src/cuchaz/enigma/analysis/MethodInheritanceTreeNode.java | 2 |
2 files changed, 9 insertions, 15 deletions
diff --git a/src/cuchaz/enigma/analysis/JarIndex.java b/src/cuchaz/enigma/analysis/JarIndex.java index a0aa295..845be60 100644 --- a/src/cuchaz/enigma/analysis/JarIndex.java +++ b/src/cuchaz/enigma/analysis/JarIndex.java | |||
| @@ -238,19 +238,13 @@ public class JarIndex | |||
| 238 | 238 | ||
| 239 | public boolean isMethodImplemented( MethodEntry methodEntry ) | 239 | public boolean isMethodImplemented( MethodEntry methodEntry ) |
| 240 | { | 240 | { |
| 241 | return isMethodImplemented( methodEntry.getClassName(), methodEntry.getName(), methodEntry.getSignature() ); | 241 | Collection<MethodEntry> implementations = m_methodImplementations.get( methodEntry.getClassName() ); |
| 242 | } | ||
| 243 | |||
| 244 | public boolean isMethodImplemented( String className, String methodName, String methodSignature ) | ||
| 245 | { | ||
| 246 | Collection<MethodEntry> implementations = m_methodImplementations.get( className ); | ||
| 247 | if( implementations == null ) | 242 | if( implementations == null ) |
| 248 | { | 243 | { |
| 249 | return false; | 244 | return false; |
| 250 | } | 245 | } |
| 251 | return implementations.contains( getMethodKey( methodName, methodSignature ) ); | 246 | return implementations.contains( methodEntry ); |
| 252 | } | 247 | } |
| 253 | |||
| 254 | 248 | ||
| 255 | public ClassInheritanceTreeNode getClassInheritance( Translator deobfuscatingTranslator, ClassEntry obfClassEntry ) | 249 | public ClassInheritanceTreeNode getClassInheritance( Translator deobfuscatingTranslator, ClassEntry obfClassEntry ) |
| 256 | { | 250 | { |
| @@ -272,7 +266,12 @@ public class JarIndex | |||
| 272 | String baseImplementationClassName = obfMethodEntry.getClassName(); | 266 | String baseImplementationClassName = obfMethodEntry.getClassName(); |
| 273 | for( String ancestorClassName : m_ancestries.getAncestry( obfMethodEntry.getClassName() ) ) | 267 | for( String ancestorClassName : m_ancestries.getAncestry( obfMethodEntry.getClassName() ) ) |
| 274 | { | 268 | { |
| 275 | if( isMethodImplemented( ancestorClassName, obfMethodEntry.getName(), obfMethodEntry.getSignature() ) ) | 269 | MethodEntry ancestorMethodEntry = new MethodEntry( |
| 270 | new ClassEntry( ancestorClassName ), | ||
| 271 | obfMethodEntry.getName(), | ||
| 272 | obfMethodEntry.getSignature() | ||
| 273 | ); | ||
| 274 | if( isMethodImplemented( ancestorMethodEntry ) ) | ||
| 276 | { | 275 | { |
| 277 | baseImplementationClassName = ancestorClassName; | 276 | baseImplementationClassName = ancestorClassName; |
| 278 | } | 277 | } |
| @@ -305,9 +304,4 @@ public class JarIndex | |||
| 305 | { | 304 | { |
| 306 | return m_methodCalls.get( entry ); | 305 | return m_methodCalls.get( entry ); |
| 307 | } | 306 | } |
| 308 | |||
| 309 | private String getMethodKey( String name, String signature ) | ||
| 310 | { | ||
| 311 | return name + signature; | ||
| 312 | } | ||
| 313 | } | 307 | } |
diff --git a/src/cuchaz/enigma/analysis/MethodInheritanceTreeNode.java b/src/cuchaz/enigma/analysis/MethodInheritanceTreeNode.java index a28a9f4..73f9714 100644 --- a/src/cuchaz/enigma/analysis/MethodInheritanceTreeNode.java +++ b/src/cuchaz/enigma/analysis/MethodInheritanceTreeNode.java | |||
| @@ -93,7 +93,7 @@ public class MethodInheritanceTreeNode extends DefaultMutableTreeNode | |||
| 93 | nodes.add( new MethodInheritanceTreeNode( | 93 | nodes.add( new MethodInheritanceTreeNode( |
| 94 | m_deobfuscatingTranslator, | 94 | m_deobfuscatingTranslator, |
| 95 | methodEntry, | 95 | methodEntry, |
| 96 | index.isMethodImplemented( subclassName, m_entry.getName(), m_entry.getSignature() ) | 96 | index.isMethodImplemented( methodEntry ) |
| 97 | ) ); | 97 | ) ); |
| 98 | } | 98 | } |
| 99 | 99 | ||