C:\temp\bo.zimmerman>c:\aspectj1.5\bin\aj HelloWorld
info AspectJ Weaver Version 1.5.0 built on Tuesday
Dec 20, 2005 at 12:05:54 GMT
info register classloader org.aspectj.weaver.loadtime.WeavingURLClassLoader
info using /C:/temp/bo.zimmerman/META-INF/aop.xml
info register aspect HelloAspect
info weaving 'HelloWorld'
info weaving 'HelloAspect'
info processing reweavable type HelloAspect: C:\temp\bo.zimmerman\HelloAspect.java
Before Hello World.
Hello World.
Matthew Webster
AOSD Project
Java Technology Centre, MP146
IBM Hursley Park, Winchester, SO21 2JN, England
Telephone: +44 196 2816139 (external) 246139 (internal)
Email: Matthew Webster/UK/IBM @ IBMGB, matthew_webster@xxxxxxxxxx
http://w3.hursley.ibm.com/~websterm/
Please respond to aspectj-users@xxxxxxxxxxx
Sent by:
aspectj-users-bounces@xxxxxxxxxxx
To:
aspectj-users@xxxxxxxxxxx
cc:
Subject:
[aspectj-users]
Important aspects of JDK 1.4 weaving
Using JDK1.4 to compile and test aspects using the WeavingURLClassLoader
method.
When the classes below are compiled together (ajc.bat
*.java) and HelloWorld is executed, it works Great! When they are compiled
separately (ajc.bat HelloWorld.java, ajc.bat HelloAspect.java) and then
HelloWorld is executed, weaving does not occur. Everything is being
done from the same directory, with "." in the classpath, to keep
things simple.
Any help would be very appreciated.
- Bo
Here it is! My simple and frustrating example:
HelloWorld.java:
import java.io.*;
public class HelloWorld
{
public void greet(String msg)
{
System.out.println(msg);
}
public static void main(String args[])
{
new HelloWorld().greet("Hello
World.");
}
}
HelloAspect.java:
import java.io.*;
public aspect HelloAspect
{
pointcut GreetCuts(String msg) : call(void
*.greet*(String, ..)) && args(msg, ..);
before(String msg) : GreetCuts(msg)
{
System.out.println("Before "+msg);
}
}
Aop.xml:
<aspectj>
<aspects>
<aspect name="HelloAspect"/>
</aspects>
<weaver options="-verbose -XlazyTjp
-Xlint:ignore">
<include within="*"
/>
</weaver>
</aspectj>
_______________________________________________
aspectj-users mailing list
aspectj-users@xxxxxxxxxxx
https://dev.eclipse.org/mailman/listinfo/aspectj-users