[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index] [List Home]
[aspectj-users] Important problem with new limit on declare soft.

From the changes page:

" # 'declare soft: TYPE: POINTCUT;' In 1.0 a TYPE_PATTERN was allowed
rather than a TYPE. This limitation makes declare soft much easier to
implement efficiently."

Unfortunately this gives users no way to soften only checked exceptions. 

Examine this line:

declare soft : Exception : somePcd();

Since RuntimeException subclasses Exception it will be softened as well,
leaving no way to throw your own RuntimeException and have it propagate
normally.  (Avoiding SoftException's obfuscation of the original cause).

I tried getting around this limitation by using a marker interface and got:

Exception in thread "main" java.lang.VerifyError: (class: simple/Except,
method: <clinit> signature: ()V) catch_type not a subclass of Throwable

Though I'm sure this bug will be fixed, it suggests that there may be no
way to use marker interfaces either.

Does anyone else think that this is an important limitation? 


Here's my class (I've already submitted the bug).

public class Except {

    public static void a(){
     * Method b.
    private static void b() {
        throw new RuntimeException("Orig");
    public static void main(String[] args) {
        try {
        } catch (SoftException e) {
    public static interface Checked{
    static aspect Softner{
        declare parents : Exception+ && !RuntimeException implements
        declare soft : Checked : within(Except);
Video Attachment
Lesiecki Nicholas has sent you a video.
Please go to
to view the video.


Do you Yahoo!?
Yahoo! Mail Plus - Powerful. Affordable. Sign up now.