Skip to main content


Eclipse Community Forums
Forum Search:

Search      Help    Register    Login    Home
Home » Language IDEs » AspectJ » Aspect priority(weaving order)
Aspect priority(weaving order) [message #51268] Tue, 03 May 2005 14:14 Go to next message
Eclipse UserFriend
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 #51295 is a reply to message #51268] Tue, 03 May 2005 14:50 Go to previous messageGo to next message
Eclipse UserFriend
Originally posted by: clemas.uk.ibm.com

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 #51320 is a reply to message #51295] Tue, 03 May 2005 16:31 Go to previous message
Eclipse UserFriend
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 14:50 Go to previous message
Andrew Clement is currently offline Andrew ClementFriend
Messages: 162
Registered: July 2009
Senior Member
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 16:31 Go to previous message
Eclipse UserFriend
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).
> >
> >
Previous Topic:Aspect priority(weaving order)
Next Topic:Looking for Class File ByteCode Weaving for Eclipse 2.1
Goto Forum:
  


Current Time: Tue Apr 16 07:52:39 GMT 2024

Powered by FUDForum. Page generated in 0.09574 seconds
.:: Contact :: Home ::.

Powered by: FUDforum 3.0.2.
Copyright ©2001-2010 FUDforum Bulletin Board Software

Back to the top