1

I know that BTrace can trace any target method of a java program. However, I want to know if it can trace a method that is directly defined in code. Like the button listener method, cause I want to trace this event.

button1.addActionListener(new ActionListener () {
      public void actionPerformed(ActionEvent e) {
           .....
      }
}
TrangVu
  • 43
  • 7

1 Answers1

1

In theory it can. The hard part is that the class name of an anonymous inner class depends on the compiler and there is really no way of telling what it will be just looking at the source. You can make a guess but you can easily be wrong.

If you could extract the anonymous inner class into a named inner class it would be much easier.

JB-
  • 2,615
  • 18
  • 17