Community
Participate
Working Groups
Advice that throws checked exceptions can be woven for handler join points that are not permitted to throw the checked exceptions. The compiler should signal an error instead, as it does for other join points. See modules/tests/bugs/handlers/ExceptionCheckCE.java
adding info keyword as a tracking test
This is a known limitation for 1.1. Computing the legal checked exceptions for a handler join point is hard, but technically feasible. org.aspectj.weaver.Shadow has the following XXX comment for anyone who needs a starting point for fixing this bug: protected boolean checkCanThrow(ShadowMunger munger, ResolvedTypeX resolvedTypeX) { if (getKind() == ExceptionHandler) { //XXX much too lenient rules here, need to walk up exception handlers return true; } ...
marked for consideration during AJ5 M4
We looked at this for 1.5.0. Since the resolution is "hard but technically feasible" (Jim's words), and it's been a known issue since 1.1 with no additional user reports against it, I think it's fair to say that we shouldn't hold 1.5.0 for it. Moving to 1.5.1...
1.5.1 is imminent ... fix for this isnt ... moving to post 1.5.1
I found out that it is possible to throw checked exception that is missing in signature of a method. It is possible only via annotation style aspect declaration. If you try to do same via .aj files you'll get compiler error. Here is test case. /** A class that doesn't declare that it throws any checked exception */ public class Foo { public void foo() { } } /**An aspect that throws Exception each time method Foo is called */ import org.aspectj.lang.ProceedingJoinPoint; import org.aspectj.lang.annotation.Around; import org.aspectj.lang.annotation.Aspect; @Aspect public class FooAspect { @Around("execution(void Foo.foo())") public Object throwException(ProceedingJoinPoint pjp) throws Throwable { throw new Exception(); } } /**Tests that undeclared check exception was thrown*/ import org.junit.Assert; import org.junit.Test; public class TextExceptionHandling { @Test public void undeclaredCheckedExceotionIsThrown() { try { new Foo().foo(); Assert.fail(); } catch (Exception e) { Assert.assertTrue(e.getClass().equals(UndeclaredThrowableException.class)); } } } JVM supposed to throw UndeclaredThrowableException in such cases but instead Exception is thrown. Tested on aspectj version 1.6.2 jdk 1.6.14.
moved your comment to a new bug 284301