From 89c287f39f432385febf97779f51c45a6c3eb51b Mon Sep 17 00:00:00 2001 From: jeff Date: Mon, 22 Sep 2014 23:35:02 -0400 Subject: fix bug with anonymous classes in class initializers --- src/cuchaz/enigma/bytecode/InnerClassWriter.java | 22 ++++++++++++++++------ 1 file changed, 16 insertions(+), 6 deletions(-) (limited to 'src/cuchaz') diff --git a/src/cuchaz/enigma/bytecode/InnerClassWriter.java b/src/cuchaz/enigma/bytecode/InnerClassWriter.java index f94a85d7..a0617925 100644 --- a/src/cuchaz/enigma/bytecode/InnerClassWriter.java +++ b/src/cuchaz/enigma/bytecode/InnerClassWriter.java @@ -51,12 +51,22 @@ public class InnerClassWriter if( caller != null ) { // write the enclosing method attribute - c.getClassFile().addAttribute( new EnclosingMethodAttribute( - c.getClassFile().getConstPool(), - caller.getClassName(), - caller.getName(), - caller.getSignature() - ) ); + if( caller.getName().equals( "" ) ) + { + c.getClassFile().addAttribute( new EnclosingMethodAttribute( + c.getClassFile().getConstPool(), + caller.getClassName() + ) ); + } + else + { + c.getClassFile().addAttribute( new EnclosingMethodAttribute( + c.getClassFile().getConstPool(), + caller.getClassName(), + caller.getName(), + caller.getSignature() + ) ); + } } } -- cgit v1.2.3