aboutsummaryrefslogtreecommitdiffstats
path: root/tests/src/test/java/org/aspectj/systemtest/ajc1810
diff options
context:
space:
mode:
authorAndy Clement <aclement@pivotal.io>2019-01-30 16:55:38 -0800
committerAndy Clement <aclement@pivotal.io>2019-01-30 16:55:38 -0800
commit2b24e7377da7c849fe7f9f4fa06a701664f9d27d (patch)
tree64c36c8fcf29633af7a5e2f7405b94cbec629ca8 /tests/src/test/java/org/aspectj/systemtest/ajc1810
parentd60de8d0b3e62eb36b612a824bb9345d865c0155 (diff)
downloadaspectj-2b24e7377da7c849fe7f9f4fa06a701664f9d27d.tar.gz
aspectj-2b24e7377da7c849fe7f9f4fa06a701664f9d27d.zip
mavenizing tests - wip
Diffstat (limited to 'tests/src/test/java/org/aspectj/systemtest/ajc1810')
-rw-r--r--tests/src/test/java/org/aspectj/systemtest/ajc1810/Ajc1810Tests.java177
-rw-r--r--tests/src/test/java/org/aspectj/systemtest/ajc1810/AllTestsAspectJ1810.java25
-rw-r--r--tests/src/test/java/org/aspectj/systemtest/ajc1810/ajc1810.xml110
3 files changed, 312 insertions, 0 deletions
diff --git a/tests/src/test/java/org/aspectj/systemtest/ajc1810/Ajc1810Tests.java b/tests/src/test/java/org/aspectj/systemtest/ajc1810/Ajc1810Tests.java
new file mode 100644
index 000000000..37896b42f
--- /dev/null
+++ b/tests/src/test/java/org/aspectj/systemtest/ajc1810/Ajc1810Tests.java
@@ -0,0 +1,177 @@
+/*******************************************************************************
+ * 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.ajc1810;
+
+import java.io.File;
+
+import org.aspectj.apache.bcel.Constants;
+import org.aspectj.apache.bcel.classfile.Attribute;
+import org.aspectj.apache.bcel.classfile.JavaClass;
+import org.aspectj.testing.XMLBasedAjcTestCase;
+
+import junit.framework.Test;
+
+/**
+ * @author Andy Clement
+ */
+public class Ajc1810Tests extends org.aspectj.testing.XMLBasedAjcTestCase {
+
+ public void testBinding_508661() {
+ runTest("various ltw");
+ }
+
+ public void testBinding_500035() {
+ runTest("ataspectj binding");
+ }
+
+ public void testBinding_500035_2() {
+ runTest("ataspectj binding 2");
+ }
+
+ public void testBinding_500035_3() {
+ runTest("ataspectj binding 3 -XnoInline");
+ }
+
+ public void testBinding_500035_4() {
+ runTest("ataspectj binding 4");
+ }
+
+ public void testGenericsException_501656() {
+ runTest("generics exception");
+ }
+
+ public void testAIOOBE_502807() {
+ runTest("unexpected aioobe");
+ }
+
+ public void testInvokeDynamic_490315() {
+ runTest("indy");
+ }
+
+ public void testAmbigMessage17() throws Exception {
+ runTest("ambiguous message - 17");
+ }
+
+ public void testAmbigMessage18() throws Exception {
+ runTest("ambiguous message - 18");
+ }
+
+ // http://docs.oracle.com/javase/specs/jvms/se8/html/jvms-4.html#jvms-4.7.6
+ public void testInnerClassesAttributeStructure_493554() throws Exception {
+ runTest("pertarget");
+
+ // Testcode commented out below is for full analysis of the inner class attribute but under
+ // 493554 we are going to remove that attribute for this class
+ JavaClass jc = getClassFrom(ajc.getSandboxDirectory(), "example/aspect/FooAspect$ajcMightHaveAspect");
+ assertNotNull(jc);
+ assertEquals(Constants.ACC_PUBLIC | Constants.ACC_INTERFACE | Constants.ACC_ABSTRACT,jc.getModifiers());
+ Attribute[] attributes = jc.getAttributes();
+ for (Attribute attribute: attributes) {
+ if (attribute.getName().equals("InnerClasses")) {
+ fail("Did not expect to find InnerClasses attribute");
+ }
+ }
+
+// // Is InnerClasses attribute well formed for the pertarget interface?
+// JavaClass jc = getClassFrom(ajc.getSandboxDirectory(), "example/aspect/FooAspect$ajcMightHaveAspect");
+// assertNotNull(jc);
+// assertEquals(Constants.ACC_PUBLIC | Constants.ACC_INTERFACE | Constants.ACC_ABSTRACT,jc.getModifiers());
+// Attribute attr = getAttributeStartsWith(jc.getAttributes(), "InnerClasses");
+// assertNotNull(attr);
+// InnerClasses innerClasses = (InnerClasses)attr;
+// InnerClass[] innerClassArray = innerClasses.getInnerClasses();
+// assertEquals(1,innerClassArray.length);
+// InnerClass innerClass = innerClassArray[0];
+// ConstantPool cp = jc.getConstantPool();
+//
+// // The value of the inner_class_info_index item must be a valid index into the
+// // constant_pool table. The constant_pool entry at that index must be a CONSTANT_Class_info
+// // structure representing C.
+// int innerClassIndex = innerClass.getInnerClassIndex();
+// ConstantClass cc = (ConstantClass)cp.getConstant(innerClassIndex);
+// ConstantUtf8 utf8 = cp.getConstantUtf8(cc.getNameIndex());
+// assertEquals("example/aspect/FooAspect$ajcMightHaveAspect",utf8.getStringValue());
+//
+// // The remaining items in the classes array entry give information about C.
+// // The value of the outer_class_info_index item must be a valid index into the
+// // constant_pool table, and the entry at that index must be a CONSTANT_Class_info
+// // structure representing the class or interface of which C is a member.
+// int outerClassIndex = innerClass.getOuterClassIndex();
+// cc = (ConstantClass)cp.getConstant(outerClassIndex);
+// utf8 = cp.getConstantUtf8(cc.getNameIndex());
+// assertEquals("example/aspect/FooAspect",utf8.getStringValue());
+//
+// // The value of the inner_name_index item must be a valid index into the constant_pool table,
+// // and the entry at that index must be a CONSTANT_Utf8_info structure (ยง4.4.7) that represents
+// // the original simple name of C, as given in the source code from which this class file was compiled.
+// int innerNameIndex = innerClass.getInnerNameIndex();
+// utf8 = cp.getConstantUtf8(innerNameIndex);
+// assertEquals("ajcMightHaveAspect",utf8.getStringValue());
+//
+// int innerAccessFlags = innerClass.getInnerAccessFlags();
+// assertEquals(Constants.ACC_PUBLIC | Constants.ACC_ABSTRACT | Constants.ACC_INTERFACE | Constants.ACC_STATIC,innerAccessFlags);
+//
+// // Is InnerClasses attribute well formed for the containing type?
+// jc = getClassFrom(ajc.getSandboxDirectory(), "example/aspect/FooAspect");
+// assertNotNull(jc);
+// attr = getAttributeStartsWith(jc.getAttributes(), "InnerClasses");
+// assertNotNull(attr);
+// innerClasses = (InnerClasses)attr;
+// innerClassArray = innerClasses.getInnerClasses();
+// assertEquals(1,innerClassArray.length);
+// innerClass = innerClassArray[0];
+// cp = jc.getConstantPool();
+// System.out.println(innerClass);
+//
+// // inner class name
+// innerClassIndex = innerClass.getInnerClassIndex();
+// cc = (ConstantClass)cp.getConstant(innerClassIndex);
+// utf8 = cp.getConstantUtf8(cc.getNameIndex());
+// assertEquals("example/aspect/FooAspect$ajcMightHaveAspect",utf8.getStringValue());
+//
+// // outer class name
+// outerClassIndex = innerClass.getOuterClassIndex();
+// cc = (ConstantClass)cp.getConstant(outerClassIndex);
+// utf8 = cp.getConstantUtf8(cc.getNameIndex());
+// assertEquals("example/aspect/FooAspect",utf8.getStringValue());
+//
+// // Simple name
+// innerNameIndex = innerClass.getInnerNameIndex();
+// utf8 = cp.getConstantUtf8(innerNameIndex);
+// assertEquals("ajcMightHaveAspect",utf8.getStringValue());
+//
+// // inner modifiers
+// innerAccessFlags = innerClass.getInnerAccessFlags();
+// assertEquals(Constants.ACC_ABSTRACT | Constants.ACC_INTERFACE | Constants.ACC_STATIC,innerAccessFlags);
+//
+// // Reflection work getDeclaredClasses?
+//
+// // What about other interfaces?
+ }
+
+
+
+// public void testOverweaving_352389() throws Exception {
+// runTest("overweaving");
+// }
+
+ // ---
+
+ public static Test suite() {
+ return XMLBasedAjcTestCase.loadSuite(Ajc1810Tests.class);
+ }
+
+ @Override
+ protected File getSpecFile() {
+ return getClassResource("ajc1810.xml");
+ }
+
+}
diff --git a/tests/src/test/java/org/aspectj/systemtest/ajc1810/AllTestsAspectJ1810.java b/tests/src/test/java/org/aspectj/systemtest/ajc1810/AllTestsAspectJ1810.java
new file mode 100644
index 000000000..b4fe6a8f3
--- /dev/null
+++ b/tests/src/test/java/org/aspectj/systemtest/ajc1810/AllTestsAspectJ1810.java
@@ -0,0 +1,25 @@
+/*******************************************************************************
+ * 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.ajc1810;
+
+import junit.framework.Test;
+import junit.framework.TestSuite;
+
+public class AllTestsAspectJ1810 {
+
+ public static Test suite() {
+ TestSuite suite = new TestSuite("AspectJ 1.8.10 tests");
+ // $JUnit-BEGIN$
+ suite.addTest(Ajc1810Tests.suite());
+ // $JUnit-END$
+ return suite;
+ }
+}
diff --git a/tests/src/test/java/org/aspectj/systemtest/ajc1810/ajc1810.xml b/tests/src/test/java/org/aspectj/systemtest/ajc1810/ajc1810.xml
new file mode 100644
index 000000000..0171f5b55
--- /dev/null
+++ b/tests/src/test/java/org/aspectj/systemtest/ajc1810/ajc1810.xml
@@ -0,0 +1,110 @@
+<!DOCTYPE suite SYSTEM "../tests/ajcTestSuite.dtd"[]>
+
+<suite>
+
+ <ajc-test dir="bugs1810/508661" title="various ltw">
+ <compile options="-1.8" files="CacheMethodResult.java A_yes.java B_no.java Run.java" outjar="classes.jar"/>
+ <compile options="-1.8 -Xlint:ignore" files="CacheMethodResultAspect.java" outjar="aspects.jar"/>
+ <run class="Run" ltw="aop.xml">
+ <stdout>
+ <line text="around: void A_yes.m()"/>
+ <line text="A_yes.m()"/>
+ <line text="A_yes has interface? CacheMethodResultAspect$ajcMightHaveAspect"/>
+ <line text="B_no.m()"/>
+ <line text="B_no has interface? no"/>
+ </stdout>
+ </run>
+ </ajc-test>
+
+ <ajc-test dir="bugs1810/500035" title="ataspectj binding">
+ <compile options="-1.8" files="Code.java"/>
+ <run class="Code">
+ <stdout>
+ <line text="targetObject = hello"/>
+ <line text="regex = l"/>
+ <line text="replacement = 7"/>
+ <line text="he7lo"/>
+ </stdout>
+ </run>
+ </ajc-test>
+
+ <ajc-test dir="bugs1810/500035" title="ataspectj binding 2">
+ <compile options="-1.8" files="Code2.java"/>
+ <run class="Code2">
+ <stdout>
+ <line text="targetObject = hello"/>
+ <line text="regex = l"/>
+ <line text="replacement = 8"/>
+ <line text="he8lo"/>
+ </stdout>
+ </run>
+ </ajc-test>
+
+ <ajc-test dir="bugs1810/500035" title="ataspectj binding 3 -XnoInline">
+ <compile options="-1.8 -XnoInline" files="Code3.java"/>
+ <run class="Code3">
+ <stdout>
+ <line text="first: binding target, just passing everything through: target=Foo(1)"/>
+ <line text="Executing run(abc) on Foo(i=1)"/>
+ <line text="second: binding this and target, just passing everything through: this=Foo(0) target=Foo(1)"/>
+ <line text="Executing run(abc) on Foo(i=1)"/>
+ <line text="third: binding this, just passing everything through: this=Foo(0)"/>
+ <line text="Executing run(abc) on Foo(i=1)"/>
+ <line text="fourth: binding this, switching from Foo(0) to Foo(3)"/>
+ <line text="Executing run(abc) on Foo(i=1)"/>
+ <line text="fifth: binding target, switching from Foo(1) to Foo(4)"/>
+ <line text="Executing run(abc) on Foo(i=4)"/>
+ <line text="sixth: binding this and target, switching them around (before this=Foo(0) target=Foo(1))"/>
+ <line text="Executing run(abc) on Foo(i=0)"/>
+ </stdout>
+ </run>
+ </ajc-test>
+
+ <ajc-test dir="bugs1810/500035" title="ataspectj binding 4">
+ <compile options="-1.8" files="Code3.java"/>
+ <run class="Code3">
+ <stdout>
+ <line text="first: binding target, just passing everything through: target=Foo(1)"/>
+ <line text="Executing run(abc) on Foo(i=1)"/>
+ <line text="second: binding this and target, just passing everything through: this=Foo(0) target=Foo(1)"/>
+ <line text="Executing run(abc) on Foo(i=1)"/>
+ <line text="third: binding this, just passing everything through: this=Foo(0)"/>
+ <line text="Executing run(abc) on Foo(i=1)"/>
+ <line text="fourth: binding this, switching from Foo(0) to Foo(3)"/>
+ <line text="Executing run(abc) on Foo(i=1)"/>
+ <line text="fifth: binding target, switching from Foo(1) to Foo(4)"/>
+ <line text="Executing run(abc) on Foo(i=4)"/>
+ <line text="sixth: binding this and target, switching them around (before this=Foo(0) target=Foo(1))"/>
+ <line text="Executing run(abc) on Foo(i=0)"/>
+ </stdout>
+ </run>
+ </ajc-test>
+
+ <ajc-test dir="bugs1810/501656" title="generics exception">
+ <compile options="-1.8 -parameters" files="ApplicationException.java ApplicationExceptionHandler.java"/>
+ </ajc-test>
+
+ <ajc-test dir="bugs1810/490315" title="indy">
+ <compile options="-1.8" files="FailingAspect.java SomeAnno.java SomeContext.java SomeCriteria.java SomeDTO.java SomeEnum.java SomePiece.java SomePropertyDTO.java SomeService.java SomeServiceImpl.java"/>
+ </ajc-test>
+
+ <ajc-test dir="bugs1810/493554" title="pertarget">
+ <compile options="-1.8" files="Dep.java FooAspect.aj Cmd.java"/>
+ <run class="example.kusedep.Cmd"></run>
+ </ajc-test>
+
+ <ajc-test dir="bugs1810/ambig" title="ambiguous message - 18">
+ <compile options="-1.8" files="X.java"/>
+ </ajc-test>
+
+ <ajc-test dir="bugs1810/ambig" title="ambiguous message - 17">
+ <compile options="-1.7" files="X.java"/>
+ </ajc-test>
+
+ <ajc-test dir="bugs1810/502807" title="unexpected aioobe">
+ <compile options="-1.8" files="TestCollectors.java">
+ <message kind="error" text="The method toList() in the type Collectors is not applicable for the arguments (Inner::getId)"/>
+ </compile>
+ </ajc-test>
+
+</suite>