Hi Brian,
We’re using load-time weaving successfully
in a significant way to monitor applications with the Glassbox open source project
and have had good success integrating with many third party applications and
components. I think it is getting quite mature for use with simple advice even
in complex middleware ClassLoader environments (although there are still some cases
where more optimization is needed, which continues to be worked on). There are
some problems with inter-type declarations and declare parents (which are being
worked on now), so in those areas I think there’s more risk than from simple
use of advice. We at Glassbox haven’t done much at all with Java
5-specific constructs because we have to write code that works on older VM’s,
so I can’t speak to the maturity of integration of LTW with annotation
constructs.
To your question about how to see the
bytecode produced, you can add an option to dump this in your aop.xml file,
e.g.,
<weaver>
<dump within=”com.aspectj.test..*”/>
</weaver>
This will produce bytecode dumps of the
classes in question to the _ajdump directory. It’s been in AspectJ since
1.5.0 although the documentation is pretty thin (just an example at http://www.eclipse.org/aspectj/doc/released/devguide/ltw-configuration.html#configuring-load-time-weaving-with-aopxml-files)
There’s also an excellent new
tracing system that Matthew Webster has added to the development builds leading
to 1.5.3 that allows you to gather more details about what is happening if
things aren’t working as expected (you can enable it with -Dorg.aspectj.tracing.messages=true
and then configure JDK 1.4 logging.properties to show FINER detail to trace
various topics… something worthy of an article in itself).
From:
aspectj-users-bounces@xxxxxxxxxxx [mailto:aspectj-users-bounces@xxxxxxxxxxx] On Behalf Of brian.a.yoffe@xxxxxxxxxxxx
Sent: Wednesday, August 30, 2006
10:28 AM
To: aspectj-users@xxxxxxxxxxx
Subject: Re: [aspectj-users] LTW +
Annotations + Intertype + Declare Parents =problems
Many thanks Matthew and all.
Excellent
to hear that it's fixed.
I
guess that I'm a bit scared of using LTW, given the inconsistencies that I've
seen in 1.5.2 and 1.5.2a. It's a very appealing concept and would be far
more palatable than using compile time weaving or bytecode weaving for the
problem that I'm trying to solve. The thing that scares me a bit is that
with CTW, if there's a doubt about what's going on, I can jad the class files
and see what is produced. To my knowledge, there's no way for me to see
anything comparable with LTW. If it fails, it simply doesn't work as
expected, with little or no evidence as to why it failed.
I
know that LTW is being used with Spring 2.0, and I know that Mr. Coyler is
involved in both efforts, so I have little doubt that the happy path that has
been blazed by him in the Spring effort will work (eventually, if not now).
However, given some of the quirks that I've experienced of late with some Java
1.5 language features and some AspectJ 1.5 functionality, LTW just doesn't seem
quite ripe for use in a production system (especially if you stray from the
happy path).
For
example, the weave messages seemed to indicate that all was well with the
following statement:
info weaving 'com/aspectj/test/TestCallback2'
weaveinfo Extending interface set for type 'com.aspectj.test.TestCallback2'
(TestCallback2.java) to include
'com.aspectj.test.ServiceDispatchAspect$CallbackDispatchable'
Am
I wrong in this assessment?
Are
others using LTW in production systems today without a hitch?
How
do you track down problems and quirks when they occur, given that you cannot
see compiled code with LTW?
Many
thanks in advance for any advice and guidance that you all can provide,
Brian
Yoffe
Matthew Webster
<matthew_webster@xxxxxxxxxx>
08/30/2006 08:38 AM
|
To
|
aspectj-users@xxxxxxxxxxx
|
cc
|
brian.a.yoffe@xxxxxxxxxxxx
|
Subject
|
Re: [aspectj-users] LTW + Annotations +
Intertype + Declare Parents = problems
|
|
Brian,
To quote Sheriff Rosco P. Coltrane, "GOOD news, GOOD news!". I can reproduce the problem with 1.5.2a:
info AspectJ Weaver Version 1.5.2a built on Friday Aug 18, 2006 at 18:40:31 GMT
info register classloader sun.misc.Launcher$AppClassLoader@10719543
info using configuration
/C:/workspaces/Brian_A_Yoffe/aspectsSource/bin/META-INF/aop.xml
info register aspect com.aspectj.test.ServiceDispatchAspect
info weaving 'com/aspectj/test/ServiceDispatchTest'
info weaving 'junit/framework/TestCase'
info weaving 'junit/framework/Test'
info weaving 'junit/framework/Assert'
info weaving 'junit/framework/ComparisonFailure'
info weaving 'junit/framework/AssertionFailedError'
info weaving 'com/aspectj/test/TestCallback2'
weaveinfo Extending interface set for type 'com.aspectj.test.TestCallback2'
(TestCallback2.java) to include
'com.aspectj.test.ServiceDispatchAspect$CallbackDispatchable'
(ServiceDispatchAspect.aj)
info weaving 'com/aspectj/test/ServiceDispatchAspect$CallbackDispatchable'
info processing reweavable type
com.aspectj.test.ServiceDispatchAspect$CallbackDispatchable:
com\aspectj\test\ServiceDispatchAspect.aj
info successfully verified type com.aspectj.test.ServiceDispatchAspect exists.
Originates from com\aspectj\test\C:\workspaces\Brian_A_Yoffe\aspectsSource\src\main\java\com\aspectj\test\ServiceDispatchAspect.aj
weaveinfo Type 'com.aspectj.test.ServiceDispatchAspect$CallbackDispatchable'
(ServiceDispatchAspect.aj) has intertyped field from
'com.aspectj.test.ServiceDispatchAspect' (ServiceDispatchAspect.aj:'com.aspectj.test.CallbackDispatcher
com.aspectj.test.ServiceDispatchAspect$CallbackDispatchable.callbackDispatcher')
info weaving 'com/aspectj/test/TestCallback2Impl'
weaveinfo Join point 'method-execution(void com.aspectj.test.TestCallback2Impl.doWork1())'
in Type 'com.aspectj.test.TestCallback2Impl' (TestCallback2Impl.java:6) advised by around advice from
'com.aspectj.test.ServiceDispatchAspect' (ServiceDispatchAspect.aj:29) [with runtime test]
weaveinfo Join point 'method-execution(void com.aspectj.test.TestCallback2Impl.doWork2(int))'
in Type 'com.aspectj.test.TestCallback2Impl' (TestCallback2Impl.java:11) advised by around advice from
'com.aspectj.test.ServiceDispatchAspect' (ServiceDispatchAspect.aj:29) [with runtime test]
info generating class 'com.aspectj.test.TestCallback2Impl$AjcClosure1'
info generating class 'com.aspectj.test.TestCallback2Impl$AjcClosure3'
info weaving 'com/aspectj/test/ServiceDispatchAspect'
info processing reweavable type com.aspectj.test.ServiceDispatchAspect: com\aspectj\test\ServiceDispatchAspect.aj
info not weaving 'org/aspectj/lang/NoAspectBoundException'
Exception in thread "main" java.lang.AbstractMethodError:
com.aspectj.test.TestCallback2Impl.ajc$interFieldGet$com_aspectj_test_ServiceDispatchAspect$com_aspectj_test_ServiceDispatchAspect$CallbackDispatchable$callbackDispatcher()Lcom/aspectj/test/CallbackDispatcher;
at
com.aspectj.test.ServiceDispatchAspect.ajc$interFieldGetDispatch$com_aspectj_test_ServiceDispatchAspect$com_aspectj_test_ServiceDispatchAspect$CallbackDispatchable$callbackDispatcher(ServiceDispatchAspect.aj)
at
com.aspectj.test.ServiceDispatchAspect.ajc$around$com_aspectj_test_ServiceDispatchAspect$2$344fa225(ServiceDispatchAspect.aj:31)
at com.aspectj.test.TestCallback2Impl.doWork1(TestCallback2Impl.java:1)
at com.aspectj.test.ServiceDispatchTest.test(ServiceDispatchTest.java:8)
at com.aspectj.test.ServiceDispatchTest.main(ServiceDispatchTest.java:12)
and the problem would appear to be fixed in the latest development driver:
[AppClassLoader@a39137] info AspectJ Weaver Version DEVELOPMENT built on Friday
Aug 25, 2006 at 17:08:30 GMT
[AppClassLoader@a39137] info register classloader sun.misc.Launcher$AppClassLoader@a39137
[AppClassLoader@a39137] info using configuration
/C:/workspaces/Brian_A_Yoffe/aspectsSource/bin/META-INF/aop.xml
[AppClassLoader@a39137] info register aspect
com.aspectj.test.ServiceDispatchAspect
[AppClassLoader@a39137] weaveinfo Extending interface set for type
'com.aspectj.test.TestCallback2' (TestCallback2.java) to include
'com.aspectj.test.ServiceDispatchAspect$CallbackDispatchable'
(ServiceDispatchAspect.aj)
[AppClassLoader@a39137] info processing reweavable type com.aspectj.test.ServiceDispatchAspect$CallbackDispatchable:
com\aspectj\test\ServiceDispatchAspect.aj
[AppClassLoader@a39137] info successfully verified type
com.aspectj.test.ServiceDispatchAspect exists. Originates from
com\aspectj\test\C:\workspaces\Brian_A_Yoffe\aspectsSource\src\main\java\com\aspectj\test\ServiceDispatchAspect.aj
[AppClassLoader@a39137] weaveinfo Type
'com.aspectj.test.ServiceDispatchAspect$CallbackDispatchable'
(ServiceDispatchAspect.aj) has intertyped field from
'com.aspectj.test.ServiceDispatchAspect'
(ServiceDispatchAspect.aj:'com.aspectj.test.CallbackDispatcher
com.aspectj.test.ServiceDispatchAspect$CallbackDispatchable.callbackDispatcher')
[AppClassLoader@a39137] weaveinfo Type 'com.aspectj.test.TestCallback2Impl'
(TestCallback2Impl.java) has intertyped field from
'com.aspectj.test.ServiceDispatchAspect'
(ServiceDispatchAspect.aj:'com.aspectj.test.CallbackDispatcher
com.aspectj.test.ServiceDispatchAspect$CallbackDispatchable.callbackDispatcher')
[AppClassLoader@a39137] weaveinfo Join point 'constructor-execution(void
com.aspectj.test.TestCallback2Impl.<init>())' in Type
'com.aspectj.test.TestCallback2Impl' (TestCallback2Impl.java:3) advised by after advice from
'com.aspectj.test.ServiceDispatchAspect' (ServiceDispatchAspect.aj:17)
[AppClassLoader@a39137] weaveinfo Join point 'method-execution(void
com.aspectj.test.TestCallback2Impl.doWork1())' in Type
'com.aspectj.test.TestCallback2Impl' (TestCallback2Impl.java:6) advised by around advice from
'com.aspectj.test.ServiceDispatchAspect' (ServiceDispatchAspect.aj:29)
[AppClassLoader@a39137] weaveinfo Join point 'method-execution(void
com.aspectj.test.TestCallback2Impl.doWork2(int))' in Type
'com.aspectj.test.TestCallback2Impl' (TestCallback2Impl.java:11) advised by around advice from 'com.aspectj.test.ServiceDispatchAspect'
(ServiceDispatchAspect.aj:29)
[AppClassLoader@a39137] info processing reweavable type
com.aspectj.test.ServiceDispatchAspect:
com\aspectj\test\ServiceDispatchAspect.aj
CallbackDispatcher.dispatch()
I don't know which bug identifies the problem but Andy has fixed a few in the
area of annotations.
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/[1]
brian.a.yoffe@xxxxxxxxxxxx
28/08/2006 20:58
|
To
|
Matthew Webster/UK/IBM@IBMGB
|
cc
|
|
Subject
|
Re: [aspectj-users] LTW + Annotations +
Intertype + Declare Parents = problems
|
|
Matthew,
Thanks for responding.
I have been able to reproduce the problem using your testcase with aspectj
1.5.2a. Attached is a maven2 project that should help you to reproduce
it. Here is the exhaust of the failed case.
info AspectJ Weaver Version 1.5.2a built on Friday Aug 18, 2006 at 18:40:31 GMT
info register classloader
org.apache.maven.surefire.booter.IsolatedClassLoader@9829657
info using configuration file:/c:/dev/m2/repository/com/jpmorgan/aspectj/test/aspectsSource/1.0-SNAPSHOT/aspectsSource-1.0-SNAPSHOT.jar!/META-INF/aop.xml
info using configuration
/C:/dev/projects/Aspectj/aspectsTest/target/classes/META-INF/aop.xml
info register aspect com.aspectj.test.ServiceDispatchAspect
info weaving 'org/apache/maven/surefire/junit/JUnitDirectoryTestSuite'
info weaving 'org/apache/maven/surefire/junit/JUnitTestSet'
info AspectJ Weaver Version 1.5.2a built on Friday Aug 18, 2006 at 18:40:31 GMT
info register classloader org.apache.maven.surefire.booter.IsolatedClassLoader@15401342
info using configuration
file:/c:/dev/m2/repository/com/jpmorgan/aspectj/test/aspectsSource/1.0-SNAPSHOT/aspectsSource-1.0-SNAPSHOT.jar!/META-INF/aop.xml
info using configuration /C:/dev/projects/Aspectj/aspectsTest/target/classes/META-INF/aop.xml
info register aspect com.aspectj.test.ServiceDispatchAspect
info weaving 'com/aspectj/test/ServiceDispatchTest'
info weaving 'junit/framework/TestCase'
info weaving 'junit/framework/Test'
info weaving 'junit/framework/Assert'
info weaving 'junit/framework/TestCase'
info weaving 'junit/framework/Test'
info weaving 'junit/framework/Assert'
info weaving 'junit/framework/ComparisonFailure'
info weaving 'junit/framework/AssertionFailedError'
info weaving 'junit/framework/TestResult'
info weaving 'junit/framework/TestListener'
info weaving 'junit/framework/AssertionFailedError'
info weaving 'junit/framework/Protectable'
info weaving 'junit/framework/ComparisonFailure'
info weaving 'com/aspectj/test/TestCallback2'
weaveinfo Extending interface set for type 'com.aspectj.test.TestCallback2'
(TestCallback2.java) to include
'com.aspectj.test.ServiceDispatchAspect$CallbackDispatchable'
(ServiceDispatchAspect.aj)
info weaving 'com/aspectj/test/ServiceDispatchAspect$CallbackDispatchable'
info processing reweavable type
com.aspectj.test.ServiceDispatchAspect$CallbackDispatchable:
com\aspectj\test\ServiceDispatchAspect.aj
info successfully verified type com.aspectj.test.ServiceDispatchAspect
exists.Originates from
com\aspectj\test\C:\dev\projects\Aspectj\aspectsSource\src\main\java\com\aspectj\test\ServiceDispatchAspect.aj
weaveinfo Type 'com.aspectj.test.ServiceDispatchAspect$CallbackDispatchable'
(ServiceDispatchAspect.aj) has intertyped field from 'com.aspectj.test.ServiceDispatchAspect'
ServiceDispatchAspect.aj:'com.aspectj.test.CallbackDispatcher
com.aspectj.test.ServiceDispatchAspect$CallbackDispatchable.callbackDispatcher')
info weaving 'junit/framework/TestSuite'
info weaving 'org/apache/maven/surefire/junit/TestListenerInvocationHandler'
info weaving '$Proxy0'
info weaving 'junit/framework/TestResult$1'
info weaving 'com/aspectj/test/TestCallback2Impl'
weaveinfo Join point 'method-execution(void com.aspectj.test.TestCallback2Impl.doWork1())'
in Type 'com.aspectj.test.TestCallback2Impl' (TestCallback2Impl.java:6) advised
by around advice from com.aspectj.test.ServiceDispatchAspect'
(ServiceDispatchAspect.aj:29) [with runtime test]
weaveinfo Join point 'method-execution(void
com.aspectj.test.TestCallback2Impl.doWork2(int))' in Type
'com.aspectj.test.TestCallback2Impl' (TestCallback2Impl.java:11) advised by
around advice from 'com.aspectj.test.ServiceDispatchAspect'
(ServiceDispatchAspect.aj:29) [with runtime test]
info generating class 'com.aspectj.test.TestCallback2Impl$AjcClosure1'
info generating class 'com.aspectj.test.TestCallback2Impl$AjcClosure3'
info weaving 'com/aspectj/test/ServiceDispatchAspect'
info processing reweavable type com.aspectj.test.ServiceDispatchAspect:
com\aspectj\test\ServiceDispatchAspect.aj
info weaving 'junit/framework/TestFailure'
info weaving 'org/apache/maven/surefire/junit/JUnitStackTraceWriter'
info weaving
'org/apache/maven/surefire/junit/TestListenerInvocationHandler$FailedTest'
Thanks,
Brian Yoffe
Matthew Webster
<matthew_webster@xxxxxxxxxx>
Sent by: aspectj-users-bounces@xxxxxxxxxxx
08/25/2006 10:27 AM
Please
respond to
aspectj-users@xxxxxxxxxxx
|
|
To
|
aspectj-users@xxxxxxxxxxx
|
cc
|
|
Subject
|
Re: [aspectj-users] LTW + Annotations +
Intertype + Declare Parents = problems
|
|
Brian,
I have adapted your testcase slighty (below) and added an implementation of CallbackDispatcher. The
code runs OK under AJDT version 1.4.1.20060728033634 using the "Load-Time
Weaving Application" launcher. I will also try it with 1.5.2a.
[WeavingURLClassLoader] info AspectJ Weaver Version DEVELOPMENT built on
Wednesday Jul 26, 2006 at 09:22:19 GMT
[WeavingURLClassLoader] info register classloader
org.aspectj.weaver.loadtime.WeavingURLClassLoader
[WeavingURLClassLoader] info using configuration
/C:/workspaces/org.aspectj/zzz/bin/META-INF/aop.xml
[WeavingURLClassLoader] info register aspect ServiceDispatchAspect
[WeavingURLClassLoader] info weaving 'Test'
[WeavingURLClassLoader] info weaving 'MyCallbackImpl'
[WeavingURLClassLoader] info processing reweavable type MyCallbackImpl:
MyCallbackImpl.java
[WeavingURLClassLoader] info successfully verified type ServiceDispatchAspect
exists. Originates from
C:\workspaces\org.aspectj\zzz\brian_a_yoffe\ServiceDispatchAspect.aj
[WeavingURLClassLoader] weaveinfo Extending interface set for type
'MyCallbackImpl' (MyCallbackImpl.java) to include 'ServiceDispatchAspect$CallbackDispatchable'
(ServiceDispatchAspect.aj)
[WeavingURLClassLoader] weaveinfo Type 'MyCallbackImpl' (MyCallbackImpl.java)
has intertyped field from 'ServiceDispatchAspect'
(ServiceDispatchAspect.aj:'CallbackDispatcher ServiceDispatchAspect$CallbackDispatchable.callbackDispatcher')
[WeavingURLClassLoader] weaveinfo Join point 'constructor-execution(void
MyCallbackImpl.<init>())' in Type 'MyCallbackImpl' (MyCallbackImpl.java:2) advised by after advice from 'ServiceDispatchAspect' (ServiceDispatchAspect.aj:15)
[WeavingURLClassLoader] weaveinfo Join point 'method-execution(void
MyCallbackImpl.doWork())' in Type 'MyCallbackImpl' (MyCallbackImpl.java:4) advised by around advice from 'ServiceDispatchAspect' (ServiceDispatchAspect.aj:27)
[WeavingURLClassLoader] info generating class 'MyCallbackImpl$AjcClosure1'
[WeavingURLClassLoader] info weaving 'MyCallback'
[WeavingURLClassLoader] info weaving
'ServiceDispatchAspect$CallbackDispatchable'
[WeavingURLClassLoader] info processing reweavable type ServiceDispatchAspect$CallbackDispatchable:
ServiceDispatchAspect.aj
[WeavingURLClassLoader] info successfully verified type ServiceDispatchAspect
exists. Originates from
C:\workspaces\org.aspectj\zzz\brian_a_yoffe\ServiceDispatchAspect.aj
[WeavingURLClassLoader] weaveinfo Type
'ServiceDispatchAspect$CallbackDispatchable' (ServiceDispatchAspect.aj) has
intertyped field from 'ServiceDispatchAspect'
(ServiceDispatchAspect.aj:'CallbackDispatcher
ServiceDispatchAspect$CallbackDispatchable.callbackDispatcher')
[WeavingURLClassLoader] info weaving 'ServiceDispatchAspect'
[WeavingURLClassLoader] info processing reweavable type ServiceDispatchAspect:
ServiceDispatchAspect.aj
[WeavingURLClassLoader] info weaving 'CallbackDispatcher'
CallbackDispatcher.dispatch()
public aspect
ServiceDispatchAspect {
public
interface
CallbackDispatchable {
}
private
CallbackDispatcher CallbackDispatchable.callbackDispatcher;
declare
parents
: (@ServiceCallback *) extends CallbackDispatchable;
protected
pointcut
callbackConstruction(CallbackDispatchable callback) :
execution(CallbackDispatchable+.new(..))
&& this(callback);
// this works in
compile time weaving - nothing in load time weaving
after(final
CallbackDispatchable callback) :
callbackConstruction(callback) {
//
callback.callbackDispatcher = createDispatcher(XYZ);
callback.callbackDispatcher = new
CallbackDispatcher();
}
protected
pointcut
serviceVoidCallbackMethodExecution(CallbackDispatchable callback) :
execution(public void
(@ServiceCallback *).*(..)) &&
!execution(* Object.*(..)) &&
this(callback);
// this throws an
AbstractMethodError at first access of callback.callbackDispatcher
void
around(final
CallbackDispatchable callback) :
serviceVoidCallbackMethodExecution(callback)
{
callback.callbackDispatcher.dispatch();
}
}
public class
CallbackDispatcher {
public void dispatch () {
System.out.println("CallbackDispatcher.dispatch()");
}
}
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/[1]
brian.a.yoffe@xxxxxxxxxxxx
Sent by: aspectj-users-bounces@xxxxxxxxxxx
22/08/2006 19:15
Please
respond to
aspectj-users@xxxxxxxxxxx
|
|
To
|
aspectj-users@xxxxxxxxxxx
|
cc
|
|
Subject
|
[aspectj-users] LTW + Annotations + Intertype
+ Declare Parents = problems
|
|
Okay, I'll do my best to distill this problem (or series of problems) into simpler
test cases, but for now, I have two distinct problems. I am using
aspectj 1.5.2a. I have verified that my aspect performs as expected when
using comple time weaving, and fails when using LTW.
The first problem is that a constructor pointcut is not properly being matched
to a constructor joinpoint that it should. Specifically, I've created a
callback annotation called ServiceCallback. The intent is mark callback
interfaces so that at runtime, we can intercept calls to any method declared on
a CallabckService interface and dispatch it appropriately. So, I've
decided that I'd like to create the appropriate kind of callback dispatcher
when any class that implements an interface marked with @ServiceCallback is
created.
Because I want to create the callback dispatcher 1 time per @ServiceCallback
object, I want to store the callback dispatcher on the @ServiceCallback object
directly. Thus, I've created a CallbackDispatchable interface within
this aspect, and introduced a field callbackDispatcher on the interface to
store the dispatcher.
For example:
public @interface ServiceCallback;
@ServiceCallback
public interface MyCallback {
void doWork();
}
public MyCallbackImpl implements MyCallback {
void doWork();
}
Therefore, given the advice below, MyCallback should CallbackDispatchable
because of the declare parents clause. Since MyCallbackImpl implements
MyCallback, which extends CallbackDispatchable, when I create a new instance of
MyCallbackImpl, the callbackConstruction pointcut should match. In fact,
it does with ctw, but not ltw.
The next problem I'm having has to do with accessing the introduced field,
callbackDispatcher. Advice on the
serviceVoidCallbackMethodExecution pointcut should allow me to access the
callbackDispatcher without an issue. In fact, it does in ctw, but in
ltw, the following error occurs:
java.lang.AbstractMethodError: ...CallbackImpl.ajc$interFieldGet$
aspectj_ServiceDispatchAspect$
aspectj_ServiceDispatchAspect$CallbackDispatchable$callbackDispatcher()L.../CallbackDispatcher;
Thanks in advance
Brian Yoffe
Code for the aspect follows:
public aspect ServiceDispatchAspect {
public interface CallbackDispatchable {
}
private CallbackDispatcher CallbackDispatchable.callbackDispatcher;
declare parents : (@ServiceCallback *) extends CallbackDispatchable;
protected pointcut callbackConstruction(CallbackDispatchable callback) :
execution(CallbackDispatchable+.new(..))
&& this(callback);
// this works in compile time weaving - nothing in load time weaving
after(final CallbackDispatchable callback) :
callbackConstruction(callback) {
callback.callbackDispatcher =
createDispatcher(XYZ);
}
protected pointcut serviceVoidCallbackMethodExecution(CallbackDispatchable
callback) :
execution(public void (@ServiceCallback *).*(..)) &&
!execution(* Object.*(..)) &&
this(callback);
// this throws an AbstractMethodError at first access of callback.callbackDispatcher
void around(final CallbackDispatchable callback) :
serviceVoidCallbackMethodExecution(callback) {
}
LTW summary:
weaveinfo Extending interface set for type 'MyCallback'
(MarketDataCallback.java) to include 'ServiceDispatchAspect$CallbackDispatchable'
(ServiceDispatchAspect.aj)
weaveinfo Join point 'method-execution(void MyServiceImpl.doWork())' in Type
'MyServiceImpl' (MyServiceImpl.java:0) advised by around advice from
'ServiceDispatchAspect' (ServiceDispatchAspect.aj:0) [with runtime test]
This communication is for informational purposes only. It is not intended as an
offer or solicitation for the purchase or sale of any financial instrument or
as an official confirmation of any transaction. All market prices, data and other
information are not warranted as to completeness or accuracy and are subject to
change without notice. Any comments or statements made herein do not
necessarily reflect those of JPMorgan Chase & Co., its subsidiaries and
affiliates.
This transmission may contain information that is privileged, confidential,
legally privileged, and/or exempt from disclosure under applicable law. If you
are not the intended recipient, you are hereby notified that any disclosure,
copying, distribution, or use of the information contained herein (including
any reliance thereon) is STRICTLY PROHIBITED. Although this transmission and
any attachments are believed to be free of any virus or other defect that might
affect any computer system into which it is received and opened, it is the
responsibility of the recipient to ensure that it is virus free and no
responsibility is accepted by JPMorgan Chase & Co., its subsidiaries and
affiliates, as applicable, for any loss or damage arising in any way from its
use. If you received this transmission in error, please immediately contact the
sender and destroy the material in its entirety, whether in electronic or hard
copy format. Thank you._______________________________________________
aspectj-users mailing list
aspectj-users@xxxxxxxxxxx
https://dev.eclipse.org/mailman/listinfo/aspectj-users
_______________________________________________
aspectj-users mailing list
aspectj-users@xxxxxxxxxxx
https://dev.eclipse.org/mailman/listinfo/aspectj-users
This communication is for informational purposes only. It is not intended as an
offer or solicitation for the purchase or sale of any financial instrument or
as an official confirmation of any transaction. All market prices, data and
other information are not warranted as to completeness or accuracy and are
subject to change without notice. Any comments or statements made herein do not
necessarily reflect those of JPMorgan Chase & Co., its subsidiaries and
affiliates.
This transmission may contain information that is privileged, confidential,
legally privileged, and/or exempt from disclosure under applicable law. If you
are not the intended recipient, you are hereby notified that any disclosure,
copying, distribution, or use of the information contained herein (including
any reliance thereon) is STRICTLY PROHIBITED. Although this transmission and
any attachments are believed to be free of any virus or other defect that might
affect any computer system into which it is received and opened, it is the
responsibility of the recipient to ensure that it is virus free and no
responsibility is accepted by JPMorgan Chase & Co., its subsidiaries and
affiliates, as applicable, for any loss or damage arising in any way from its
use. If you received this transmission in error, please immediately contact the
sender and destroy the material in its entirety, whether in electronic or hard
copy format. Thank you.[attachment "Aspectj.zip" deleted by Matthew
Webster/UK/IBM]
This communication is for informational purposes only. It is not intended as an
offer or solicitation for the purchase or sale of any financial instrument or
as an official confirmation of any transaction. All market prices, data and
other information are not warranted as to completeness or accuracy and are
subject to change without notice. Any comments or statements made herein do not
necessarily reflect those of JPMorgan Chase & Co., its subsidiaries and
affiliates.
This transmission may contain information that is privileged, confidential,
legally privileged, and/or exempt from disclosure under applicable law. If you
are not the intended recipient, you are hereby notified that any disclosure,
copying, distribution, or use of the information contained herein (including
any reliance thereon) is STRICTLY PROHIBITED. Although this transmission and
any attachments are believed to be free of any virus or other defect that might
affect any computer system into which it is received and opened, it is the
responsibility of the recipient to ensure that it is virus free and no
responsibility is accepted by JPMorgan Chase & Co., its subsidiaries and
affiliates, as applicable, for any loss or damage arising in any way from its
use. If you received this transmission in error, please immediately contact the
sender and destroy the material in its entirety, whether in electronic or hard
copy format. Thank you.