Skip to main content

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

Hi Anish,

This subject has already been brought up in the past ;-)

AspectJ doesn't allow change method signature. Some people already said that it would be very useful to have this power to add an exception in a method throws clause. In fact, we submitted this as a feature request to the AspectJ team, which was in a list to be considered in the future (I couldn't find the link for this features list, does anyone have it?)

You must work with softened exception http://dev.eclipse.org/viewcvs/indextech.cgi/~checkout~/aspectj-home/doc/progguide/semantics-declare.html#d0e6393 as stated in the AspectJ project FAQ page http://dev.eclipse.org/viewcvs/indextech.cgi/~checkout~/aspectj-home/doc/faq.html#q:methodsignatures



cheers,
Sergio


Anish Das Sarma wrote:
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.

_______________________________________________
aspectj-users mailing list
aspectj-users@xxxxxxxxxxx
http://dev.eclipse.org/mailman/listinfo/aspectj-users



--
Sérgio Soares
Centro de Informática - UFPE
scbs@xxxxxxxxxxx
scbs@xxxxxxx
http://www.cin.ufpe.br/~scbs

SugarLoafPLoP'2003
http://www.cin.ufpe.br/~sugarloafplop



Back to the top