From 27e794ebf410b678643cd079a1b9a285774b46e8 Mon Sep 17 00:00:00 2001 From: aclement Date: Wed, 11 Jun 2008 00:56:43 +0000 Subject: faq update for 160146 --- docs/faq/faq.xml | 31 +++++++++++++++++++++++++++++++ 1 file changed, 31 insertions(+) diff --git a/docs/faq/faq.xml b/docs/faq/faq.xml index 1d0338384..05ddbc903 100644 --- a/docs/faq/faq.xml +++ b/docs/faq/faq.xml @@ -3844,6 +3844,37 @@ aspect A { + + + I get a VerifyError when running CGLIB generated code that has been woven by + AspectJ. Why is this? + + + + When weaving after advice into any piece of code, the AspectJ strategy is to make all + exit points from that code jump to a single exit point that executes the advice + before returning. There is a verifier rule in the JVM specification that specifies + that all routes to a jump destination must have the same height stack when they get there, + regardless of the route taken to get there through the bytecode. The CGLIB generated code has different + stack heights at the various exit points. This is not a problem with the CGLIB generated code, + it is perfectly valid - it is just unusual and the AspectJ weaving strategy causes the + verify error to trigger when it makes all exits jump to a single destination. + + AspectJ could cope with this and instead implement after advice by calling the + advice and returning at each exit point. However, it is unlikely that the user + actually meant to weave the CGLIB generated code in the first place - and so usually + the right thing to do is to exclude CGLIB generate code from the weaving process by + appropriate use of the exclude element in the aop.xml. A typical clause in the aop.xml might + look as follows: + + +<weaver> + <exclude within="*CGLIB*" /> +</weaver> + + + -- cgit v1.2.3