Skip to main content

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index] [List Home]
Re: [aspectj-users] @this(@Foo) does not work


Hi,

I'm surprised by that - I thought 20050217 would include the fix, I'd
give it a try but the eclipse site is down right now so won't be able
to test it until tomorrow.  I am usually working with the latest dev
build of AspectJ which I know supports this program correctly.

We are getting close to AspectJ 1.5.0M2 and that will 100% support

everything related to annotation matching/binding as described
in the developers notebook.

Along with my example program I sent to the list yesterday, I
privately emailed you a zip of all our 1.5 testcode, did you
receive it?  Or was it treated as spam ;)  let me know and I
can resend if necessary.

cheers,
Andy.



"Oli B." <boehm@xxxxxxxxxx>
Sent by: aspectj-users-admin@xxxxxxxxxxx

20/02/2005 11:02

Please respond to
aspectj-users@xxxxxxxxxxx

To
aspectj-users@xxxxxxxxxxx
cc
Subject
Re: [aspectj-users] @this(@Foo) does not work





Hi Andrew,

thanks for your answer, it helps me a lot. I upgraded to the last build
(Build id: 20050217151031) and tried it again. The NoClassDefFoundError
disappears but my example still does not work as expected.

Then I tried your example and got only "method" as output. I guess that
work is still in progress. Is it possible to see the state of the AJDT
project or the testcases? Or where I can find the testcases or examples?

kind regards
Oliver



Andrew Clement wrote:
>
> Hi,
>
> I believe the problem here is the age of the build you are using -
> what you are trying to do is perfectly valid.
>
> We've put in *loads* of fixes and enhancements for annotations in the
> last couple of weeks that won't be in a build from 20050204.  In your
> particular case you are possibly hitting a bug we had with annotations
> in packages.
>
> If you try a more recent AJDT then that will fix it.  The new build
> will also have annotation binding in so you examine the annotation in
> your advice.  Here is an example:
>
> --------8<----------------------------
> import java.lang.annotation.*;
>
> @Retention(RetentionPolicy.RUNTIME)
> @interface Colored { String color(); }
>
> @Colored(color="yellow")
> public class AtTarget1 {
>   public static void main(String[]argv) {
>     new AtTarget1().m();
>   }
>   public void m() {
>     System.err.println("method");
>   }
> }
>
> aspect X {
>   before(Colored c): call(* *(..)) && !within(X) && @target(c) {
>     System.err.println("Color = "+c.color());
>   }
> }
> --------8<----------------------------
>
> The documentation we try and keep up to date is the developers notebook
> and Adrian is currently converting all examples in that notebook into
> real testcases to confirm it does work as claimed.  As for other
> examples, I think we have about 150 testcases for java5 features in CVS -
> some of those will probably make it into the shipped examples at some
> point.
>
> I should mention an imminent change of syntax, based on some traffic
> on this list.  You won't need the @ in front of your annotation when
> using it within an @ pointcut, so your @target(@Role) will become
> @target(Role).
>
> cheers,
> Andy.
> ---
> Andy Clement
> AspectJ
>
>
>
>
>
> *"Oli B." <boehm@xxxxxxxxxx>*
> Sent by: aspectj-users-admin@xxxxxxxxxxx
>
> 18/02/2005 19:27
> Please respond to
> aspectj-users@xxxxxxxxxxx
>
>
>                  
> To
>                  aspectj-users@xxxxxxxxxxx
> cc
>                  
> Subject
>                  [aspectj-users] @this(@Foo) does not work
>
>
>                  
>
>
>
>
>
> Hi,
>
> I'm just trying the new AspectJ5 features for my new book using the
> AspectJ 5 Developers Notebook. But with the @this(@Foo) (and the
> following examples) I have problems. Here is my example:
>
>     after() : call(public * *.*(..)) && @target(@Role) {
>         log.info("@@@ " + thisJoinPoint.toShortString());
>     }
>
> I want to log all calls where the target has a @Role annotation. The
> compilation is successful but when I start my test cases I get a
>
> java.lang.NoClassDefFoundError: Role
>                 at
> space.LogBook.ajc$after$space_LogBook$1$69ac1cc5(LogBook.aj:38)
>                 at space.Taxi.<init>(Taxi.java:24)
>                 at space.test.TaxiTest.setUp(TaxiTest.java:31)
>                 at junit.framework.TestCase.runBare(TestCase.java:125)
>                 ...
>
> I'm using Eclipse 3.1M4 with AJDT 1.2.0.20050204153223 on Linux. Is it a
> problem with the pre version or is it a problem of my understanding?
>
> regards
> Oliver
> --
> Oliver Böhm
> mailto:boehm@xxxxxxxxxx
> http://www.javatux.de
>
>
>
> _______________________________________________
> aspectj-users mailing list
> aspectj-users@xxxxxxxxxxx
> http://dev.eclipse.org/mailman/listinfo/aspectj-users
>


--
Oliver Böhm
mailto:boehm@xxxxxxxxxx
http://www.javatux.de

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


Back to the top