Skip to main content

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index] [List Home]
[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(

)







Back to the top