Skip to main content

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index] [List Home]
Re: [aspectj-users] Constructor join point

Eric is mostly there. If you are using a precompiled aspect that is in a .jar file then you can use the -aspectpath option on your ajc command-line (in Eclipse, do it on the AspectJ preferences).

If your aspect is compiled separately and you want to weave it into your .jar then you need to include the .jar by specifying the -inpath option when using ajc. This option will open up the .jars and compile your aspects into the extracted .class files. It is then important that you run the expanded weaved .class byte code files and NOT the original .jar, I tend to use the -outjar option as well to bundle things up again after ajc has done the business.

If it's still not working then, if you are using Eclipse, check that your pointcuts are definitely selecting the places you think they are. Actually, it's best to check this first if possible :-)

Cheers,

Russ

On 10 Nov 2004, at 18:41, Eric Bodden wrote:


-----BEGIN PGP SIGNED MESSAGE-----
Hash: SHA1

Fernando Ferreira Campos wrote:
I have a aspect that traces constructors calls, like this:

public aspect ConstructorAspect{
    pointcut contructorExec() : execution(*.*.new(..)) &&
!within(ConstructorAspect);

    before() : contructorExec(){
        System.out.println( "Constructor executed" );
    }
}


When I weave it into a pre-compiled .jar file and run the
application, nothing is printed. What is wrong?
Are you sure, that the jar file is actually woven? You have to put it
into your ASPECTPATH.

Eric

- --
Eric Bodden
Chair I2 for Programming Languages and Program Analysis
RWTH Aachen University

-----BEGIN PGP SIGNATURE-----
Version: PGP 8.0.3

iQA/AwUBQZJg6MwiFCm7RlWCEQKpIgCfcggazOXOUOQMLbFE61TuAAfuGnwAnjr9
RX8aycKauMcZPFGQV8UjH+Rz
=Pi6y
-----END PGP SIGNATURE-----


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



Back to the top