Aspect priority(weaving order) [message #51268] |
Tue, 03 May 2005 10:14  |
Eclipse User |
|
|
|
Originally posted by: absolutntn.netscape.net
Hi, I'm using Eclise 3.0.2 with AspectJ 1.5.0M1
The problem is I can't catch the pointcut on the method i "introduced" in
another aspect.
i have the following model:
interface ISomeInterface{
public void setProperty(String newValue);
}
aspect ASomeInterfaceImpl{
private String ISomeInterface._property;
public void ISomeInterface.setProperty(String newValue){
_property = newValue;
}
}
aspect AEventListener{
pointcut propertyChanged() :
execution(ISomeInterface+.setProperty(..));
after() : propertyChanged() {
// event handling code
// never reached
// so i tried to change the pointcut to:
pointcut propertyChanged() :
set(String ISomeInterface._property);
// but it doesn't work either :(((
}
}
so, from i can see the AEventListener is weaved(???) before the
ASomeIntImpl(which defines the setProperty default behaviour).
|
|
|
|
Re: Aspect priority(weaving order) [message #51320 is a reply to message #51295] |
Tue, 03 May 2005 12:31  |
Eclipse User |
|
|
|
Originally posted by: absolutntn.netscape.net
yeah, u r right, it works in isolation, so it must be some my internal bug
thank for the help anyway - at least i know it's my fault and not yours)))))
"Andy Clement" <clemas@uk.ibm.com> wrote in message
news:d583ee$5v6$1@news.eclipse.org...
> Does that pointcut compile?
>
> > pointcut propertyChanged() :
> > execution(ISomeInterface+.setProperty(..));
>
> You need a return value for the setProperty() method()
>
> pointcut propertyChanged():
> execution(* ISomeInterface+.setProperty(..));
>
>
> You can't get into ordering problems since the changes to the type
> system (your method ITD) happen before the advice matching.
>
> This works for me:
>
> interface I { public void m(String s); }
> aspect X { public void I.m(String s) {} }
> aspect Y { after(): execution(* I+.m(..)) {} }
>
> C:\>ajc X.aj Y.aj I.java -showWeaveInfo
> Type 'X' (X.aj:1) advised by after advice from 'Y' (Y.aj:1)
> Type 'I' (I.java) has intertyped method from 'X' (X.aj:'void
> I.m(java.lang.String)')
>
> The first line of weaving info indicates the pointcut matched.
>
> I must admit I am on 1.5.0M2 but I don't think anything in that area for
> ages.
>
> cheers,
> Andy.
>
> Natan wrote:
> > Hi, I'm using Eclise 3.0.2 with AspectJ 1.5.0M1
> > The problem is I can't catch the pointcut on the method i "introduced"
in
> > another aspect.
> >
> > i have the following model:
> >
> > interface ISomeInterface{
> > public void setProperty(String newValue);
> > }
> >
> >
> > aspect ASomeInterfaceImpl{
> >
> > private String ISomeInterface._property;
> >
> > public void ISomeInterface.setProperty(String newValue){
> > _property = newValue;
> > }
> > }
> >
> >
> > aspect AEventListener{
> > pointcut propertyChanged() :
> > execution(ISomeInterface+.setProperty(..));
> >
> > after() : propertyChanged() {
> > // event handling code
> > // never reached
> >
> > // so i tried to change the pointcut to:
> > pointcut propertyChanged() :
> > set(String ISomeInterface._property);
> > // but it doesn't work either :(((
> > }
> > }
> >
> > so, from i can see the AEventListener is weaved(???) before the
> > ASomeIntImpl(which defines the setProperty default behaviour).
> >
> >
|
|
|
Re: Aspect priority(weaving order) [message #587971 is a reply to message #51268] |
Tue, 03 May 2005 10:50  |
Eclipse User |
|
|
|
Does that pointcut compile?
> pointcut propertyChanged() :
> execution(ISomeInterface+.setProperty(..));
You need a return value for the setProperty() method()
pointcut propertyChanged():
execution(* ISomeInterface+.setProperty(..));
You can't get into ordering problems since the changes to the type
system (your method ITD) happen before the advice matching.
This works for me:
interface I { public void m(String s); }
aspect X { public void I.m(String s) {} }
aspect Y { after(): execution(* I+.m(..)) {} }
C:\>ajc X.aj Y.aj I.java -showWeaveInfo
Type 'X' (X.aj:1) advised by after advice from 'Y' (Y.aj:1)
Type 'I' (I.java) has intertyped method from 'X' (X.aj:'void
I.m(java.lang.String)')
The first line of weaving info indicates the pointcut matched.
I must admit I am on 1.5.0M2 but I don't think anything in that area for
ages.
cheers,
Andy.
Natan wrote:
> Hi, I'm using Eclise 3.0.2 with AspectJ 1.5.0M1
> The problem is I can't catch the pointcut on the method i "introduced" in
> another aspect.
>
> i have the following model:
>
> interface ISomeInterface{
> public void setProperty(String newValue);
> }
>
>
> aspect ASomeInterfaceImpl{
>
> private String ISomeInterface._property;
>
> public void ISomeInterface.setProperty(String newValue){
> _property = newValue;
> }
> }
>
>
> aspect AEventListener{
> pointcut propertyChanged() :
> execution(ISomeInterface+.setProperty(..));
>
> after() : propertyChanged() {
> // event handling code
> // never reached
>
> // so i tried to change the pointcut to:
> pointcut propertyChanged() :
> set(String ISomeInterface._property);
> // but it doesn't work either :(((
> }
> }
>
> so, from i can see the AEventListener is weaved(???) before the
> ASomeIntImpl(which defines the setProperty default behaviour).
>
>
|
|
|
Re: Aspect priority(weaving order) [message #587984 is a reply to message #51295] |
Tue, 03 May 2005 12:31  |
Eclipse User |
|
|
|
Originally posted by: absolutntn.netscape.net
yeah, u r right, it works in isolation, so it must be some my internal bug
thank for the help anyway - at least i know it's my fault and not yours)))))
"Andy Clement" <clemas@uk.ibm.com> wrote in message
news:d583ee$5v6$1@news.eclipse.org...
> Does that pointcut compile?
>
> > pointcut propertyChanged() :
> > execution(ISomeInterface+.setProperty(..));
>
> You need a return value for the setProperty() method()
>
> pointcut propertyChanged():
> execution(* ISomeInterface+.setProperty(..));
>
>
> You can't get into ordering problems since the changes to the type
> system (your method ITD) happen before the advice matching.
>
> This works for me:
>
> interface I { public void m(String s); }
> aspect X { public void I.m(String s) {} }
> aspect Y { after(): execution(* I+.m(..)) {} }
>
> C:\>ajc X.aj Y.aj I.java -showWeaveInfo
> Type 'X' (X.aj:1) advised by after advice from 'Y' (Y.aj:1)
> Type 'I' (I.java) has intertyped method from 'X' (X.aj:'void
> I.m(java.lang.String)')
>
> The first line of weaving info indicates the pointcut matched.
>
> I must admit I am on 1.5.0M2 but I don't think anything in that area for
> ages.
>
> cheers,
> Andy.
>
> Natan wrote:
> > Hi, I'm using Eclise 3.0.2 with AspectJ 1.5.0M1
> > The problem is I can't catch the pointcut on the method i "introduced"
in
> > another aspect.
> >
> > i have the following model:
> >
> > interface ISomeInterface{
> > public void setProperty(String newValue);
> > }
> >
> >
> > aspect ASomeInterfaceImpl{
> >
> > private String ISomeInterface._property;
> >
> > public void ISomeInterface.setProperty(String newValue){
> > _property = newValue;
> > }
> > }
> >
> >
> > aspect AEventListener{
> > pointcut propertyChanged() :
> > execution(ISomeInterface+.setProperty(..));
> >
> > after() : propertyChanged() {
> > // event handling code
> > // never reached
> >
> > // so i tried to change the pointcut to:
> > pointcut propertyChanged() :
> > set(String ISomeInterface._property);
> > // but it doesn't work either :(((
> > }
> > }
> >
> > so, from i can see the AEventListener is weaved(???) before the
> > ASomeIntImpl(which defines the setProperty default behaviour).
> >
> >
|
|
|
Powered by
FUDForum. Page generated in 0.03247 seconds