Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Debugging's step into won't work on own code: MyClass$Proxy$_$$_WeldClientProxy.myMethod() line: not available

When debugging I set a breakpoint to a line that calls a method from another (own) class. On step into I get a Source not found in the editor with the title MyClass$Proxy$_$$_WeldClientProxy.myMethod() line: not available in the stacktrace.
I can step over those as long as I am back in the class with the breakpoint.

I have the same problem using Eclipse Kepler SR 1, Eclipse Juno SR 2 and JBoss AS 7.1.1 and 7.2.

like image 518
Lester Avatar asked Oct 16 '13 11:10

Lester


People also ask

How do you step through code in Visual Studio?

Begin code stepping by selecting F10 or F11. Doing so allows you to quickly find the entry point of your app. You can then continue to press step commands to navigate through the code. Run to a specific location or function, for example, by setting a breakpoint and starting your app.

How do I run a line by line code in Visual Studio?

Press F5 until you reach the line of code where you selected Run to Cursor. This command is useful when you are editing code and want to quickly set a temporary breakpoint and start the debugger at the same time. You can use Run to Cursor in the Call Stack window while you are debugging.


1 Answers

That's a common problem with autogenerated code. You believe that an object of yours (let's call it A) invokes a method on another object of yours (let's call it B), but the framework has actually replaced your object B with a proxy B' whose class is autogenerated.

The proxy B' has the same interface as your original object B, and eventually forwards the invocation to B.

Autogenerated code will confuse the debugger, but if you click "step into" blindly -- without seeing the source code -- you should eventually reach your own code again. Needless to say that it's not convenient.

What you can do instead is to

  1. set a breakpoint in the class of B you are interested in
  2. use "run" instead of "step into"

That should stop into the method you are interested in. You should be able to see in the stack the autogenerate methods of the proxy that have been invoked.

Note: you might have similar problem even if you don't use any framework at all. Indeed, the java compiler (javac) already generates synthetic code sometimes, notably for anonymous classes, and bridge methods.

like image 75
ewernli Avatar answered Sep 28 '22 02:09

ewernli