Skip to main content

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index] [List Home]
[aspectj-users] Re: aspectj-users Digest, Vol 33, Issue 24

Dear Hans Schippers,

  Just complementing what Eric Bolden said:

>> However, I suspect it will not match other methods named "myMethod", defined
>>in super- or subclasses of myClass. Is this correct? If so, what's the
>>rationale behind this?

    It will match calls in sublcasses because any instance of an object of your subclass is also
  an instance of the super class. (Eric Bolden). On the other hand, If I remeber correctly, This behavior is the same to execution pointucts.  (Check this and If you can send the answer)

>>Also, what about a method with more/less specific parameter types?
 
    Parameters are matched exact, unless you specify something like:

  •   call(String MyClass.myMethod(..))  --> intercepts all calls to "String myMethod with any arguments" in MyClass or Subtypes (with or with no method overriden) and (Assuming no use the "within" designator).
  • call(* MyClass.myMethod(..))  --> intercepts all calls to "* myMethod with any arguments and returning any type" in MyClass or Subtypes (with or with no method overriden) and (Assuming no use the "within" designator).

 
    Henrique.

 
On Nov 19, 2007 1:11 PM, <aspectj-users-request@xxxxxxxxxxx > wrote:
Send aspectj-users mailing list submissions to
        aspectj-users@xxxxxxxxxxx

To subscribe or unsubscribe via the World Wide Web, visit
       https://dev.eclipse.org/mailman/listinfo/aspectj-users
or, via email, send a message with subject or body 'help' to
       aspectj-users-request@xxxxxxxxxxx

You can reach the person managing the list at
       aspectj-users-owner@xxxxxxxxxxx

When replying, please edit your Subject line so it is more specific
than "Re: Contents of aspectj-users digest..."


Today's Topics:

  1. Question on disabling aspect... (Kyle Lomeli)
  2. Re: Question on disabling aspect... (Eric Bodden)
  3. Re: Question on disabling aspect... (Kyle Lomeli)
  4. Re: NoClassDefFound in AspectJ Plug-in
     (Bartlomiej Zdanowski [Zdanek])
  5. Re: Re: [aspectj-users] NoClassDefFound in AspectJ Plug-in
     (aztlan@xxxxxxxxxxxxxx)
  6. pointcuts automatically matching joinpoints in    subclasses?
     (SainTiss)


----------------------------------------------------------------------

Message: 1
Date: Fri, 16 Nov 2007 10:35:40 -0800 (PST)
From: Kyle Lomeli < kyllerss_009@xxxxxxxxx>
Subject: [aspectj-users] Question on disabling aspect...
To: aspectj-users@xxxxxxxxxxx
Message-ID: < 401428.74489.qm@xxxxxxxxxxxxxxxxxxxxxxx>
Content-Type: text/plain; charset="us-ascii"

I am trying to find out if AspectJ is capable of addressing the following issue. I have a certain set of methods that are all intercepted by an aspect I created. The aspect intercepts all methods and logs some information pertaining to each method invocation.

method1() -> logs something
method2() -> logs something else
method3() -> logs my pijamas

I have another method that when invoked may make a call to either of these methods. However, any methods invoked from this special method should not trigger the logging aspect.

diagnosticMethod() -> calls
                              -> method1() -> logs nothing
                              -> method2() -> logs nothing
                              -> method3() -> logs nothing

Is there any way of defining a pointcut such that any method invocations resulting from diagnosticMethod() will NOT trigger the aspect? I would rather not have to resort to manually enabling and disabling the aspect based on a ThreadLocal variable.

Thanks for any pointers.

-Kyle



-------------- next part --------------
An HTML attachment was scrubbed...
URL: https://dev.eclipse.org/mailman/listinfo/aspectj-users/attachments/20071116/272b0f21/attachment.html

------------------------------

