summaryrefslogtreecommitdiffstats
path: root/tests
diff options
context:
space:
mode:
authoraclement <aclement>2005-01-07 14:14:45 +0000
committeraclement <aclement>2005-01-07 14:14:45 +0000
commit797b6a6afb75b14dc530bc0831566e110da3ae91 (patch)
tree215856c38192e7e6091c994187c60678312cba3d /tests
parente63ee67d9514aa9eef6038aa718aab499962252e (diff)
downloadaspectj-797b6a6afb75b14dc530bc0831566e110da3ae91.tar.gz
aspectj-797b6a6afb75b14dc530bc0831566e110da3ae91.zip
Fix for Bug 82134: AspectJ 5 M2 should implement backwards compatibility for binary aspect form
Diffstat (limited to 'tests')
-rw-r--r--tests/src/org/aspectj/systemtest/ajc150/AllTestsJava5_binaryWeaving.java1
-rw-r--r--tests/src/org/aspectj/systemtest/ajc150/MigrationTests.java59
2 files changed, 60 insertions, 0 deletions
diff --git a/tests/src/org/aspectj/systemtest/ajc150/AllTestsJava5_binaryWeaving.java b/tests/src/org/aspectj/systemtest/ajc150/AllTestsJava5_binaryWeaving.java
index e69327932..353b5d07d 100644
--- a/tests/src/org/aspectj/systemtest/ajc150/AllTestsJava5_binaryWeaving.java
+++ b/tests/src/org/aspectj/systemtest/ajc150/AllTestsJava5_binaryWeaving.java
@@ -24,6 +24,7 @@ public class AllTestsJava5_binaryWeaving {
public static Test suite() {
TestSuite suite = new TestSuite("Java5 - binary weaving");
//$JUnit-BEGIN$
+ suite.addTestSuite(MigrationTests.class);
suite.addTest(Ajc150Tests.suite());
suite.addTest(AccBridgeMethods.suite());
suite.addTestSuite(CovarianceTests.class);
diff --git a/tests/src/org/aspectj/systemtest/ajc150/MigrationTests.java b/tests/src/org/aspectj/systemtest/ajc150/MigrationTests.java
new file mode 100644
index 000000000..869b71b78
--- /dev/null
+++ b/tests/src/org/aspectj/systemtest/ajc150/MigrationTests.java
@@ -0,0 +1,59 @@
+/*******************************************************************************
+ * Copyright (c) 2004 IBM
+ * All rights reserved. This program and the accompanying materials
+ * are made available under the terms of the Common Public License v1.0
+ * which accompanies this distribution, and is available at
+ * http://www.eclipse.org/legal/cpl-v10.html
+ *
+ * Contributors:
+ * Andy Clement - initial API and implementation
+ *******************************************************************************/
+package org.aspectj.systemtest.ajc150;
+
+import java.io.File;
+
+import org.aspectj.tools.ajc.CompilationResult;
+
+
+/**
+ * Checks if we are obeying migration rules.
+ */
+public class MigrationTests extends TestUtils {
+
+ protected void setUp() throws Exception {
+ super.setUp();
+ baseDir = new File("../tests/migration");
+ }
+
+ /**
+ * Compile a simple java class with an aspect library built with aspectj 1.2.1 - this
+ * checks that we can load in attributes (especially pointcuts) that were written out
+ * in the 'old way'
+ *
+ */
+ public void testMigrationFrom121_pointcutsAndAdvice() {
+ CompilationResult cR = ajc(baseDir,new String[]{"-aspectpath","aspects121.jar","Program.java"});
+ System.err.println(cR.getStandardError());
+ assertTrue("Should not coredump: "+cR.getStandardError(),cR.getStandardError().indexOf("Dumping to ajcore")==-1);
+ assertTrue("Should be no error messages: \n"+cR.getErrorMessages(),cR.getErrorMessages().size()==0);
+ File f = new File(ajc.getSandboxDirectory()+File.separator+"Program.class");
+ assertTrue("Missing class file",f.exists());
+ run("Program");
+ }
+
+// /**
+// * We cannot support all aspects built prior to AspectJ 1.2.1 - so we don't support any.
+// * There are probably many reasons but the first one I've hit is:
+// * - Changes for cflow optimizations (counters instead of stacks where we can) mean that an aspect
+// * compiled at AspectJ1.2.0 will contain stack cases but AspectJ1.5.0 will look for counter
+// * fields in some cases.
+// *
+// * This means we should get a reasonable failure message in this case.
+// */
+// public void testMigrationFrom120_pointcutsAndAdvice() {
+// CompilationResult cR = ajc(baseDir,new String[]{"-aspectpath","aspects120.jar","Program.java"});
+// assertTrue("Should have failed",cR.getFailMessages().size()>0);
+// assertTrue("Should have produced nice message",cR.getFailMessages().get(0).toString().indexOf("Unable to continue")!=-1);
+// }
+
+} \ No newline at end of file