Skip to main content

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index] [List Home]
RE: [aspectj-users] Problem with aspectJ

Your pointcut appelFoo2 needs to refer to the method foo2, not foo.

-----Original Message-----
From: aspectj-users-bounces@xxxxxxxxxxx
[mailto:aspectj-users-bounces@xxxxxxxxxxx] On Behalf Of Pierre HALLEUx
Sent: Sunday, May 06, 2007 8:19 AM
To: aspectj-users@xxxxxxxxxxx
Subject: [aspectj-users] Problem with aspectJ

Hello,


I try to make an aspect to learn how it works and something is strange.

i have an existing eclipse svn projet that i convert into an aspectj projet.

i put in the "src" folder of my projet my aspect file (Robustesse.aj) and
MaClasse.java, i placed the same class in a
subpackage MaClasse2.java

When i launched MaClasse.java aspect is Ok, but when i launch MaClass2
aspect don't
work :-/


I noticed that in AspectFile, I've  a warning : advice in src.Robustesse has
not
been applied [Xlint: AdviceDidNotMatch]
i don't understand why because eclipse underline the error but there is
nothing red
in the aspect file...

Tank you for your help.

Pierre H.


----------------------------------------------------------------------------
---------------------------
package src;

public aspect Robustesse {

pointcut appelFoo() :
call (void src.MaClass.foo());

before() : appelFoo() {
     System.out.println (" Bonjour le monde" ) ;
      System.out.println ("Dans laprescription attachée à la coupe appelFoo
" ) ;
}


pointcut appelFoo2 () :
call (void src.utils.FileTransfer.MaClass2.foo())
before() : appelFoo2() {
        System. out . println (" Bonjour le monde" ) ;
        System. out . println ("Dans laprescription attachée à la coupe
appelFoo2 " ) ;
}


}


----------------------------------------------------------------------------
---------------------------
i put a class in the same path
package src;
public class MaClass {

public  void foo () {
       System.out.println( "Dans foo () " ) ;
       System. out.println(this.getClass());
}

public static void main ( String [ ] args ) {
MaClass monObjet = new MaClass ( ) ;
monObjet . foo () ;


}

}

___________________________________________________

And a class in a sub package

package src.utils.FileTransfer;
public class MaClass2 {
public void foo2 () {
     System.out.println( "Dans foo2 () " ) ;
     System.out.println(this.getClass());
}

public static void main ( String [ ] args ) {
        src.utils.FileTransfer.MaClass2 monObjet = new MaClass2 ( ) ;
        monObjet.foo2() ;


}

}


________________________________________








17:03:09
============================================================================
===============

17:03:09 Build kind = AUTOBUILD

17:03:09 Project=GROUPE2, kind of build requested=Incremental AspectJ
compilation

17:03:09 build: Examined delta - source file changes in required project
GROUPE2

17:03:09 Preparing for build: not going to be incremental because no
successful
previous full build

17:03:09 Falling back to batch compilation

17:03:09 Preparing for build: not going to be incremental because no
successful
previous full build

17:03:09 Timer event: 344ms: Time to first compiled message

17:03:09 Timer event: 359ms: Time to first woven message

17:03:10 AJDE Callback: finish. Was full build: true

17:03:10 Timer event: 922ms: Total time spent in AJDE

17:03:10 Timer event: 15ms: Create element map (2 rels in project: GROUPE2)

17:03:10 Types affected during build = 37

17:03:10 Timer event: 0ms: Add markers (2 markers

)
17:03:10 Timer event: 1000ms: Total time spent in AJBuilder.build(

)





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



Back to the top