When rewriting code with Javassist for a method. All the code after one statement seems to be missing
===

Javassist Problem when rewriting code for a method. All the code after one statement seems to be missing even though there is no exception being thrown.

I have a class whose method I am rewriting with Javaassist. Below is an example. The first System.exit() call would execute fine. The second does never get executed - provided I remove the first one of course. :)

    StringBuffer executeSource = new StringBuffer();

    //...

    final String EVENT = "e" + eDef.id;
    final String EVENT_CLAZZ = eDef.clazz.getName();
    
    //executeSource.append("System.exit(-1);");
    //executeSource.append("\n");    

    executeSource.append(eDef.clazz.getName() + " " + EVENT + " = (" + EVENT_CLAZZ + ")" + EVENT_CLAZZ + "#create();");
    executeSource.append("\n");

    executeSource.append("System.exit(-1);");
    executeSource.append("\n");

    //...