aboutsummaryrefslogtreecommitdiffstats
path: root/tests/src
diff options
context:
space:
mode:
Diffstat (limited to 'tests/src')
-rw-r--r--tests/src/org/aspectj/systemtest/AllTests19.java28
-rw-r--r--tests/src/org/aspectj/systemtest/ajc150/ajc150.xml4
-rw-r--r--tests/src/org/aspectj/systemtest/ajc151/Ajc151Tests.java7
-rw-r--r--tests/src/org/aspectj/systemtest/ajc152/Ajc152Tests.java2
-rw-r--r--tests/src/org/aspectj/systemtest/ajc154/Ajc154Tests.java2
-rw-r--r--tests/src/org/aspectj/systemtest/ajc1612/ajc1612.xml2
-rw-r--r--tests/src/org/aspectj/systemtest/ajc182/AllTestsAspectJ182.java1
-rw-r--r--tests/src/org/aspectj/systemtest/ajc190/Ajc190Tests.java44
-rw-r--r--tests/src/org/aspectj/systemtest/ajc190/AllTestsAspectJ190.java26
-rw-r--r--tests/src/org/aspectj/systemtest/ajc190/SanityTests19.java161
-rw-r--r--tests/src/org/aspectj/systemtest/ajc190/ajc190.xml14
-rw-r--r--tests/src/org/aspectj/systemtest/ajc190/sanity-tests.xml75
12 files changed, 355 insertions, 11 deletions
diff --git a/tests/src/org/aspectj/systemtest/AllTests19.java b/tests/src/org/aspectj/systemtest/AllTests19.java
new file mode 100644
index 000000000..4835a6154
--- /dev/null
+++ b/tests/src/org/aspectj/systemtest/AllTests19.java
@@ -0,0 +1,28 @@
+/*******************************************************************************
+ * Copyright (c) 2013, 2014 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;
+
+import org.aspectj.systemtest.ajc190.AllTestsAspectJ190;
+
+import junit.framework.Test;
+import junit.framework.TestSuite;
+
+public class AllTests19 {
+
+ public static Test suite() {
+ TestSuite suite = new TestSuite("AspectJ System Test Suite - 1.9");
+ // $JUnit-BEGIN$
+ suite.addTest(AllTestsAspectJ190.suite());
+ suite.addTest(AllTests18.suite());
+ // $JUnit-END$
+ return suite;
+ }
+}
diff --git a/tests/src/org/aspectj/systemtest/ajc150/ajc150.xml b/tests/src/org/aspectj/systemtest/ajc150/ajc150.xml
index c8a068c78..27e4c9a02 100644
--- a/tests/src/org/aspectj/systemtest/ajc150/ajc150.xml
+++ b/tests/src/org/aspectj/systemtest/ajc150/ajc150.xml
@@ -4545,8 +4545,8 @@
</ajc-test>
<ajc-test dir="java5/generics/genericaspects/" title="uberaspects - M">
<compile files="GenericAspectM.aj" options="-1.5">
- <message kind="error" line="23" text="The method m0(Integer) in the type GenericAspect&lt;A,B&gt;.SimpleI&lt;Integer&gt; is not applicable for the arguments (String)"/>
- <message kind="error" line="24" text="The method m1(List&lt;Integer&gt;) in the type GenericAspect&lt;A,B&gt;.SimpleI&lt;Integer&gt; is not applicable for the arguments (List&lt;String&gt;)"/>
+ <message kind="error" line="23" text="The method m0(Integer) in the type GenericAspect.SimpleI&lt;Integer&gt; is not applicable for the arguments (String)"/>
+ <message kind="error" line="24" text="The method m1(List&lt;Integer&gt;) in the type GenericAspect.SimpleI&lt;Integer&gt; is not applicable for the arguments (List&lt;String&gt;)"/>
<message kind="error" line="25" text="Type mismatch: cannot convert from String to Integer"/>
<message kind="error" line="26" text="Type mismatch: cannot convert from List&lt;String&gt; to List&lt;Integer&gt;"/>
</compile>
diff --git a/tests/src/org/aspectj/systemtest/ajc151/Ajc151Tests.java b/tests/src/org/aspectj/systemtest/ajc151/Ajc151Tests.java
index 5b3c795d4..8928678c8 100644
--- a/tests/src/org/aspectj/systemtest/ajc151/Ajc151Tests.java
+++ b/tests/src/org/aspectj/systemtest/ajc151/Ajc151Tests.java
@@ -12,17 +12,14 @@ package org.aspectj.systemtest.ajc151;
import java.io.File;
import java.io.IOException;
-import java.io.PrintWriter;
-import junit.framework.Test;
-
-import org.aspectj.ajdt.internal.core.builder.AsmHierarchyBuilder;
import org.aspectj.asm.AsmManager;
import org.aspectj.asm.IHierarchy;
import org.aspectj.asm.IProgramElement;
import org.aspectj.systemtest.ajc150.GenericsTests;
import org.aspectj.testing.XMLBasedAjcTestCase;
-import org.aspectj.weaver.UnresolvedType.TypeKind;
+
+import junit.framework.Test;
public class Ajc151Tests extends org.aspectj.testing.XMLBasedAjcTestCase {
diff --git a/tests/src/org/aspectj/systemtest/ajc152/Ajc152Tests.java b/tests/src/org/aspectj/systemtest/ajc152/Ajc152Tests.java
index d0ced6179..eef463214 100644
--- a/tests/src/org/aspectj/systemtest/ajc152/Ajc152Tests.java
+++ b/tests/src/org/aspectj/systemtest/ajc152/Ajc152Tests.java
@@ -367,7 +367,7 @@ public class Ajc152Tests extends org.aspectj.testing.XMLBasedAjcTestCase {
IHierarchy top = AsmManager.lastActiveStructureModel.getHierarchy();
IProgramElement ipe = top.findElementForLabel(top.getRoot(), IProgramElement.Kind.METHOD, ipeLabel);
assertNotNull("Couldn't find '" + ipeLabel + "' element in the tree", ipe);
- List l = ipe.getParameterSignatures();
+ List<char[]> l = ipe.getParameterSignatures();
boolean eq = CharOperation.equals(((char[]) l.get(0)), expectedParm.toCharArray());
assertTrue("expected parameter to be '" + expectedParm + "' but found '" + new String(((char[]) l.get(0))) + "'", eq);
}
diff --git a/tests/src/org/aspectj/systemtest/ajc154/Ajc154Tests.java b/tests/src/org/aspectj/systemtest/ajc154/Ajc154Tests.java
index 7a025d796..ebba76303 100644
--- a/tests/src/org/aspectj/systemtest/ajc154/Ajc154Tests.java
+++ b/tests/src/org/aspectj/systemtest/ajc154/Ajc154Tests.java
@@ -275,7 +275,7 @@ public class Ajc154Tests extends org.aspectj.testing.XMLBasedAjcTestCase {
// Should be 'rounded down' when transforming it into a MethodGen, new position will be '2'
// This next line will go BANG with an NPE if we don't correctly round the start pc down to 2
- MethodGen toTransform = new MethodGen(oneWeWant, "A", cp, true);
+ new MethodGen(oneWeWant, "A", cp, true);
}
public void testGenericAspectGenericPointcut_pr174449() {
diff --git a/tests/src/org/aspectj/systemtest/ajc1612/ajc1612.xml b/tests/src/org/aspectj/systemtest/ajc1612/ajc1612.xml
index c02a99886..11746e122 100644
--- a/tests/src/org/aspectj/systemtest/ajc1612/ajc1612.xml
+++ b/tests/src/org/aspectj/systemtest/ajc1612/ajc1612.xml
@@ -655,7 +655,7 @@
</ajc-test>
<ajc-test dir="bugs1612/pr335810" title="rawtype warning">
-<compile files="One.java" options="-1.5 -warn:+raw -warn:+warningToken">
+<compile files="One.java" options="-1.5 -warn:+raw -warn:+unchecked -warn:+warningToken">
</compile>
</ajc-test>
diff --git a/tests/src/org/aspectj/systemtest/ajc182/AllTestsAspectJ182.java b/tests/src/org/aspectj/systemtest/ajc182/AllTestsAspectJ182.java
index 10551687d..c0323f0ef 100644
--- a/tests/src/org/aspectj/systemtest/ajc182/AllTestsAspectJ182.java
+++ b/tests/src/org/aspectj/systemtest/ajc182/AllTestsAspectJ182.java
@@ -12,7 +12,6 @@ package org.aspectj.systemtest.ajc182;
import junit.framework.Test;
import junit.framework.TestSuite;
-import org.aspectj.systemtest.apt.AptTests;
public class AllTestsAspectJ182 {
diff --git a/tests/src/org/aspectj/systemtest/ajc190/Ajc190Tests.java b/tests/src/org/aspectj/systemtest/ajc190/Ajc190Tests.java
new file mode 100644
index 000000000..d2375625b
--- /dev/null
+++ b/tests/src/org/aspectj/systemtest/ajc190/Ajc190Tests.java
@@ -0,0 +1,44 @@
+/*******************************************************************************
+ * Copyright (c) 2016 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.ajc190;
+
+import java.io.File;
+
+import org.aspectj.testing.XMLBasedAjcTestCase;
+
+import junit.framework.Test;
+
+/**
+ * @author Andy Clement
+ */
+public class Ajc190Tests extends org.aspectj.testing.XMLBasedAjcTestCase {
+
+ public void testFunnySignature() {
+ runTest("funny signature with method reference");
+ }
+
+ // Weave a module with code that isn't in a module
+ public void testWeaveModule() throws Exception {
+ runTest("weave module");
+ }
+
+ // ---
+
+ public static Test suite() {
+ return XMLBasedAjcTestCase.loadSuite(Ajc190Tests.class);
+ }
+
+ @Override
+ protected File getSpecFile() {
+ return getClassResource("ajc190.xml");
+ }
+
+}
diff --git a/tests/src/org/aspectj/systemtest/ajc190/AllTestsAspectJ190.java b/tests/src/org/aspectj/systemtest/ajc190/AllTestsAspectJ190.java
new file mode 100644
index 000000000..70dc872b5
--- /dev/null
+++ b/tests/src/org/aspectj/systemtest/ajc190/AllTestsAspectJ190.java
@@ -0,0 +1,26 @@
+/*******************************************************************************
+ * Copyright (c) 2014 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.ajc190;
+
+import junit.framework.Test;
+import junit.framework.TestSuite;
+
+public class AllTestsAspectJ190 {
+
+ public static Test suite() {
+ TestSuite suite = new TestSuite("AspectJ 1.9.0 tests");
+ // $JUnit-BEGIN$
+ suite.addTest(Ajc190Tests.suite());
+ suite.addTest(SanityTests19.suite());
+ // $JUnit-END$
+ return suite;
+ }
+}
diff --git a/tests/src/org/aspectj/systemtest/ajc190/SanityTests19.java b/tests/src/org/aspectj/systemtest/ajc190/SanityTests19.java
new file mode 100644
index 000000000..35696931a
--- /dev/null
+++ b/tests/src/org/aspectj/systemtest/ajc190/SanityTests19.java
@@ -0,0 +1,161 @@
+/*******************************************************************************
+ * Copyright (c) 2006 IBM
+ * 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.ajc190;
+
+import java.io.File;
+
+import junit.framework.Test;
+
+import org.aspectj.apache.bcel.classfile.Attribute;
+import org.aspectj.apache.bcel.classfile.Code;
+import org.aspectj.apache.bcel.classfile.JavaClass;
+import org.aspectj.apache.bcel.classfile.Method;
+import org.aspectj.testing.XMLBasedAjcTestCase;
+
+/*
+ * Some very trivial tests that help verify things are OK.
+ * These are a copy of the earlier Sanity Tests created for 1.6 but these supply the -1.9 option
+ * to check code generation and modification with that version specified.
+ */
+public class SanityTests19 extends org.aspectj.testing.XMLBasedAjcTestCase {
+
+ // Incredibly trivial test programs that check the compiler works at all (these are easy-ish to debug)
+ public void testSimpleJava_A() {
+ runTest("simple - a");
+ }
+
+ public void testSimpleJava_B() {
+ runTest("simple - b");
+ }
+
+ public void testSimpleCode_C() {
+ runTest("simple - c");
+ }
+
+ public void testSimpleCode_D() {
+ runTest("simple - d");
+ }
+
+ public void testSimpleCode_E() {
+ runTest("simple - e");
+ }
+
+ public void testSimpleCode_F() {
+ runTest("simple - f");
+ }
+
+ public void testSimpleCode_G() {
+ runTest("simple - g");
+ }
+
+ public void testSimpleCode_H() {
+ runTest("simple - h", true);
+ }
+
+ public void testSimpleCode_I() {
+ runTest("simple - i");
+ }
+
+ // Check the version number in the classfiles is correct when Java6 options specified
+ public void testVersionCorrect1() throws ClassNotFoundException {
+ runTest("simple - j");
+ checkVersion("A", 53, 0);
+ }
+
+ public void testVersionCorrect2() throws ClassNotFoundException {
+ runTest("simple - k");
+ checkVersion("A", 53, 0);
+ }
+
+ public void testVersionCorrect3() throws ClassNotFoundException {
+ runTest("simple - l");
+ checkVersion("A", 53, 0);
+ }
+
+ public void testVersionCorrect4() throws ClassNotFoundException {// check it is 49.0 when -1.5 is specified
+ runTest("simple - m");
+ checkVersion("A", 49, 0);
+ }
+
+ // Check the stackmap stuff appears for methods in a Java6 file
+ // public void testStackMapAttributesAppear() throws ClassNotFoundException {
+ // runTest("simple - n");
+ // checkStackMapExistence("A","<init>_<clinit>");
+ // checkStackMapExistence("X","<init>_<clinit>_ajc$pointcut$$complicatedPointcut$1fe");
+ // }
+
+ /* For the specified class, check that each method has a stackmap attribute */
+ private void checkStackMapExistence(String classname, String toIgnore) throws ClassNotFoundException {
+ toIgnore = "_" + (toIgnore == null ? "" : toIgnore) + "_";
+ JavaClass jc = getClassFrom(ajc.getSandboxDirectory(), classname);
+ Method[] methods = jc.getMethods();
+ for (int i = 0; i < methods.length; i++) {
+ Method method = methods[i];
+ if (toIgnore.contains("_" + method.getName() + "_")) {
+ continue;
+ }
+ boolean hasStackMapAttribute = findAttribute(method.getAttributes(), "StackMapTable");
+ if (!hasStackMapAttribute) {
+ fail("Could not find StackMap attribute for method " + method.getName());
+ }
+ }
+ }
+
+ private boolean findAttribute(Attribute[] attrs, String attributeName) {
+ if (attrs == null) {
+ return false;
+ }
+ for (int i = 0; i < attrs.length; i++) {
+ Attribute attribute = attrs[i];
+ if (attribute.getName().equals(attributeName)) {
+ return true;
+ }
+ // System.out.println(attribute.getName());
+ if (attribute.getName().equals("Code")) {
+ Code c = (Code) attribute;
+ Attribute[] codeAttributes = c.getAttributes();
+ for (int j = 0; j < codeAttributes.length; j++) {
+ Attribute codeAttribute = codeAttributes[j];
+ if (codeAttribute.getName().equals(attributeName)) {
+ return true;
+ // System.out.println(codeAttribute.getName());
+ }
+ }
+ }
+ }
+ return false;
+ }
+
+ private void checkVersion(String classname, int major, int minor) throws ClassNotFoundException {
+ JavaClass jc = getClassFrom(ajc.getSandboxDirectory(), classname);
+ if (jc.getMajor() != major) {
+ fail("Expected major version to be " + major + " but was " + jc.getMajor());
+ }
+ if (jc.getMinor() != minor) {
+ fail("Expected minor version to be " + minor + " but was " + jc.getMinor());
+ }
+ }
+
+ // Check the stackmap stuff is removed when a method gets woven (for now...)
+ // public void testStackMapAttributesDeletedInWovenCode() {
+ // fail("Not implemented");
+ // }
+
+ // ///////////////////////////////////////
+ public static Test suite() {
+ return XMLBasedAjcTestCase.loadSuite(SanityTests19.class);
+ }
+
+ protected File getSpecFile() {
+ return getClassResource("sanity-tests.xml");
+ }
+
+}
diff --git a/tests/src/org/aspectj/systemtest/ajc190/ajc190.xml b/tests/src/org/aspectj/systemtest/ajc190/ajc190.xml
new file mode 100644
index 000000000..a270116e3
--- /dev/null
+++ b/tests/src/org/aspectj/systemtest/ajc190/ajc190.xml
@@ -0,0 +1,14 @@
+<!DOCTYPE suite SYSTEM "../tests/ajcTestSuite.dtd"[]>
+
+<suite>
+
+ <ajc-test dir="bugs190/520135" title="funny signature with method reference">
+ <compile files="FailsApectJ.java" options="-1.8"/>
+ </ajc-test>
+
+ <ajc-test dir="bugs190/modules" title="weave module">
+ <compile files="aspect1/Azpect1.java" inpath="module1/module-one.jar" outjar="runner.jar" options="-1.8"/>
+ <java classpath="runner.jar" class="a.b.c.Code"/>
+ </ajc-test>
+
+</suite>
diff --git a/tests/src/org/aspectj/systemtest/ajc190/sanity-tests.xml b/tests/src/org/aspectj/systemtest/ajc190/sanity-tests.xml
new file mode 100644
index 000000000..f72350b30
--- /dev/null
+++ b/tests/src/org/aspectj/systemtest/ajc190/sanity-tests.xml
@@ -0,0 +1,75 @@
+<!DOCTYPE suite SYSTEM "../tests/ajcTestSuite.dtd"[]>
+
+<!-- AspectJ v1.6.0 Tests -->
+<suite>
+
+ <!-- empty class -->
+ <ajc-test dir="bugs160/simplejava" title="simple - a">
+ <compile files="SimpleA.java" options="-1.9"/>
+ </ajc-test>
+
+ <!-- class with one method -->
+ <ajc-test dir="bugs160/simplejava" title="simple - b">
+ <compile files="SimpleB.java" options="-1.9"/>
+ <run class="SimpleB"/>
+ </ajc-test>
+
+ <!-- empty aspect -->
+ <ajc-test dir="bugs160/simplejava" title="simple - c">
+ <compile files="SimpleC.java" options="-1.9"/>
+ </ajc-test>
+
+ <!-- simple before -->
+ <ajc-test dir="bugs160/simplejava" title="simple - d">
+ <compile files="SimpleD.java" options="-1.9"/>
+ </ajc-test>
+
+ <!-- simple itd field -->
+ <ajc-test dir="bugs160/simplejava" title="simple - e">
+ <compile files="SimpleE.java" options="-1.9"/>
+ </ajc-test>
+
+ <!-- aspect with main calling a static method -->
+ <ajc-test dir="bugs160/simplejava" title="simple - f">
+ <compile files="SimpleF.java" options="-1.9"/>
+ </ajc-test>
+
+ <!-- pertarget -->
+ <ajc-test dir="bugs160/simplejava" title="simple - g">
+ <compile files="SimpleG.java" options="-1.9"/>
+ </ajc-test>
+
+ <!-- generic ctor itds -->
+ <ajc-test dir="bugs160/simplejava" title="simple - h">
+ <compile files="SimpleH.java" options="-1.9"/>
+ </ajc-test>
+
+ <!-- overriding generic itd methods -->
+ <ajc-test dir="bugs160/simplejava" title="simple - i">
+ <compile files="SimpleI.java" options="-1.9"/>
+ </ajc-test>
+
+ <!-- check class file version is 53.0 -->
+ <ajc-test dir="bugs160/simplejava" title="simple - j">
+ <compile files="SimpleJ.java" options="-1.9"/>
+ </ajc-test>
+
+ <!-- check class file version is 53.0 -->
+ <ajc-test dir="bugs160/simplejava" title="simple - k">
+ <compile files="SimpleJ.java" options="-source 1.9"/>
+ </ajc-test>
+
+ <!-- check class file version is 53.0 -->
+ <ajc-test dir="bugs160/simplejava" title="simple - l">
+ <compile files="SimpleJ.java" options="-source 1.9 -target 1.9"/>
+ </ajc-test>
+
+ <!-- check class file version is 49.0 -->
+ <ajc-test dir="bugs160/simplejava" title="simple - m">
+ <compile files="SimpleJ.java" options="-1.5"/>
+ </ajc-test>
+
+ <ajc-test dir="bugs160/simplejava" title="simple - n">
+ <compile files="SimpleN.java" options="-1.9"/>
+ </ajc-test>
+</suite>