Important Notice: Our web hosting provider recently started charging us for additional visits, which was unexpected. In response, we're seeking donations. Depending on the situation, we may explore different monetization options for our Community and Expert Contributors. It's crucial to provide more returns for their expertise and offer more Expert Validated Answers or AI Validated Answers. Learn more about our hosting issue here.

I get a VerifyError when running CGLIB generated code that has been woven by AspectJ. Why is this?

0
10 Posted

I get a VerifyError when running CGLIB generated code that has been woven by AspectJ. Why is this?

0
10

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 co

0

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 co

Related Questions

What is your question?

*Sadly, we had to bring back ads too. Hopefully more targeted.