aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorAndy Clement <aclement@pivotal.io>2018-05-25 12:51:25 -0700
committerAndy Clement <aclement@pivotal.io>2018-05-25 12:51:25 -0700
commit8c6b3ae13b105ce9bb9559de0ee4752cab5ba81c (patch)
tree7a6df8724f94ed5b5ba4cb21c79fee6260330715
parenta024df9675409344ecdf232d6ac3a283602323d5 (diff)
downloadaspectj-8c6b3ae13b105ce9bb9559de0ee4752cab5ba81c.tar.gz
aspectj-8c6b3ae13b105ce9bb9559de0ee4752cab5ba81c.zip
testcode for 535086
-rw-r--r--tests/bugs192/ptw/a/b/c/Code.java31
-rw-r--r--tests/bugs192/ptw/a/b/c/Code2.java7
-rw-r--r--tests/bugs192/ptw/a/b/c/Foo.java9
-rw-r--r--tests/bugs192/ptw/a/b/c/FooPrivileged.java9
-rw-r--r--tests/bugs192/ptw/a/b/d/Foo.java9
-rw-r--r--tests/bugs192/ptw/a/b/d/FooPrivileged.java9
-rw-r--r--tests/src/org/aspectj/systemtest/ajc192/Ajc192Tests.java51
-rw-r--r--tests/src/org/aspectj/systemtest/ajc192/AllTestsAspectJ192.java25
-rw-r--r--tests/src/org/aspectj/systemtest/ajc192/ajc192.xml74
9 files changed, 224 insertions, 0 deletions
diff --git a/tests/bugs192/ptw/a/b/c/Code.java b/tests/bugs192/ptw/a/b/c/Code.java
new file mode 100644
index 000000000..d46e1f49a
--- /dev/null
+++ b/tests/bugs192/ptw/a/b/c/Code.java
@@ -0,0 +1,31 @@
+package a.b.c;
+
+public class Code {
+ public static void main(String []argv) {
+ new Code().new PublicInner().run();
+ new Code().new DefaultInner().run();
+ new Code().new PrivateInner().run();
+ }
+
+ public class PublicInner implements Runnable {
+ public void run() {
+ System.out.println("PublicInner.run()");
+ }
+ }
+
+ class DefaultInner implements Runnable {
+ public void run() {
+ System.out.println("DefaultInner.run()");
+ }
+ }
+
+ private class PrivateInner implements Runnable {
+ public void run() {
+ System.out.println("PrivateInner.run()");
+ }
+ }
+
+ public void run() {
+ System.out.println("Code (outer public class).run()");
+ }
+}
diff --git a/tests/bugs192/ptw/a/b/c/Code2.java b/tests/bugs192/ptw/a/b/c/Code2.java
new file mode 100644
index 000000000..aa87e31c3
--- /dev/null
+++ b/tests/bugs192/ptw/a/b/c/Code2.java
@@ -0,0 +1,7 @@
+//package a.b.c;
+//
+//class Code2 implements Runnable {
+// public void run() {
+// System.out.println("Code2.run()");
+// }
+//}
diff --git a/tests/bugs192/ptw/a/b/c/Foo.java b/tests/bugs192/ptw/a/b/c/Foo.java
new file mode 100644
index 000000000..5b37208fd
--- /dev/null
+++ b/tests/bugs192/ptw/a/b/c/Foo.java
@@ -0,0 +1,9 @@
+package a.b.c;
+
+aspect Foo pertypewithin(Runnable+) {
+ after() : staticinitialization(*) {
+ System.out.println(thisJoinPointStaticPart+" getWithinTypeName() = " + getWithinTypeName());
+ Class c = thisJoinPointStaticPart.getSourceLocation().getWithinType();
+ System.out.println(thisJoinPointStaticPart+" aspectOf("+c.getName()+") = "+Foo.aspectOf(c).getClass().getName());
+ }
+}
diff --git a/tests/bugs192/ptw/a/b/c/FooPrivileged.java b/tests/bugs192/ptw/a/b/c/FooPrivileged.java
new file mode 100644
index 000000000..e55128344
--- /dev/null
+++ b/tests/bugs192/ptw/a/b/c/FooPrivileged.java
@@ -0,0 +1,9 @@
+package a.b.c;
+
+privileged aspect Foo pertypewithin(Runnable+) {
+ after() : staticinitialization(*) {
+ System.out.println(thisJoinPointStaticPart+" getWithinTypeName() = " + getWithinTypeName());
+ Class c = thisJoinPointStaticPart.getSourceLocation().getWithinType();
+ System.out.println(thisJoinPointStaticPart+" aspectOf("+c.getName()+") = "+Foo.aspectOf(c).getClass().getName());
+ }
+}
diff --git a/tests/bugs192/ptw/a/b/d/Foo.java b/tests/bugs192/ptw/a/b/d/Foo.java
new file mode 100644
index 000000000..0a0cc2d33
--- /dev/null
+++ b/tests/bugs192/ptw/a/b/d/Foo.java
@@ -0,0 +1,9 @@
+package a.b.d;
+
+aspect Foo pertypewithin(Runnable+) {
+ after() : staticinitialization(*) {
+ System.out.println(thisJoinPointStaticPart+" getWithinTypeName() = " + getWithinTypeName());
+ Class c = thisJoinPointStaticPart.getSourceLocation().getWithinType();
+ System.out.println(thisJoinPointStaticPart+" aspectOf("+c.getName()+") = "+Foo.aspectOf(c).getClass().getName());
+ }
+}
diff --git a/tests/bugs192/ptw/a/b/d/FooPrivileged.java b/tests/bugs192/ptw/a/b/d/FooPrivileged.java
new file mode 100644
index 000000000..006b95590
--- /dev/null
+++ b/tests/bugs192/ptw/a/b/d/FooPrivileged.java
@@ -0,0 +1,9 @@
+package a.b.d;
+
+privileged aspect Foo pertypewithin(Runnable+) {
+ after() : staticinitialization(*) {
+ System.out.println("getWithinTypeName() = " + getWithinTypeName());
+ Class c = thisJoinPointStaticPart.getSourceLocation().getWithinType();
+ System.out.println("Aspect instance = "+Foo.aspectOf(c).getClass().getName());
+ }
+}
diff --git a/tests/src/org/aspectj/systemtest/ajc192/Ajc192Tests.java b/tests/src/org/aspectj/systemtest/ajc192/Ajc192Tests.java
new file mode 100644
index 000000000..989d74b2d
--- /dev/null
+++ b/tests/src/org/aspectj/systemtest/ajc192/Ajc192Tests.java
@@ -0,0 +1,51 @@
+/*******************************************************************************
+ * Copyright (c) 2018 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.ajc192;
+
+import java.io.File;
+
+import org.aspectj.testing.XMLBasedAjcTestCase;
+
+import junit.framework.Test;
+
+/**
+ * @author Andy Clement
+ */
+public class Ajc192Tests extends XMLBasedAjcTestCase {
+
+ public void testPTW_nonPrivileged() {
+ runTest("ptw");
+ }
+
+ public void testPTW_nonPrivilegedSamePackage() {
+ runTest("ptw - same package");
+ }
+
+ public void testPTW_privileged() {
+ runTest("ptw - privileged");
+ }
+
+ public void testPTWW_privilegedSamePackage() {
+ runTest("ptw - privileged same package");
+ }
+
+ // ---
+
+ public static Test suite() {
+ return XMLBasedAjcTestCase.loadSuite(Ajc192Tests.class);
+ }
+
+ @Override
+ protected File getSpecFile() {
+ return getClassResource("ajc192.xml");
+ }
+
+}
diff --git a/tests/src/org/aspectj/systemtest/ajc192/AllTestsAspectJ192.java b/tests/src/org/aspectj/systemtest/ajc192/AllTestsAspectJ192.java
new file mode 100644
index 000000000..396caafff
--- /dev/null
+++ b/tests/src/org/aspectj/systemtest/ajc192/AllTestsAspectJ192.java
@@ -0,0 +1,25 @@
+/*******************************************************************************
+ * Copyright (c) 2018 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.ajc192;
+
+import junit.framework.Test;
+import junit.framework.TestSuite;
+
+public class AllTestsAspectJ192 {
+
+ public static Test suite() {
+ TestSuite suite = new TestSuite("AspectJ 1.9.2 tests");
+ // $JUnit-BEGIN$
+ suite.addTest(Ajc192Tests.suite());
+ // $JUnit-END$
+ return suite;
+ }
+}
diff --git a/tests/src/org/aspectj/systemtest/ajc192/ajc192.xml b/tests/src/org/aspectj/systemtest/ajc192/ajc192.xml
new file mode 100644
index 000000000..13e0ae9c1
--- /dev/null
+++ b/tests/src/org/aspectj/systemtest/ajc192/ajc192.xml
@@ -0,0 +1,74 @@
+<!DOCTYPE suite SYSTEM "../tests/ajcTestSuite.dtd"[]>
+
+<suite>
+
+ <ajc-test dir="bugs192/ptw" title="ptw">
+ <compile files="a/b/c/Code.java a/b/d/Foo.java" options="-8">
+ </compile>
+ <run class="a.b.c.Code">
+ <stdout>
+ <line text="staticinitialization(a.b.c.Code.PublicInner.&lt;clinit&gt;) getWithinTypeName() = a.b.c.Code$PublicInner"/>
+ <line text="staticinitialization(a.b.c.Code.PublicInner.&lt;clinit&gt;) aspectOf(a.b.c.Code$PublicInner) = a.b.d.Foo"/>
+ <line text="PublicInner.run()"/>
+ <line text="DefaultInner.run()"/>
+ <line text="PrivateInner.run()"/>
+ </stdout>
+ </run>
+ </ajc-test>
+
+ <ajc-test dir="bugs192/ptw" title="ptw - same package">
+ <compile files="a/b/c/Code.java a/b/c/Foo.java" options="-8">
+ </compile>
+ <run class="a.b.c.Code">
+ <stdout>
+ <line text="staticinitialization(a.b.c.Code.PublicInner.&lt;clinit&gt;) getWithinTypeName() = a.b.c.Code$PublicInner"/>
+ <line text="staticinitialization(a.b.c.Code.PublicInner.&lt;clinit&gt;) aspectOf(a.b.c.Code$PublicInner) = a.b.c.Foo"/>
+ <line text="PublicInner.run()"/>
+ <line text="staticinitialization(a.b.c.Code.DefaultInner.&lt;clinit&gt;) getWithinTypeName() = a.b.c.Code$DefaultInner"/>
+ <line text="staticinitialization(a.b.c.Code.DefaultInner.&lt;clinit&gt;) aspectOf(a.b.c.Code$DefaultInner) = a.b.c.Foo"/>
+ <line text="DefaultInner.run()"/>
+ <line text="staticinitialization(a.b.c.Code.PrivateInner.&lt;clinit&gt;) getWithinTypeName() = a.b.c.Code$PrivateInner"/>
+ <line text="staticinitialization(a.b.c.Code.PrivateInner.&lt;clinit&gt;) aspectOf(a.b.c.Code$PrivateInner) = a.b.c.Foo"/>
+ <line text="PrivateInner.run()"/>
+ </stdout>
+ </run>
+ </ajc-test>
+
+
+ <ajc-test dir="bugs192/ptw" title="ptw - privileged">
+ <compile files="a/b/c/Code.java a/b/d/FooPrivileged.java" options="-8">
+ </compile>
+ <run class="a.b.c.Code">
+ <stdout>
+ <line text="getWithinTypeName() = a.b.c.Code$PublicInner"/>
+ <line text="Aspect instance = a.b.d.Foo"/>
+ <line text="PublicInner.run()"/>
+ <line text="getWithinTypeName() = a.b.c.Code$DefaultInner"/>
+ <line text="Aspect instance = a.b.d.Foo"/>
+ <line text="DefaultInner.run()"/>
+ <line text="getWithinTypeName() = a.b.c.Code$PrivateInner"/>
+ <line text="Aspect instance = a.b.d.Foo"/>
+ <line text="PrivateInner.run()"/>
+ </stdout>
+ </run>
+ </ajc-test>
+
+ <ajc-test dir="bugs192/ptw" title="ptw - privileged same package">
+ <compile files="a/b/c/Code.java a/b/c/FooPrivileged.java" options="-8">
+ </compile>
+ <run class="a.b.c.Code">
+ <stdout>
+ <line text="staticinitialization(a.b.c.Code.PublicInner.&lt;clinit&gt;) getWithinTypeName() = a.b.c.Code$PublicInner"/>
+ <line text="staticinitialization(a.b.c.Code.PublicInner.&lt;clinit&gt;) aspectOf(a.b.c.Code$PublicInner) = a.b.c.Foo"/>
+ <line text="PublicInner.run()"/>
+ <line text="staticinitialization(a.b.c.Code.DefaultInner.&lt;clinit&gt;) getWithinTypeName() = a.b.c.Code$DefaultInner"/>
+ <line text="staticinitialization(a.b.c.Code.DefaultInner.&lt;clinit&gt;) aspectOf(a.b.c.Code$DefaultInner) = a.b.c.Foo"/>
+ <line text="DefaultInner.run()"/>
+ <line text="staticinitialization(a.b.c.Code.PrivateInner.&lt;clinit&gt;) getWithinTypeName() = a.b.c.Code$PrivateInner"/>
+ <line text="staticinitialization(a.b.c.Code.PrivateInner.&lt;clinit&gt;) aspectOf(a.b.c.Code$PrivateInner) = a.b.c.Foo"/>
+ <line text="PrivateInner.run()"/>
+ </stdout>
+ </run>
+ </ajc-test>
+
+</suite>
o">)*> <!ELEMENT b (#PCDATA | em)*> <!-- We also allow for hyperlinks in text (e.g., to include references to supporting evidence within SPECPROBLEM and TESTPROBLEM). --> <!ELEMENT a (#PCDATA | b | em)*> <!ATTLIST a href %URI; #REQUIRED > <!-- The TESTRESULT element is used to record test results. It has a required ID attribute which identifies the TEST. It has a required AGREEMENT attribute that indicates whether the results are in full agreement with the expected results as described in the TEST case or not. The textual contents of the TESTRESULT element should describe the results of the test and any issues or further information. The target of the optional RESULTS attribute could be either some PDF showing the results or any other arbitrary resource describing/discussing the results. The optional FUTURESUPPORT attribute is used to indicate expected future support of the feature tested by this test case. The optional SPECPROBLEM attribute indicates if there is any ambiguity or other problem found in the spec that relates to this test. Especially if the results weren't as expected because of a misinterpretation of the spec, this should be documented here. Details/discussion should appear in the textual contents of the TESTRESULT element. The optional TESTPROBLEM attribute indicates if there is any issue with the TEST case and the expected results it suggests. Especially if the results of the test differ from that given as "expected" by the test case but are, in fact, believed to be the correct results, this should be documented here. Details/discussion should appear in the textual contents of the TESTRESULT element. --> <!ELEMENT testresult %text;> <!ATTLIST testresult id CDATA #REQUIRED agreement (full|issues) #REQUIRED results %URI; #IMPLIED futuresupport (full|partial|none) #IMPLIED specproblem (yes|no) "no" testproblem (yes|no) "no" >