net.sf.surrogate.core
Class ExceptionThrower

java.lang.Object
  |
  +--net.sf.surrogate.core.ExceptionThrower

public class ExceptionThrower
extends java.lang.Object

Throws an exception without declaring it!. This class is just ment for testing purposes and used by the Surrogate AspectJ code. It is not used "in place" but decompiled using the BCEL JasminVisitor and re-assembled using Jasmin to remove the "throws" clause.

The reason why this class exists is that, when creating "mockPointcuts", the corresponding "around" advices would have to declare a "throw" clause for some pointcuts but not for others. This would break the generic appoach of the framwork.

See Also:
JavaWorld Article

Constructor Summary
ExceptionThrower()
           
 
Method Summary
static void throwThrowable(java.lang.Throwable throwable)
           Throws a throwable as an unchecked exception.
 
Methods inherited from class java.lang.Object
, clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

ExceptionThrower

public ExceptionThrower()
Method Detail

throwThrowable

public static void throwThrowable(java.lang.Throwable throwable)
Throws a throwable as an unchecked exception. I.e. the following call will have "foo" throwing an Exception
 ...
 public void foo() {
   ExceptionThrower.throwThrowable(new Exception());
 }
 
Parameters:
throwable - the throwable
Throws:
java.lang.Throwable - the throwable given on input