Bug 357788 - Around advice throws IndexOutOfBoundException
Summary: Around advice throws IndexOutOfBoundException
Status: NEW
Alias: None
Product: AspectJ
Classification: Tools
Component: Runtime (show other bugs)
Version: unspecified   Edit
Hardware: PC Windows 7
: P3 major (vote)
Target Milestone: ---   Edit
Assignee: aspectj inbox CLA
QA Contact:
URL:
Whiteboard:
Keywords:
Depends on:
Blocks:
 
Reported: 2011-09-15 08:46 EDT by Nobody - feel free to take it CLA
Modified: 2011-09-15 11:24 EDT (History)
1 user (show)

See Also:


Attachments

Note You need to log in before you can comment on or make changes to this bug.
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;
}