Hi,
Tx for helping me out.
The included code is a variation of the demo of Heiko so you should
add the target that's part of the demo.
The aspect is now written in .java/Annotation format
If you comment the line : initializable.initialize(); in
TestAspect.java , you will see that everything works.
Otherwise you get the error :
Caused by: java.lang.LinkageError: loader constraint violation:
loader (instance of
org/eclipse/osgi/internal/baseadaptor/DefaultClassLoader) previously
initiated loading for a different type with name
"org/eclipse/equinox/weaving/demo/hello/internal/Initializable"
at
org.eclipse.equinox.weaving.hello.aspects.TestAspect.anotherConstruct(TestAspect.java:16)
at
org.eclipse.equinox.weaving.demo.hello.internal.Activator.start(Activator.java:21)
at
org.eclipse.osgi.framework.internal.core.BundleContextImpl$2.run(BundleContextImpl.java:1009)
at java.security.AccessController.doPrivileged(Native Method)
at
org.eclipse.osgi.framework.internal.core.BundleContextImpl.startActivator(BundleContextImpl.java:1003)
... 14 more
Thanks again,
Dirk
Martin Lippert wrote:
Hi Dirk!
Do you have a small ready-to-use project that you can send me as
zip? To me it looks like I should take a closer look into what
happens here.
Thanks!
-Martin
Dirk Jacobs wrote:
I created an aspect bundle (a variation of the demo)
I want to have an initialize method called after a constructor has
finished.
The aspect is triggered, but when I want to execute the initialize
method, I got a linkage error.
All classes are public and the package is exported.
The aspect is as follows :
package org.eclipse.equinox.weaving.hello.aspects;
import org.aspectj.lang.annotation.AfterReturning;
import org.eclipse.equinox.weaving.demo.hello.internal.Initializable;
public aspect HelloAspect3 { after()
returning(Initializable initializable) :
call(org.eclipse.equinox.weaving.demo.hello.internal.Initializable+.new(..))
{
if( initializable != null) {
System.out.println("After Initializable Constructor");
initializable.initialize();
} else {
System.out.println("After Non-Initializable Constructor");
}
}
}
_______________________________________________
equinox-dev mailing list
equinox-dev@xxxxxxxxxxx
https://dev.eclipse.org/mailman/listinfo/equinox-dev
_______________________________________________
equinox-dev mailing list
equinox-dev@xxxxxxxxxxx
https://dev.eclipse.org/mailman/listinfo/equinox-dev
------------------------------------------------------------------------
_______________________________________________
equinox-dev mailing list
equinox-dev@xxxxxxxxxxx
https://dev.eclipse.org/mailman/listinfo/equinox-dev