/*
 * Created on Nov 11, 2004
 *
 * TODO To change the template for this generated file go to
 * Window - Preferences - Java - Code Style - Code Templates
 */



/**
 * @author leavens
 *
 * TODO To change the template for this generated type comment go to
 * Window - Preferences - Java - Code Style - Code Templates
 */
public aspect SanityChecker {
	void around(float amount) :
		execution(void Account.credit(float))
		&& args(amount)
		{
			if (!(amount >= 0.0)) {
				System.err.println("bad argument was " + amount);
				throw new IllegalArgumentException();
			}
			proceed(amount);
		}
	
	pointcut mainExec() : execution(void Test.main(..));
	
	after() returning() : mainExec() {
		SavingsAccount acct = new SavingsAccount(12);
		acct.credit(-3.4f);
	}
}
