Skip to main content

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index] [List Home]
Re: [aspectj-users] Help with at aspect declare error stack overflow

Hi,

Thought this would need a bug report, just wasn't sure if I was missing something stupid instead.

Here is the bug report : https://bugs.eclipse.org/bugs/show_bug.cgi?id=364380

Thanks,
Jni

On Mon 21 Nov 2011 11:22:11 AM EST, Andy Clement wrote:
Hi,

Please raise a bugzilla for this:
https://bugs.eclipse.org/bugs/enter_bug.cgi?product=AspectJ

 From a quick look, yes both your aspects should be fine.  You mention
a stack overflow, but what was the stack? (Include it in the bugzilla
if you can).

cheers,
Andy

On 20 November 2011 09:38, Jean-Nicolas<jni.viens@xxxxxxxxx>  wrote:
Hi,

I am getting this weird bug when trying to define an error with
@DeclareError on a method. When compiling, the first time i'm getting a
stack overflow error from aspectj and the second time everything compiles
just fine. We are in LTW. For example, if I do

$ mvn clean
$ mvn jetty:run<---- this will fail and create an ajcore (stack overflow)
$ mvn jetty:run<---- now it works fine

Now, here is the bug I found and how I fixed it... although I don't
understand why it didn't work in the first place.

Here is the NOT-working aspect :

#########################
public class OwnershipSecurityAspect {

     @Pointcut("call(public void ca..setOwner(..))&&
!within(ca..OwnershipSecurityAspect)&&  !within(ca..*Test)")
     public void myPcut() {};

     @DeclareError("myPcut()")
     public static final String securityError = "An advice already exists for
setting an owner";
}
########################

So that creates the error, but if i put the PC declaration inside the
declareError like so :

#########################
public class OwnershipSecurityAspect {

     @DeclareError("call(public void ca..setOwner(..))&&
!within(ca..OwnershipSecurityAspect)&&  !within(ca..*Test)")
     public static final String securityError = "An advice already exists for
setting an owner";
}
##########################

Now everything works fine.

However, the first method should work too, it's even the example in the doc
:
http://www.eclipse.org/aspectj/doc/next/aspectj5rt-api/org/aspectj/lang/annotation/DeclareError.html

Also note that the setOwner() method IS called inside this aspect... so I
thought it was infinite recursion... but I didn't even change the pointcut
definition, so I don't think this is the issue at hand here...

Thanks in advance for the help,
Jni

_______________________________________________
aspectj-users mailing list
aspectj-users@xxxxxxxxxxx
https://dev.eclipse.org/mailman/listinfo/aspectj-users


_______________________________________________
aspectj-users mailing list
aspectj-users@xxxxxxxxxxx
https://dev.eclipse.org/mailman/listinfo/aspectj-users


Back to the top