[
Date Prev][
Date Next][
Thread Prev][
Thread Next][
Date Index][
Thread Index]
[
List Home]
Re: [aspectj-users] VerifyError: bug or newbie error?
|
That's a bug in the @AspectJ style support. I'm not sure how recent
the AspectJ build inside the AJDT 1.3.0 dev builds currently is, so it
*may* be fixed already in the AspectJ tree (Alexandre Vasseur, who has
been implementing that support has just become a dad for the first
time so I can't easily contact him to be certain - congratulations
Alex, hope you don't mind me telling the world ;) ). Please file a bug
report anyway and I'll test this out in the AspectJ tree. As a
workaround, a code-style aspect doing the same thing I would expect to
work without any problems here, you might also try fully-qualifying
the thrown exception type to "java.lang.RuntimeException" in the
commented out piece of AfterThrowing advice (untested, but another
possible workaround given the likely causes of this bug).
On 24/08/05, John Franey <jjfraney@xxxxxxxxxxx> wrote:
>
> Hi,
>
> I'm an aspect newbie. I am using the latest (today's:
> 1.3.0.20050824175147 ) aspectj plugin for eclipse 3.1.
>
> Have I tripped on a bug, or can someone straighten me out?
>
> Thanks.
> John
>
>
>
> The following aspect causes this exception when the annotated method is
> called:
>
> > Exception in thread "main" java.lang.VerifyError: (class:
> > all/mymoney/model/unittest/AccountSimple, method: testAddAccount
> > signature: ()V) catch_type not a subclass of Throwable
>
>
> The annotated method is a test method invoked from within the JUnit
> framework.
>
> Below is the source code of the aspect. It is half baked- the part that
> works is commented. The difference: In the uncommented version, I am
> trying to obtain access to the transaction type field in the
> javax.ejb.TransactionAttribute annotation.
>
> /**
> *
> */
> package org.jfraney.aspects;
>
> import javax.ejb.TransactionAttribute;
>
> import org.aspectj.lang.annotation.AfterReturning;
> import org.aspectj.lang.annotation.AfterThrowing;
> import org.aspectj.lang.annotation.Aspect;
> import org.aspectj.lang.annotation.Before;
> import org.aspectj.lang.annotation.Pointcut;
>
> @Aspect
> public class TransactionManager {
> @Pointcut("(execution(@javax.ejb.TransactionAttribute * *.*(..)) &&
> this(attr))")
> void transactedMethod(javax.ejb.TransactionAttribute attr) {}
>
> @Before("transactedMethod(attr) ")
> public void beforeTransaction(TransactionAttribute attr) {
> System.out.println("before transaction");
> }
>
> @AfterReturning("transactedMethod(attr)")
> public void afterTransaction(TransactionAttribute attr) {
> System.out.println("after transaction");
> }
>
>
> @AfterThrowing(pointcut="transactedMethod(attr)",
> throwing="RuntimeException")
> public void failedTransaction(TransactionAttribute attr) {
> System.out.println("failed transaction");
> }
>
> /*
>
> @Pointcut("(execution(@javax.ejb.TransactionAttribute * *.*(..)))")
>
> void transactedMethod() {}
> @Before("transactedMethod() ")
> public void beforeTransaction() {
> System.out.println("before transaction");
> }
>
> @AfterReturning("transactedMethod()")
> public void afterTransaction() {
> System.out.println("after transaction");
> }
>
>
> @AfterThrowing(pointcut="transactedMethod()",
> throwing="RuntimeException")
> public void failedTransaction() {
> System.out.println("failed transaction");
> }
> */
> }
>
> _______________________________________________
> aspectj-users mailing list
> aspectj-users@xxxxxxxxxxx
> https://dev.eclipse.org/mailman/listinfo/aspectj-users
>
--
-- Adrian
adrian.colyer@xxxxxxxxx