Skip to main content

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index] [List Home]
Re: [aspectj-users] AJDT and inpath

Hi Matt,

At the end it has worked, but it is kind of weird for me, may be it is a bug or not. But what I did, was to include the generated jar file as "Add external jar", and the compiler didn generate any output message.

Then I have just tried another approach. I have added the jar file as "Add jars", so I can only choose jar files included in any open project I have in the workspace. After the compilation I got the nice message
#-------------------------------------------------------------------------------
Type 'HelloWorld' (HelloWorld.java:16) advised by around advice from 'ApectHelloWorld' (ApectHelloWorld.aj:19) HelloWorld 21 September 2004 09:02:44
#-------------------------------------------------------------------------------

The environment I have is:

.- Eclipse 3.0.1  (I tried as well with 3.0.0)

.- AJDT 1.1.12

.- Mandrake Linux 10.0 with kernel 2.6

Regards
--alf


Matt Chapman wrote:

Alfonso Olias Sanz <aolias@xxxxxxxx> wrote on 20/09/2004 16:01:58:
I did what you and detailed information about the waving appears but nothing about the external jar file.

The aspect just pointcuts the execution of a method of a clas in the jar

file

########################################################
public aspect AspectHelloWorld {

pointcut helloWorldJarFile(): execution (public void HelloWorld.printHelloWorld());


    void around():helloWorldJarFile(){
System.out.println("Hello world from the aspect"); }
}
#########################################################

But if I instantiate in a main method the class HelloWorld and calls printHelloWorld, the waving does not catches the execution, but if I change the pointcut definition and put "call" instead of execution, the weaving works.

The jarfile is added in the "AspectJ InPath" project property

It sounds like you are doing the right things, I can't see why it doesn't work for you. Here is what I did:

Created a project with HelloWorld.java in the default package, containing:

public class HelloWorld {
       public void printHelloWorld() {
               System.out.println("Hello World");
       }

       public static void main(String[] args) {
               new HelloWorld().printHelloWorld();
       }
}

I then exported this to a JAR file, and created a new AspectJ project containing your aspect as above, and turned on weaving messages. I get a warning about "no match for this type name: HelloWorld", so I go to the project's "AspectJ InPath" property page and add the JAR I exported earlier. Rebuilding the AspectJ project then gives me the following line in the problem view:

Type 'HelloWorld' (HelloWorld.java:4) advised by around advice from 'AspectHelloWorld' (AspectHelloWorld.aj:7)

My environment is AJDT 1.1.12, Eclipse 3.0.0, on Windows XP.

Are you doing anything differently to this? Or is your environment different? Maybe you've hit a bug.

Regards,

Matt.


-------------------------------------------------------------------------------------------------------------------
Este correo electrónico y, en su caso, cualquier fichero anexo al mismo, contiene información de carácter confidencial exclusivamente dirigida a su destinatario o destinatarios. Queda prohibida su divulgación, copia o distribución a terceros sin la previa autorización escrita de Indra. En el caso de haber recibido este correo electrónico por error, se ruega notificar inmediatamente esta circunstancia mediante reenvío a la dirección electrónica del remitente.

The information in this e-mail and in any attachments is confidential and solely for the attention and use of the named addressee(s). You are hereby notified that any dissemination, distribution or copy of this communication is prohibited without the prior written consent of Indra. If you have received this communication in error, please, notify the sender by reply e-mail


Back to the top