Message: 2
Date: Fri, 16 Nov 2007 13:59:54 -0500
From: "Eric Bodden" < eric.bodden@xxxxxxxxxxxxxx>
Subject: Re: [aspectj-users] Question on disabling aspect...
To: aspectj-users@xxxxxxxxxxx
Message-ID:
       <804e3c660711161059y258bd5d2pcbb42a93ca0930d3@xxxxxxxxxxxxxx>
Content-Type: text/plain; charset=ISO-8859-1

Yes, you can use &&!cflow(execution(* diagnosticMethod())).

Eric

On 16/11/2007, Kyle Lomeli <kyllerss_009@xxxxxxxxx> wrote:
>
> I am trying to find out if AspectJ is capable of addressing the following
> issue. I have a certain set of methods that are all intercepted by an aspect
> I created. The aspect intercepts all methods and logs some information
> pertaining to each method invocation.
>
> method1() -> logs something
> method2() -> logs something else
> method3() -> logs my pijamas
>
> I have another method that when invoked may make a call to either of these
> methods. However, any methods invoked from this special method should not
> trigger the logging aspect.
>
> diagnosticMethod() -> calls
>                                -> method1() -> logs nothing
>                                -> method2() -> logs nothing
>                                -> method3() -> logs nothing
>
> Is there any way of defining a pointcut such that any method invocations
> resulting from diagnosticMethod() will NOT trigger the aspect? I would
> rather not have to resort to manually enabling and disabling the aspect
> based on a ThreadLocal variable.
>
> Thanks for any pointers.
>
> -Kyle
>
>
>
> _______________________________________________
> aspectj-users mailing list
> aspectj-users@xxxxxxxxxxx
> https://dev.eclipse.org/mailman/listinfo/aspectj-users
>
>


--
Eric Bodden
Sable Research Group
McGill University, Montréal, Canada


------------------------------

Message: 3
Date: Fri, 16 Nov 2007 13:25:40 -0800 (PST)
From: Kyle Lomeli <kyllerss_009@xxxxxxxxx>
Subject: Re: [aspectj-users] Question on disabling aspect...
To: aspectj-users@xxxxxxxxxxx
Message-ID: <320482.44789.qm@xxxxxxxxxxxxxxxxxxxxxxx>
Content-Type: text/plain; charset="iso-8859-1"

Ah... that makes sense. I have used "!cflow(adviceexecution())" to prevent the same thing from happening from within the aspect's execution flow. Essentially then "adviceexecution()" is the same thing as "execution(..)", only from the dynamic context of an aspect advise. I hadn't connected the dots.

Thanks!

-Kyle

----- Original Message ----
From: Eric Bodden <eric.bodden@xxxxxxxxxxxxxx>
To: aspectj-users@xxxxxxxxxxx
Sent: Friday, November 16, 2007 1:59:54 PM
Subject: Re: [aspectj-users] Question on disabling aspect...


Yes, you can use &&!cflow(execution(* diagnosticMethod())).

Eric

On 16/11/2007, Kyle Lomeli < kyllerss_009@xxxxxxxxx> wrote:
>
> I am trying to find out if AspectJ is capable of addressing the
 following
> issue. I have a certain set of methods that are all intercepted by an
 aspect
> I created. The aspect intercepts all methods and logs some
 information
> pertaining to each method invocation.
>
> method1() -> logs something
> method2() -> logs something else
> method3() -> logs my pijamas
>
> I have another method that when invoked may make a call to either of
 these
> methods. However, any methods invoked from this special method should
 not
> trigger the logging aspect.
>
> diagnosticMethod() -> calls
>                                -> method1() -> logs nothing
>                                -> method2() -> logs nothing
>                                -> method3() -> logs nothing
>
> Is there any way of defining a pointcut such that any method
 invocations
> resulting from diagnosticMethod() will NOT trigger the aspect? I
 would
> rather not have to resort to manually enabling and disabling the
 aspect
> based on a ThreadLocal variable.
>
> Thanks for any pointers.
>
> -Kyle
>
>
>
> _______________________________________________
> aspectj-users mailing list
> aspectj-users@xxxxxxxxxxx
> https://dev.eclipse.org/mailman/listinfo/aspectj-users
>
>


