Some Eclipse Foundation services are deprecated, or will be soon. Please ensure you've read this important communication.

Bug 357788

Summary: Around advice throws IndexOutOfBoundException
Product: [Tools] AspectJ Reporter: Nobody - feel free to take it <nobody>
Component: RuntimeAssignee: aspectj inbox <aspectj-inbox>
Status: NEW --- QA Contact:
Severity: major    
Priority: P3 CC: aclement
Version: unspecified   
Target Milestone: ---   
Hardware: PC   
OS: Windows 7   
Whiteboard:

Description Nobody - feel free to take it CLA 2011-09-15 08:46:00 EDT
Build Identifier: 20110615-0604



This annotated around advice throws an IndexOutOfBoundEx:
----
@Around(" serviceCall() && this(me) ")
public Object adviceThrowsOutOfBoundEx(ProceedingJoinPoint pjp, Main me) throws Throwable {

	Object o = pjp.proceed(new Object[] { me });

	return o;
}
----

* serviceCall() = "call(public benoit.dto.Response benoit.service.Service.serviceOne(benoit.dto.Request) "

Yet the equivalent advice with aspectj syntax works just fine:
----
Object around(Main me) : serviceCall() && this(me) {

	Object o = proceed(me);

	return o;
}
----


Surprisingly the annotated advice does work when binding both this() and args():
----
@Around(" serviceCall() && this(me) && args(request) ")
public Object adviceRunsFine(ProceedingJoinPoint pjp, Main me, Request request) throws Throwable {

	Object o = pjp.proceed(new Object[] { me , request});

	return o;
}
----

Kind Regards,
BenoƮt

Reproducible: Always
Comment 1 Andrew Clement CLA 2011-09-15 11:24:57 EDT
if you want a workaround before this gets addressed, use:

@Around(" serviceCall() && this(me) ")
public Object adviceThrowsOutOfBoundEx(ProceedingJoinPoint pjp, Main me) throws
Throwable {

    Object o = pjp.proceed(new Object[] { me,pjp.getArgs()[0] });

    return o;
}