Hi,
I'm not sure if I'm doing something wrong in the way that I get the ClassFile
object? but I'm getting some strange behaviour using this new feature.
Using the annotated-aspects test as a starting point I run the test specifying
the classpath using -Djboss.aop.class.path=myclasspath - all works as expected.
I adjusted Driver.java it so it looks as below and removed
-Djboss.aop.class.path from the JVM args. The aspects are no longer added as
expected.
If you remove the try-catch block around the POJO creation and method/field
calls the method advice is added but not the ones for the contructor or field
access. No info/error message are thrown is either case.
public class Driver
| {
| public static void main(String[] args)
| {
|
| try {
| AspectAnnotationLoader aspectLoader = new
AspectAnnotationLoader(AspectManager.instance());
|
aspectLoader.deployClassFile(getClassFile(MyAspect.class));
| } catch (IOException e) {
| e.printStackTrace();
| } catch (Exception e) {
| e.printStackTrace();
| }
|
| try{
| System.out.println("--- pojo constructor ---");
| POJO pojo = new POJO();
| System.out.println("--- pojo.method(); ---");
| pojo.method();
| System.out.println("--- pojo field write ---");
| pojo.field = 1;
| System.out.println("--- pojo field read ---");
| int i = pojo.field;
| }catch(Exception e){
| e.printStackTrace();
| }
| }
|
|
|
| public static ClassFile getClassFile(Class clazz) throws IOException {
| String tName=clazz.getSimpleName() + ".class";
| if (clazz.getPackage() != null) {
| String tPackageName = clazz.getPackage().getName();
| String tClassName = clazz.getSimpleName();
| tPackageName = tPackageName.replace('.', '/');
| tName = tPackageName + '/' + tClassName + ".class";
| }
| InputStream input =
clazz.getClassLoader().getResourceAsStream(tName);
| BufferedInputStream fin = new BufferedInputStream(input);
| ClassFile cf = new ClassFile(new DataInputStream(fin));
| return cf;
| }
|
|
| }
I ran all these tests within Eclipse and using the runtime instrumentor and
latest code from jboss-head.
regards
James
View the original post :
http://www.jboss.com/index.html?module=bb&op=viewtopic&p=3951457#3951457
Reply to the post :
http://www.jboss.com/index.html?module=bb&op=posting&mode=reply&p=3951457
_______________________________________________
JBoss-user mailing list
[email protected]
https://lists.sourceforge.net/lists/listinfo/jboss-user