--
Eric Bodden
Sable Research Group
McGill University, Montréal, Canada
_______________________________________________
aspectj-users mailing list
aspectj-users@xxxxxxxxxxx
https://dev.eclipse.org/mailman/listinfo/aspectj-users



-------------- next part --------------
An HTML attachment was scrubbed...
URL: https://dev.eclipse.org/mailman/listinfo/aspectj-users/attachments/20071116/7a9ab821/attachment.html

------------------------------

Message: 4
Date: Mon, 19 Nov 2007 07:40:48 +0100
From: "Bartlomiej Zdanowski [Zdanek]" < b.zdanowski@xxxxxxxxxxxx>
Subject: Re: [aspectj-users] NoClassDefFound in AspectJ Plug-in
To: aspectj-users@xxxxxxxxxxx
Cc: aztlan@xxxxxxxxxxxxxx
Message-ID: <47412FF0.1020000@xxxxxxxxxxxx>
Content-Type: text/plain; charset="iso-8859-2"

Hello Ania.

aztlan@xxxxxxxxxxxxxx pisze:
> I tried to add these project plug-ins in the inpath for the aspect plug-in, but the dependencies where going very deep and as the result the weaving took ages and ended up in java heap space error.
>
You may increase more memory to Eclipse, just to see if it's possible to
compile with configuration you are using
"C:\Program Files\eclipse3.3\eclipse.exe" -vmargs -Xms256m -Xmx952m
-XX:MaxPermSize=256m

> After that when I started the project, I got NoClassDefFoundError for classes that are in those plug-ins and were certainly not missing before I switched to aspectJ.
>
> What am I missing? I'll be glad for any help.
>
Rest of your description is not clear enough. Only I can suspect is that
you have some problems with source folders. Maybe you are linking some
source folders from other Projects/paths and sometimes Eclipse disables
such linked folders. Their icon is ordinary folder icon instead of
package-icon. Check it. Clear and rebuild whole project.
I had many problems with AspectJ plugin when there were any errors in
Aspects code. Check AspectJ console output for these.

You may provide more info about you dir/file structure etc.

Best regards,
--
*Bartlomiej Zdanowski*
Programmer
Product Research & Development Department
AutoGuard S.A.

Place of registration: Regional Court for the Capital City of Warsaw
Registration no.: 0000287629
Share capital: 1 059 000 PLN
Polish VAT and tax ID no.: PL1132219747
Omulewska 27 street
04-128 Warsaw
Poland
phone +48 22 611 69 23
www.autoguard.pl <http://www.autoguard.pl>
-------------- next part --------------
An HTML attachment was scrubbed...
URL: https://dev.eclipse.org/mailman/listinfo/aspectj-users/attachments/20071119/c52b3fbc/attachment.html

------------------------------

Message: 5
Date: Mon, 19 Nov 2007 11:14:13 +0100
From: aztlan@xxxxxxxxxxxxxx
Subject: Re: Re: [aspectj-users] NoClassDefFound in AspectJ Plug-in
To: aztlan@xxxxxxxxxxxxxx, aspectj-users@xxxxxxxxxxx
Cc: aztlan@xxxxxxxxxxxxxx
Message-ID:
       <Q42228445-9512e9e5e083927509ca2c474779f9f8@xxxxxxxxxxxxxxxxx >
Content-Type: text/plain; charset="us-ascii"

Thank you for your interest.
Making the heap bigger doesn't help.
I'd rather try to add the aspects project to the plugin projects, if it's possible.
I'll try to write clearly, how I tried to do it.
1. I have a few projects, each containing one eclipse plugin, they have aspectJ nature, but don't contain any aspects, let's call them plugins A..Z.
2. I have one additional project containing aspects, this is also a plugin and obviously has aspect nature, let's call it plugin XX.
3. In plugin dependencies of XX I added plugis A..Z, so that in the aspects the classes are known.
4. I didn't add plugin XX in dependencies of A..Z, because that would result in a cycle.
5. I added project XX in to AspectPath of A..Z.

