[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index] [List Home]
[aspectj-users] making methods throw exceptions

Hi guys,

(I have enrolled to the list a couple of days ago so I don't know if this subject has already been brought up in the past...)

We have been experimenting with aspects for the last couple of weeks and we were wondering if we can have an aspect that would change the signature of a method (of a class or an interface) and make it throw an exception; something like this:

public class/interface Test {
   // before
   public void compute() {}

   // after
   public void compute() throws MyException {}
}

(Of course, around advices should be specified for all calls to "compute" in order to add try and catch blocks...)

If this is not allowed, can anyone suggest possible workarounds?

Thanks in advance.
Anish.