From: aclement Date: Mon, 5 Jul 2010 22:16:22 +0000 (+0000) Subject: 318884: incremental: throws clause change X-Git-Tag: V1_6_10RC1~151 X-Git-Url: https://source.dussan.org/?a=commitdiff_plain;h=a369bf2ec8cef42e73bd5d6113f428ff9d202764;p=aspectj.git 318884: incremental: throws clause change --- diff --git a/tests/multiIncremental/pr318884_1/base/src/A.java b/tests/multiIncremental/pr318884_1/base/src/A.java new file mode 100644 index 000000000..8df91bb17 --- /dev/null +++ b/tests/multiIncremental/pr318884_1/base/src/A.java @@ -0,0 +1,4 @@ +public class A { + public void m() { + } +} diff --git a/tests/multiIncremental/pr318884_1/base/src/B.java b/tests/multiIncremental/pr318884_1/base/src/B.java new file mode 100644 index 000000000..3443831d5 --- /dev/null +++ b/tests/multiIncremental/pr318884_1/base/src/B.java @@ -0,0 +1,6 @@ +public class B { + public static void main(String []argv) { + A a = new A(); + a.m(); + } +} diff --git a/tests/multiIncremental/pr318884_1/inc1/src/A.java b/tests/multiIncremental/pr318884_1/inc1/src/A.java new file mode 100644 index 000000000..dce9f6baa --- /dev/null +++ b/tests/multiIncremental/pr318884_1/inc1/src/A.java @@ -0,0 +1,4 @@ +public class A { + public void m() throws java.io.IOException { + } +} diff --git a/tests/multiIncremental/pr318884_2/base/src/A.java b/tests/multiIncremental/pr318884_2/base/src/A.java new file mode 100644 index 000000000..dce9f6baa --- /dev/null +++ b/tests/multiIncremental/pr318884_2/base/src/A.java @@ -0,0 +1,4 @@ +public class A { + public void m() throws java.io.IOException { + } +} diff --git a/tests/multiIncremental/pr318884_2/base/src/B.java b/tests/multiIncremental/pr318884_2/base/src/B.java new file mode 100644 index 000000000..03081aff2 --- /dev/null +++ b/tests/multiIncremental/pr318884_2/base/src/B.java @@ -0,0 +1,6 @@ +public class B { + public static void main(String []argv) throws java.io.IOException { + A a = new A(); + a.m(); + } +} diff --git a/tests/multiIncremental/pr318884_2/inc1/src/A.java b/tests/multiIncremental/pr318884_2/inc1/src/A.java new file mode 100644 index 000000000..e073fa1da --- /dev/null +++ b/tests/multiIncremental/pr318884_2/inc1/src/A.java @@ -0,0 +1,4 @@ +public class A { + public void m() throws Exception { + } +} diff --git a/tests/src/org/aspectj/systemtest/AllTests15.java b/tests/src/org/aspectj/systemtest/AllTests15.java index c8a2ce89a..8b19ef23b 100644 --- a/tests/src/org/aspectj/systemtest/AllTests15.java +++ b/tests/src/org/aspectj/systemtest/AllTests15.java @@ -12,6 +12,7 @@ import org.aspectj.systemtest.ajc151.AllTestsAspectJ151; import org.aspectj.systemtest.ajc152.AllTestsAspectJ152; import org.aspectj.systemtest.ajc153.AllTestsAspectJ153; import org.aspectj.systemtest.ajc154.AllTestsAspectJ154; +import org.aspectj.systemtest.incremental.tools.IncrementalCompilationTests; import org.aspectj.systemtest.incremental.tools.IncrementalOutputLocationManagerTests; import org.aspectj.systemtest.incremental.tools.IncrementalPerformanceTests; import org.aspectj.systemtest.incremental.tools.MoreOutputLocationManagerTests; @@ -37,6 +38,7 @@ public class AllTests15 { * issues and are excluded on the build machine so moving them here loses nothing for the moment. */ suite.addTestSuite(MultiProjectIncrementalTests.class); + suite.addTestSuite(IncrementalCompilationTests.class); suite.addTestSuite(IncrementalPerformanceTests.class); suite.addTestSuite(MoreOutputLocationManagerTests.class); suite.addTestSuite(IncrementalOutputLocationManagerTests.class); diff --git a/tests/src/org/aspectj/systemtest/ajc1610/Ajc1610Tests.java b/tests/src/org/aspectj/systemtest/ajc1610/Ajc1610Tests.java new file mode 100644 index 000000000..020b0c5db --- /dev/null +++ b/tests/src/org/aspectj/systemtest/ajc1610/Ajc1610Tests.java @@ -0,0 +1,36 @@ +/******************************************************************************* + * 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.ajc1610; + +import java.io.File; + +import junit.framework.Test; + +import org.aspectj.testing.XMLBasedAjcTestCase; + +public class Ajc1610Tests extends org.aspectj.testing.XMLBasedAjcTestCase { + + // public void testMessyDecp_318241() { + // runTest("messy decp"); + // } + + // --- + + public static Test suite() { + return XMLBasedAjcTestCase.loadSuite(Ajc1610Tests.class); + } + + @Override + protected File getSpecFile() { + return new File("../tests/src/org/aspectj/systemtest/ajc169/ajc169.xml"); + } + +} \ No newline at end of file diff --git a/tests/src/org/aspectj/systemtest/ajc1610/AllTestsAspectJ1610.java b/tests/src/org/aspectj/systemtest/ajc1610/AllTestsAspectJ1610.java new file mode 100644 index 000000000..dfbf422f2 --- /dev/null +++ b/tests/src/org/aspectj/systemtest/ajc1610/AllTestsAspectJ1610.java @@ -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.ajc1610; + +import junit.framework.Test; +import junit.framework.TestSuite; + +public class AllTestsAspectJ1610 { + + public static Test suite() { + TestSuite suite = new TestSuite("AspectJ 1.6.10 tests"); + // $JUnit-BEGIN$ + suite.addTest(Ajc1610Tests.suite()); + // $JUnit-END$ + return suite; + } +} diff --git a/tests/src/org/aspectj/systemtest/ajc1610/ajc1610.xml b/tests/src/org/aspectj/systemtest/ajc1610/ajc1610.xml new file mode 100644 index 000000000..8e4eab525 --- /dev/null +++ b/tests/src/org/aspectj/systemtest/ajc1610/ajc1610.xml @@ -0,0 +1,413 @@ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + \ No newline at end of file diff --git a/tests/src/org/aspectj/systemtest/incremental/tools/AbstractMultiProjectIncrementalAjdeInteractionTestbed.java b/tests/src/org/aspectj/systemtest/incremental/tools/AbstractMultiProjectIncrementalAjdeInteractionTestbed.java index 2976e5f19..871e44404 100644 --- a/tests/src/org/aspectj/systemtest/incremental/tools/AbstractMultiProjectIncrementalAjdeInteractionTestbed.java +++ b/tests/src/org/aspectj/systemtest/incremental/tools/AbstractMultiProjectIncrementalAjdeInteractionTestbed.java @@ -203,4 +203,11 @@ public class AbstractMultiProjectIncrementalAjdeInteractionTestbed extends AjdeI + " in the aop.xml file but found " + aspectCount + " occurrences"); } } + + protected void assertContains(String expectedSubstring, Object object) { + String actualString = object.toString(); + if (actualString.indexOf(expectedSubstring) == -1) { + fail("Expected to find '" + expectedSubstring + "' in '" + actualString + "'"); + } + } } diff --git a/tests/src/org/aspectj/systemtest/incremental/tools/IncrementalCompilationTests.java b/tests/src/org/aspectj/systemtest/incremental/tools/IncrementalCompilationTests.java new file mode 100644 index 000000000..38e6b48b4 --- /dev/null +++ b/tests/src/org/aspectj/systemtest/incremental/tools/IncrementalCompilationTests.java @@ -0,0 +1,54 @@ +/******************************************************************** + * Copyright (c) 2010 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://eclipse.org/legal/epl-v10.html + * + * Contributors: + * Andy Clement (SpringSource) initial implementation + *******************************************************************/ +package org.aspectj.systemtest.incremental.tools; + +/** + * Incremental compilation tests. MultiProjectIncrementalTests was getting unwieldy - started this new test class for 1.6.10. + * + * @author Andy Clement + * @since 1.6.10 + */ +public class IncrementalCompilationTests extends AbstractMultiProjectIncrementalAjdeInteractionTestbed { + + /** + * Build a pair of files, then change the throws clause in the first one (add a throws clause where there wasnt one). The second + * file should now have a 'unhandled exception' error on it. + */ + public void testModifiedThrowsClauseShouldTriggerError_318884() throws Exception { + String p = "pr318884_1"; + initialiseProject(p); + build(p); + checkWasFullBuild(); + checkCompileWeaveCount(p, 2, 2); + alter(p, "inc1"); + build(p); + checkWasntFullBuild(); + assertEquals(1, getErrorMessages(p).size()); + assertContains("B.java:4:0::0 Unhandled exception type IOException", getErrorMessages(p).get(0)); + } + + /** + * Build a pair of files, then change the throws clause in the first one (change the type of the thrown exception). The second + * file should now have a 'unhandled exception' error on it. + */ + public void testModifiedThrowsClauseShouldTriggerError_318884_2() throws Exception { + String p = "pr318884_2"; + initialiseProject(p); + build(p); + checkWasFullBuild(); + checkCompileWeaveCount(p, 2, 2); + alter(p, "inc1"); + build(p); + checkWasntFullBuild(); + assertEquals(1, getErrorMessages(p).size()); + assertContains("B.java:4:0::0 Unhandled exception type Exception", getErrorMessages(p).get(0)); + } +}