diff options
| author | 2014-09-21 23:21:34 -0400 | |
|---|---|---|
| committer | 2014-09-21 23:21:34 -0400 | |
| commit | 24ed3dc06bc133e4f718acc4a691e905b081fb11 (patch) | |
| tree | e4a73d03f74bb7125216e351eb673809f89a00c3 /src/cuchaz/enigma/bytecode/InnerClassWriter.java | |
| parent | improved inner/anonymous class detection (diff) | |
| download | enigma-fork-24ed3dc06bc133e4f718acc4a691e905b081fb11.tar.gz enigma-fork-24ed3dc06bc133e4f718acc4a691e905b081fb11.tar.xz enigma-fork-24ed3dc06bc133e4f718acc4a691e905b081fb11.zip | |
fixed bugs with anonymous/inner classes
Diffstat (limited to 'src/cuchaz/enigma/bytecode/InnerClassWriter.java')
| -rw-r--r-- | src/cuchaz/enigma/bytecode/InnerClassWriter.java | 14 |
1 files changed, 14 insertions, 0 deletions
diff --git a/src/cuchaz/enigma/bytecode/InnerClassWriter.java b/src/cuchaz/enigma/bytecode/InnerClassWriter.java index 5044e06..f94a85d 100644 --- a/src/cuchaz/enigma/bytecode/InnerClassWriter.java +++ b/src/cuchaz/enigma/bytecode/InnerClassWriter.java | |||
| @@ -16,8 +16,10 @@ import javassist.CtClass; | |||
| 16 | import javassist.bytecode.AccessFlag; | 16 | import javassist.bytecode.AccessFlag; |
| 17 | import javassist.bytecode.ConstPool; | 17 | import javassist.bytecode.ConstPool; |
| 18 | import javassist.bytecode.Descriptor; | 18 | import javassist.bytecode.Descriptor; |
| 19 | import javassist.bytecode.EnclosingMethodAttribute; | ||
| 19 | import javassist.bytecode.InnerClassesAttribute; | 20 | import javassist.bytecode.InnerClassesAttribute; |
| 20 | import cuchaz.enigma.analysis.JarIndex; | 21 | import cuchaz.enigma.analysis.JarIndex; |
| 22 | import cuchaz.enigma.mapping.BehaviorEntry; | ||
| 21 | import cuchaz.enigma.mapping.ClassEntry; | 23 | import cuchaz.enigma.mapping.ClassEntry; |
| 22 | 24 | ||
| 23 | public class InnerClassWriter | 25 | public class InnerClassWriter |
| @@ -44,6 +46,18 @@ public class InnerClassWriter | |||
| 44 | // this is an inner class, rename it to outer$inner | 46 | // this is an inner class, rename it to outer$inner |
| 45 | ClassEntry obfClassEntry = new ClassEntry( obfOuterClassName + "$" + new ClassEntry( obfClassName ).getSimpleName() ); | 47 | ClassEntry obfClassEntry = new ClassEntry( obfOuterClassName + "$" + new ClassEntry( obfClassName ).getSimpleName() ); |
| 46 | c.setName( obfClassEntry.getName() ); | 48 | c.setName( obfClassEntry.getName() ); |
| 49 | |||
| 50 | BehaviorEntry caller = m_jarIndex.getAnonymousClassCaller( obfClassName ); | ||
| 51 | if( caller != null ) | ||
| 52 | { | ||
| 53 | // write the enclosing method attribute | ||
| 54 | c.getClassFile().addAttribute( new EnclosingMethodAttribute( | ||
| 55 | c.getClassFile().getConstPool(), | ||
| 56 | caller.getClassName(), | ||
| 57 | caller.getName(), | ||
| 58 | caller.getSignature() | ||
| 59 | ) ); | ||
| 60 | } | ||
| 47 | } | 61 | } |
| 48 | 62 | ||
| 49 | // write the inner classes if needed | 63 | // write the inner classes if needed |