That's all that I did. You suggest, that I might have an error in aspect code. I don't think it's likely, because the same aspect copied into one of the projects A..Z works just fine.

What else should I do to make it work?

Best regards,
Ania

[Zdanek] <b.zdanowski@xxxxxxxxxxxx>:
>Hello Ania.
>
>aztlan@xxxxxxxxxxxxxx pisze:
>> I tried to add these project plug-ins in the inpath for the aspect plug-in, but the dependencies where going very deep and as the result the weaving took ages and ended up in java heap space error.
>>
>You may increase more memory to Eclipse, just to see if it's possible to
>compile with configuration you are using
>"C:\\Program Files\\eclipse3.3\\eclipse.exe" -vmargs -Xms256m -Xmx952m
>-XX:MaxPermSize=256m
>
>> After that when I started the project, I got NoClassDefFoundError for classes that are in those plug-ins and were certainly not missing before I switched to aspectJ.
>>
>> What am I missing? I'll be glad for any help.
>>
>Rest of your description is not clear enough. Only I can suspect is that
>you have some problems with source folders. Maybe you are linking some
>source folders from other Projects/paths and sometimes Eclipse disables
>such linked folders. Their icon is ordinary folder icon instead of
>package-icon. Check it. Clear and rebuild whole project.
>I had many problems with AspectJ plugin when there were any errors in
>Aspects code. Check AspectJ console output for these.
>
>You may provide more info about you dir/file structure etc.
>
>Best regards,
>--
>*Bartlomiej Zdanowski*
>Programmer
>Product Research & Development Department
>AutoGuard S.A.
>
>Place of registration: Regional Court for the Capital City of Warsaw
>Registration no.: 0000287629
>Share capital: 1 059 000 PLN
>Polish VAT and tax ID no.: PL1132219747
>Omulewska 27 street
>04-128 Warsaw
>Poland
>phone +48 22 611 69 23
> www.autoguard.pl <http://www.autoguard.pl>
>

------------------------------

Message: 6
Date: Mon, 19 Nov 2007 17:10:25 +0100
From: SainTiss < saintiss@xxxxxxx>
Subject: [aspectj-users] pointcuts automatically matching joinpoints
       in      subclasses?
To: aspectj-users@xxxxxxxxxxx
Message-ID: <200711191710.27037.saintiss@xxxxxxx>
Content-Type: text/plain;  charset="us-ascii"

Hi all,

if I specify a simple pointcut as follows:

before call Object myClass.myMethod(Object)

this will obviously match calls to the exact method

Object myMethod(Object)
as defined in myClass

However, I suspect it will not match other methods named "myMethod", defined
in super- or subclasses of myClass. Is this correct? If so, what's the
rationale behind this?

Also, what about a method with more/less specific parameter types?
e.g.

Object myMethod(String)
defined in myClass

or

String myMethod(Object)
defined in myClass

Is all this well-defined? Are there good reasons for choosing exactly the
current way of behaviour?

Thanks,

Hans

--
A liberal is a person whose interests aren't at stake at the moment
 -- Willis Player

Hans Schippers
Research Assistant of the Research Foundation - Flanders (FWO - Vlaanderen)
http://www.win.ua.ac.be/~hschipp/
Formal Techniques in Software Engineering (FoTS)
University of Antwerp
Middelheimlaan 1
2020 Antwerpen - Belgium
Phone: +32 3 265 38 71
Fax: +32 3 265 37 77


------------------------------

_______________________________________________
aspectj-users mailing list
aspectj-users@xxxxxxxxxxx
https://dev.eclipse.org/mailman/listinfo/aspectj-users


End of aspectj-users Digest, Vol 33, Issue 24
*********************************************



--
Henrique Mostaert, Departamento de Sistemas Computacionais, UPE
http://www.dsc.upe.br/~hemr

Back to the top