[
Date Prev][
Date Next][
Thread Prev][
Thread Next][
Date Index][
Thread Index]
[
List Home]
Re: [aspectj-users] proxying subclasses
|
Wes Isberg wrote:
Normally you can supply a stub/mock/proxy as follows:
Foo around() : call(Foo.new(..)) {
return FooStub.create(thisJoinPoint.getArgs());
}
but this fails to handle subclasses, esp. anonymous ones:
void someMethod() {
Foo me = new Foo("foo") {
public String toString() { return "bar"; }
};
}
OK, my last message was pretty convoluted. But why not, instead of
creating a proxy via FooStub, just created on with advice. That is,
intersept the calls you'd like to replace by using a proxy with around
advice, instead of actually creating a proxy object?
Jeff
The only alternative seems to be some combination of advising all the
target method-call and field g/set join points, or using declare-parents
to interpose the stub:
declare parents (Foo+ && !Foo) : FooStub;
Both of those have their own drawbacks.
Can anyone think of a good workaround?
Wes
_______________________________________________
aspectj-users mailing list
aspectj-users@xxxxxxxxxxx
http://dev.eclipse.org/mailman/listinfo/aspectj-users
--
Jeffrey Palm --> http://www.ccs.neu.edu/home/jpalm