import org.aspectj.org.eclipse.jdt.internal.compiler.ast.ASTNode;
import org.aspectj.org.eclipse.jdt.internal.compiler.ast.AbstractMethodDeclaration;
import org.aspectj.org.eclipse.jdt.internal.compiler.ast.Argument;
+import org.aspectj.org.eclipse.jdt.internal.compiler.ast.ExplicitConstructorCall;
import org.aspectj.org.eclipse.jdt.internal.compiler.impl.CompilerOptions;
import org.aspectj.org.eclipse.jdt.internal.compiler.impl.ReferenceContext;
import org.aspectj.org.eclipse.jdt.internal.compiler.lookup.MethodBinding;
if (!factory.getWorld().getDeclareSoft().isEmpty()) {
Shadow callSite = factory.makeShadow(location, referenceContext);
Shadow enclosingExec = factory.makeShadow(referenceContext);
+ // PR 72157 - calls to super / this within a constructor are not part of the cons join point.
+ if ((callSite == null) && (enclosingExec.getKind() == Shadow.ConstructorExecution)
+ && (location instanceof ExplicitConstructorCall)) {
+ super.unhandledException(exceptionType, location);
+ return;
+ }
// System.err.println("about to show error for unhandled exception: " + new String(exceptionType.sourceName()) +
// " at " + location + " in " + referenceContext);
--- /dev/null
+public class PR72157 {
+ public PR72157() throws Exception {
+ throw new Exception();
+ }
+
+ public static void main(String[] args) {
+ new SCE2();
+ }
+}
+
+class SCE2 extends PR72157 {
+ public SCE2() {
+ super(); // CE L13?
+ }
+
+}
+
+class Foo {
+
+ public Foo() throws Exception {
+ throw new Exception();
+ }
+
+}
+
+class Goo {
+ public Goo() {
+ new Foo();
+ }
+}
+
+aspect SCEAspect {
+ declare soft: Exception: within(SCE2);
+ declare soft: Exception: within(Goo);
+}
\ No newline at end of file
<compile files="ArrayCloning.java"/>
<run class="ArrayCloning"/>
</ajc-test>
+
+ <ajc-test dir="bugs" pr="72157"
+ title="declare soft can cause programs with invalid exception behaviour to be generated">
+ <compile files="PR72157.java">
+ <message kind="error" line="13" text="Unhandled"/>
+ </compile>
+ </ajc-test>
\ No newline at end of file