Eclipse Community Forums
Forum Search:

Search      Help    Register    Login    Home
Home » Language IDEs » AJDT » Debugging LTW weaved classes(Debugging LTW weaved classes in different browsers)
Debugging LTW weaved classes [message #1060205] Thu, 23 May 2013 13:46 Go to next message
Dumitru Boldureanu is currently offline Dumitru BoldureanuFriend
Messages: 2
Registered: May 2013
Junior Member
Hello everybody,

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

[Updated on: Thu, 23 May 2013 14:41]

Report message to a moderator

Re: Debugging LTW weaved classes [message #1060234 is a reply to message #1060205] Thu, 23 May 2013 15:58 Go to previous messageGo to next message
Andrew Eisenberg is currently offline Andrew EisenbergFriend
Messages: 369
Registered: July 2009
Senior Member
I don't use NetBeans or IntelliJ, so I can't say if they will be able to fix this problem. It looks like to me that you should be using step into rather than step over.

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.
Re: Debugging LTW weaved classes [message #1061321 is a reply to message #1060234] Fri, 31 May 2013 08:11 Go to previous messageGo to next message
Dumitru Boldureanu is currently offline Dumitru BoldureanuFriend
Messages: 2
Registered: May 2013
Junior Member
Thank you Andrew for your quick response.

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.
Re: Debugging LTW weaved classes [message #1061431 is a reply to message #1061321] Fri, 31 May 2013 15:16 Go to previous message
Andrew Eisenberg is currently offline Andrew EisenbergFriend
Messages: 369
Registered: July 2009
Senior Member
This is a known problem and has been around for a while. See 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.
Previous Topic:ClassFormatException with AJDT and RAD 8
Next Topic:Duplicate classes when using maven weave dependencies
Goto Forum:
  


Current Time: Sun Nov 23 14:52:21 GMT 2014

Powered by FUDForum. Page generated in 0.03176 seconds
.:: Contact :: Home ::.

Powered by: FUDforum 3.0.2.
Copyright ©2001-2010 FUDforum Bulletin Board Software