@@ -0,0 +1,30 @@ | |||
package mypackage; | |||
import javax.management.MXBean; | |||
aspect Azpect { | |||
pointcut pc(Object o) : this(o) && execution(* (Code).n*(..)); | |||
after(Object o) throwing(Exception e) : pc(o) { | |||
System.out.println("caught it"); | |||
// e.printStackTrace(); | |||
} | |||
} | |||
public class Code { | |||
// anotherCaughtMethod is NOT advised -- <<< ERROR <<< this should be advised | |||
public void n() { throw new RuntimeException("n"); } | |||
public static void main(String[]argv) { | |||
try { | |||
new Code().n(); | |||
} catch (Exception e) { | |||
} | |||
System.out.println("done"); | |||
} | |||
} |
@@ -0,0 +1,34 @@ | |||
package mypackage; | |||
aspect Azpect { | |||
pointcut pc(Object o) : this(o) && execution(* Code2.n*(..) throws Exception+); | |||
after(Object o) throwing(Exception e) : pc(o) { | |||
System.out.println("caught it: "+thisJoinPointStaticPart); | |||
} | |||
} | |||
public class Code2 { | |||
public void n1() { throw new RuntimeException("n"); } | |||
public void n2() throws MyException { throw new MyException(); } | |||
public static void main(String[]argv) { | |||
try { | |||
new Code2().n1(); | |||
} catch (Exception e) {} | |||
try { | |||
new Code2().n2(); | |||
} catch (Exception e) {} | |||
System.out.println("done"); | |||
} | |||
} | |||
class MyException extends Exception { | |||
} |
@@ -10,6 +10,7 @@ import org.aspectj.systemtest.ajc160.AllTestsAspectJ160; | |||
import org.aspectj.systemtest.ajc161.AllTestsAspectJ161; | |||
import org.aspectj.systemtest.ajc1610.AllTestsAspectJ1610; | |||
import org.aspectj.systemtest.ajc1611.AllTestsAspectJ1611; | |||
import org.aspectj.systemtest.ajc1612.AllTestsAspectJ1612; | |||
import org.aspectj.systemtest.ajc162.AllTestsAspectJ162; | |||
import org.aspectj.systemtest.ajc163.AllTestsAspectJ163; | |||
import org.aspectj.systemtest.ajc164.AllTestsAspectJ164; | |||
@@ -35,6 +36,7 @@ public class AllTests16 { | |||
suite.addTest(AllTestsAspectJ169.suite()); | |||
suite.addTest(AllTestsAspectJ1610.suite()); | |||
suite.addTest(AllTestsAspectJ1611.suite()); | |||
suite.addTest(AllTestsAspectJ1612.suite()); | |||
suite.addTest(AllTests15.suite()); | |||
// $JUnit-END$ | |||
return suite; |
@@ -0,0 +1,43 @@ | |||
/******************************************************************************* | |||
* Copyright (c) 2008 Contributors | |||
* All rights reserved. This program and the accompanying materials | |||
* are made available under the terms of the Eclipse Public License v1.0 | |||
* which accompanies this distribution, and is available at | |||
* http://www.eclipse.org/legal/epl-v10.html | |||
* | |||
* Contributors: | |||
* Andy Clement - initial API and implementation | |||
*******************************************************************************/ | |||
package org.aspectj.systemtest.ajc1612; | |||
import java.io.File; | |||
import junit.framework.Test; | |||
import org.aspectj.testing.XMLBasedAjcTestCase; | |||
/** | |||
* @author Andy Clement | |||
*/ | |||
public class Ajc1612Tests extends org.aspectj.testing.XMLBasedAjcTestCase { | |||
public void testThrowsClause_292239() { | |||
runTest("throws clause"); | |||
} | |||
public void testThrowsClause_292239_2() { | |||
runTest("throws clause - 2"); | |||
} | |||
// --- | |||
public static Test suite() { | |||
return XMLBasedAjcTestCase.loadSuite(Ajc1612Tests.class); | |||
} | |||
@Override | |||
protected File getSpecFile() { | |||
return new File("../tests/src/org/aspectj/systemtest/ajc1612/ajc1612.xml"); | |||
} | |||
} |
@@ -0,0 +1,25 @@ | |||
/******************************************************************************* | |||
* Copyright (c) 2008 Contributors | |||
* All rights reserved. This program and the accompanying materials | |||
* are made available under the terms of the Eclipse Public License v1.0 | |||
* which accompanies this distribution, and is available at | |||
* http://www.eclipse.org/legal/epl-v10.html | |||
* | |||
* Contributors: | |||
* Andy Clement - initial API and implementation | |||
*******************************************************************************/ | |||
package org.aspectj.systemtest.ajc1612; | |||
import junit.framework.Test; | |||
import junit.framework.TestSuite; | |||
public class AllTestsAspectJ1612 { | |||
public static Test suite() { | |||
TestSuite suite = new TestSuite("AspectJ 1.6.12 tests"); | |||
// $JUnit-BEGIN$ | |||
suite.addTest(Ajc1612Tests.suite()); | |||
// $JUnit-END$ | |||
return suite; | |||
} | |||
} |
@@ -0,0 +1,46 @@ | |||
<!DOCTYPE suite SYSTEM "../tests/ajcTestSuite.dtd"[]> | |||
<suite> | |||
<ajc-test dir="bugs1612/pr292239" title="throws clause"> | |||
<compile files="Code.java" options="-1.5 -showWeaveInfo"> | |||
<message kind="weave" text="Join point 'method-execution(void mypackage.Code.n())' in Type 'mypackage.Code' (Code.java:19) advised by afterThrowing advice from 'mypackage.Azpect' (Code.java:9)"/> | |||
</compile> | |||
<run class="mypackage.Code"> | |||
<stdout> | |||
<line text="caught it"/> | |||
<line text="done"/> | |||
</stdout> | |||
</run> | |||
</ajc-test> | |||
<ajc-test dir="bugs1612/pr292239" title="throws clause - 2"> | |||
<compile files="Code2.java" options="-1.5 -showWeaveInfo"> | |||
<message kind="weave" text="Join point 'method-execution(void mypackage.Code2.n2())' in Type 'mypackage.Code2' (Code2.java:17) advised by afterThrowing advice from 'mypackage.Azpect' (Code2.java:7)"/> | |||
</compile> | |||
<run class="mypackage.Code2"> | |||
<stdout> | |||
<line text="caught it: execution(void mypackage.Code2.n2())"/> | |||
<line text="done"/> | |||
</stdout> | |||
</run> | |||
</ajc-test> | |||
<!-- | |||
<ajc-test dir="bugs1611/pr336136" title="itit"> | |||
<compile files="Country_Roo_Op4j.java"> | |||
<message kind="error" text="The import com.foo cannot be resolved" line="1"/> | |||
<message kind="error" text="The import org.javaruntype cannot be resolved" line="3"/> | |||
<message kind="error" text="The import org.op4j cannot be resolved" line="4"/> | |||
<message kind="error" text="The import org.op4j cannot be resolved" line="5"/> | |||
<message kind="error" text="Country cannot be resolved to a type" line="9"/> | |||
<message kind="error" text="Function cannot be resolved to a type" line="11"/> | |||
<message kind="error" text="can't determine modifiers of missing type Country_Roo_Op4j$Keys"/> | |||
</compile>" | |||
</ajc-test> | |||
--> | |||
</suite> |