Eclipse Community Forums - RDF feed
https://www.eclipse.org/forums/
Eclipse Community ForumsDebugging LTW weaved classes
https://www.eclipse.org/forums/index.php/mv/msg/487938/1060205/#msg_1060205
I have a Spring(3.2.2) + AspectJ(1.7.2) application configured with Load Time Weaving.
In Netbeans, I'm having trouble while debugging woven classes methods, for example the methods annotated with @Transactional. I'm able to put break points in this methods, but when I click "Step over" the debugger doesn't go to the next line, it jumps to line 1 and then to other classes...
I found on stackoverflow (eclipse-debug-stepping-with-aspectj) info that this is a bug in AspectJ.
When I run on Eclipse the debugging is OK, "Step over" works fine(with the exception of the first line in method for which is necessary to press it twice).
Also tried running this code in IntelliJ, there I have the same situation as in Netbeans.
I've googled a lot, but I couldn't find good explanation...
Is this a bug indeed? Does Eclipse IDE has a feature or something that permits the debugging to go smooth? If this is a bug, is there a time frame defined when the bug will be fixed, which release?
Is there a solution/configuration parameter to make this work in other IDEs (Netbeans, IntelliJ), tried -XnoInline, but it didn't help.
Thank you in advance,
Dumitru]]>Dumitru Boldureanu2013-05-23T13:46:35-00:00Re: Debugging LTW weaved classes
https://www.eclipse.org/forums/index.php/mv/msg/487938/1060234/#msg_1060234
AspectJ will add some synthetic methods to handle advice invocation and access to otherwise private methods. So, the first time that you stop at an advised method, you are actually stopping at the synthetic accessor method. The debugger stops at the method entry point. When you step in again, you will get into the method itself.
This is an artifact of the way that synthetic methods are debugged in the JVM. You will see similar behavior when an inner class invokes a private method of an outer class. This adds a synthetic accessor method as well and you will see the same debug behavior.
I'm surprised that IntelliJ and NetBeans behave differently since both should be using the same JVM debug APIs as Eclipse. Try again and make sure to use step in, instead of over.
Not sure if this answers your question, so please clarify if you have anything else.]]>Andrew Eisenberg2013-05-23T15:58:51-00:00Re: Debugging LTW weaved classes
https://www.eclipse.org/forums/index.php/mv/msg/487938/1061321/#msg_1061321
I've found out what is the problem in debugging that code.
Spring in version 3.2.2 has changed the @Transactional aspect, replaced @Before and @After combination with @Around.
When running my tests with Spring < 3.2.2, debugging works fine.
It's a pity that @Around makes the @Transactional methods almost impossible to debug.
Is this a know issue(using @Around) in AspectJ?
I've added a spring issue related to this problem: SPR-10596
I hope they will move back to the @Before and @After combination.]]>Dumitru Boldureanu2013-05-31T08:11:23-00:00Re: Debugging LTW weaved classes
https://www.eclipse.org/forums/index.php/mv/msg/487938/1061431/#msg_1061431
https://bugs.eclipse.org/bugs/show_bug.cgi?id=80430. You can still step and debug through around advice. The problem is that the debugger steps through the wrong file. This does make things hard to debug.
A workaround that I typically do is to have the aspect file open next to the target file. As the debugger erroneously steps through the target file, I keep an eye on the same line in the aspect file.]]>Andrew Eisenberg2013-05-31T15:16:30-00:00