Project: AspectJ
Bug 72157 declare soft can cause programs with invalid exception behaviour to be generated
Reported: 2004-08-18 06:39:42 | Status: resolved fixed

Compiling the program below results in the constructor for the class SCE2 throwing Exception, which it is not declared to throw either in the source code or in the generated bytecode. If the 'declare soft' statement is removed, then the super() call in the SCE2 constructor is correctly reported as throwing an undeclared exception; it seems that the 'declare soft' statement turns off the exception checking of the super() call despite there being no join point which covers this call that would actually soften the exception. I'm using 'DEVELOPMENT built on Monday Aug 16, 2004 at 13:50:47 GMT'. public class SuperConsExc { public SuperConsExc() throws Exception { throw new Exception(); } public static void main(String[] args) { new SCE2(); } } class SCE2 extends SuperConsExc { public SCE2() { super(); } } aspect SCEAspect { declare soft: Exception: within(SCE2); }

Files changed in fix:
org.aspectj.ajdt.core/src/org/aspectj/ajdt/internal/compiler/problem/AjProblemReporter.java tests/bugs/ConvertToUnchecked.java tests/bugs/PR72157.java tests/src/org/aspectj/systemtest/ajc121/Ajc121Tests.java