[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index] [List Home]
Re: [aspectj-users] Exception Detection in AspectJ

Generally you can't change method signatures,
but you can wrap the checked exception as an unchecked one.
See declare soft, "Softened exceptions" in the Programming guide:
I think both Ramnivas and Ron have used this extensively, and probably
have published examples.
------------Original Message------------
From: Yimeng Li <yimengl@xxxxxxxxx>
To: aspectj-users@xxxxxxxxxxx
Date: Tue, Dec-6-2005 10:53 AM
Subject: [aspectj-users] Exception Detection in AspectJ
Hi all,

Is that possible to use AspectJ for exception detectionof a Java program?

Suppose in a Java program, method foo() invokes method zoo() which will throw IOException.

public void foo() {

This piece of code won't pass the java compiler since foo() should either hander the IOException or throw it. So I'm wondering if I can use AspectJ to detect the exception that will be thrown by zoo() and add a Throws-Statement in foo() automatically ?

Thanks a lot.

aspectj-users mailing list