0

use Javassist to add some code statically at the beginning of a method right after the class is compiled. For example,

public String getFoo() {
    // add some code here

    return "foo";
}

From Eclipse debug, I can not see the added code. Is there a way for Eclipse to show de-compiled code instead of original source?

How to debug it?

eastwater
  • 4,624
  • 9
  • 49
  • 118

1 Answers1

0

Once you've created the CtClass, you can call CtClass.writeFile to save the bytecode of the resulting java class. Then you can use a java decompiler to view the source. The generated source is not perfect ( it would probably not compile ) but it gives you a good idea of what's going on. I use the decompiler built into IntelliJ ( community edition ) but some googling will find you a few other options.

Nicholas
  • 15,916
  • 4
  • 42
  • 66