Summary: | declare soft can cause programs with invalid exception behaviour to be generated | ||
---|---|---|---|
Product: | [Tools] AspectJ | Reporter: | Ganesh Sittampalam <ganesh> |
Component: | Compiler | Assignee: | Adrian Colyer <adrian.colyer> |
Status: | RESOLVED FIXED | QA Contact: | |
Severity: | normal | ||
Priority: | P3 | ||
Version: | DEVELOPMENT | ||
Target Milestone: | 1.2.1 | ||
Hardware: | PC | ||
OS: | Linux | ||
Whiteboard: |
Description
Ganesh Sittampalam
2004-08-18 06:39:42 EDT
marked as target 1.2.1 This program looks like it is behaving correctly to me? within(SCE2) matches the execution join point for SCE2.new(), and softens exceptions that occur during its execution. Consider the analogous program (which eliminates the super() call confusion): class Foo { public void foo() throws Exception { throw new Exception(); } public void goo() { foo(); } } This will give an unhandled exception compilation error as is, but if you add declare soft : Exception : execution(* goo(..)); it will compile happily. In your example, the thrown Exception actually does get softened; but in my example it doesn't, leading to a checked exception being thrown at runtime by a method not declared to throw it. The super() call is crucial to my example, because the problem is that the execution join point for a constructor does not cover the super() call. Got it, thanks. Should have read more carefully. Have re-opened bug. Interesting problem since: class Foo { Foo() {} } class Boo extends Foo { Boo() { try { super(); } catch(Error e) {} } } is not a valid program. Therefore the correct behaviour must be to NOT soften the exception, which is consistent with the definition of execution join points as beginning after the super call. Fix in tree. Waiting for development build before closing. Fix now available for download. Fix released as part of AspectJ 1.2.1 |