aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authoraclement <aclement>2006-05-30 09:30:01 +0000
committeraclement <aclement>2006-05-30 09:30:01 +0000
commit7235e9d089fa2b12b835cbaab7c253cb1de0b563 (patch)
tree1f7de35ee9fd95e98d109c46239a891985acc0ee
parent91f54fd96f209fe138228040673a59f9cf210a92 (diff)
downloadaspectj-7235e9d089fa2b12b835cbaab7c253cb1de0b563.tar.gz
aspectj-7235e9d089fa2b12b835cbaab7c253cb1de0b563.zip
tests for 122253
-rw-r--r--tests/bugs152/pr122253/PerCflow.java28
-rw-r--r--tests/bugs152/pr122253/PerThis.java37
-rw-r--r--tests/bugs152/pr122253/PerTypeWithin.java41
-rw-r--r--tests/bugs152/pr122253/Singleton.java27
-rw-r--r--tests/src/org/aspectj/systemtest/ajc152/ajc152.xml64
5 files changed, 197 insertions, 0 deletions
diff --git a/tests/bugs152/pr122253/PerCflow.java b/tests/bugs152/pr122253/PerCflow.java
new file mode 100644
index 000000000..08ef3ca04
--- /dev/null
+++ b/tests/bugs152/pr122253/PerCflow.java
@@ -0,0 +1,28 @@
+import org.aspectj.lang.*;
+
+public aspect PerCflow percflow(execution(* m(..))) {
+
+ before(): execution(* Foo.*(..)) {}
+
+ public static void main(String []argv) {
+ print("before");
+ new Foo().m();
+ print("after");
+ }
+
+ public static void print(String prefix) {
+ System.err.println(prefix);
+ boolean b1 = Aspects14.hasAspect(PerCflow.class);
+ boolean b2 = PerCflow.hasAspect();
+ Object o1 = (b1?Aspects14.aspectOf(PerCflow.class):null);
+ Object o2 = (b2?PerCflow.aspectOf():null);
+ System.err.println("hasAspect? "+b1+" : "+b2);
+ System.err.println("aspectOf? "+o1+" : "+o2);
+ }
+
+ public String toString() { return "PerCflowInstance"; }
+}
+
+class Foo {
+ public void m() { PerCflow.print("during");}
+}
diff --git a/tests/bugs152/pr122253/PerThis.java b/tests/bugs152/pr122253/PerThis.java
new file mode 100644
index 000000000..2079c8185
--- /dev/null
+++ b/tests/bugs152/pr122253/PerThis.java
@@ -0,0 +1,37 @@
+import org.aspectj.lang.*;
+
+public aspect PerThis perthis(execution(* m(..))) {
+
+ before(): execution(* Foo.*(..)) {}
+
+ public static void main(String []argv) {
+ print("before");
+ new Foo().m();
+ print("after");
+ }
+
+ public static void print(String prefix) {
+ System.err.println(prefix);
+ boolean b1 = Aspects14.hasAspect(PerThis.class,null);
+ boolean b2 = PerThis.hasAspect(null);
+ Object o1 = (b1?Aspects14.aspectOf(PerThis.class,null):null);
+ Object o2 = (b2?PerThis.aspectOf(null):null);
+ System.err.println("hasAspect? "+b1+" : "+b2);
+ System.err.println("aspectOf? "+o1+" : "+o2);
+ }
+
+ public String toString() { return "PerThisInstance"; }
+}
+
+class Foo {
+ public void m() { print("during");}
+ public void print(String prefix) {
+ System.err.println(prefix);
+ boolean b1 = Aspects14.hasAspect(PerThis.class,this);
+ boolean b2 = PerThis.hasAspect(this);
+ Object o1 = (b1?Aspects14.aspectOf(PerThis.class,this):null);
+ Object o2 = (b2?PerThis.aspectOf(this):null);
+ System.err.println("hasAspect? "+b1+" : "+b2);
+ System.err.println("aspectOf? "+o1+" : "+o2);
+ }
+}
diff --git a/tests/bugs152/pr122253/PerTypeWithin.java b/tests/bugs152/pr122253/PerTypeWithin.java
new file mode 100644
index 000000000..b7f75c7ca
--- /dev/null
+++ b/tests/bugs152/pr122253/PerTypeWithin.java
@@ -0,0 +1,41 @@
+import org.aspectj.lang.*;
+
+public aspect PerTypeWithin pertypewithin(Foo) {
+
+ before(): execution(* Foo.*(..)) {}
+
+ public static void main(String []argv) {
+ print("before");
+ new Foo().m();
+ print("after");
+ }
+
+ public static void print(String prefix) {
+ System.err.println(prefix);
+ boolean b1 = Aspects14.hasAspect(PerTypeWithin.class,Goo.class);
+ boolean b2 = PerTypeWithin.hasAspect(Goo.class);
+ Object o1 = (b1?Aspects14.aspectOf(PerTypeWithin.class,Goo.class):null);
+ Object o2 = (b2?PerTypeWithin.aspectOf(Goo.class):null);
+ System.err.println("hasAspect? "+b1+" : "+b2);
+ System.err.println("aspectOf? "+o1+" : "+o2);
+ }
+
+ public String toString() { return "PerTypeWithinInstance"; }
+}
+
+class Goo {
+
+}
+
+class Foo {
+ public void m() { print("during");}
+ public void print(String prefix) {
+ System.err.println(prefix);
+ boolean b1 = Aspects14.hasAspect(PerTypeWithin.class,this.getClass());
+ boolean b2 = PerTypeWithin.hasAspect(this.getClass());
+ Object o1 = (b1?Aspects14.aspectOf(PerTypeWithin.class,this.getClass()):null);
+ Object o2 = (b2?PerTypeWithin.aspectOf(this.getClass()):null);
+ System.err.println("hasAspect? "+b1+" : "+b2);
+ System.err.println("aspectOf? "+o1+" : "+o2);
+ }
+}
diff --git a/tests/bugs152/pr122253/Singleton.java b/tests/bugs152/pr122253/Singleton.java
new file mode 100644
index 000000000..e28ec25d8
--- /dev/null
+++ b/tests/bugs152/pr122253/Singleton.java
@@ -0,0 +1,27 @@
+import org.aspectj.lang.*;
+
+public aspect Singleton {
+
+ before(): execution(* Foo.*(..)) {}
+
+ public static void main(String []argv) {
+ print();
+ new Foo().m();
+ print();
+ }
+
+ public static void print() {
+ boolean b1 = Aspects14.hasAspect(Singleton.class);
+ boolean b2 = Singleton.hasAspect();
+ Object o1 = (b1?Aspects14.aspectOf(Singleton.class):null);
+ Object o2 = (b2?Singleton.aspectOf():null);
+ System.err.println("hasAspect? "+b1+" : "+b2);
+ System.err.println("aspectOf? "+o1+" : "+o2);
+ }
+
+ public String toString() { return "SingletonInstance"; }
+}
+
+class Foo {
+ public void m() { }
+}
diff --git a/tests/src/org/aspectj/systemtest/ajc152/ajc152.xml b/tests/src/org/aspectj/systemtest/ajc152/ajc152.xml
index 18111ec69..4230c07f9 100644
--- a/tests/src/org/aspectj/systemtest/ajc152/ajc152.xml
+++ b/tests/src/org/aspectj/systemtest/ajc152/ajc152.xml
@@ -14,6 +14,70 @@
</stderr>
</run>
</ajc-test>
+
+ <ajc-test dir="bugs152/pr122253" title="aspects14 - persingleton">
+ <compile files="Singleton.java"/>
+ <run class="Singleton">
+ <stderr>
+ <line text="hasAspect? true : true"/>
+ <line text="aspectOf? SingletonInstance : SingletonInstance"/>
+ <line text="hasAspect? true : true"/>
+ <line text="aspectOf? SingletonInstance : SingletonInstance"/>
+ </stderr>
+ </run>
+ </ajc-test>
+
+ <ajc-test dir="bugs152/pr122253" title="aspects14 - percflow">
+ <compile files="PerCflow.java"/>
+ <run class="PerCflow">
+ <stderr>
+ <line text="before"/>
+ <line text="hasAspect? false : false"/>
+ <line text="aspectOf? null : null"/>
+ <line text="during"/>
+ <line text="hasAspect? true : true"/>
+ <line text="aspectOf? PerCflowInstance : PerCflowInstance"/>
+ <line text="after"/>
+ <line text="hasAspect? false : false"/>
+ <line text="aspectOf? null : null"/>
+ </stderr>
+ </run>
+ </ajc-test>
+
+ <ajc-test dir="bugs152/pr122253" title="aspects14 - perthis">
+ <compile files="PerThis.java"/>
+ <run class="PerThis">
+ <stderr>
+ <line text="before"/>
+ <line text="hasAspect? false : false"/>
+ <line text="aspectOf? null : null"/>
+ <line text="during"/>
+ <line text="hasAspect? true : true"/>
+ <line text="aspectOf? PerThisInstance : PerThisInstance"/>
+ <line text="after"/>
+ <line text="hasAspect? false : false"/>
+ <line text="aspectOf? null : null"/>
+ </stderr>
+ </run>
+ </ajc-test>
+
+ <ajc-test dir="bugs152/pr122253" title="aspects14 - pertypewithin">
+ <compile files="PerTypeWithin.java"/>
+ <run class="PerTypeWithin">
+ <stderr>
+ <line text="before"/>
+ <line text="hasAspect? false : false"/>
+ <line text="aspectOf? null : null"/>
+ <line text="during"/>
+ <line text="hasAspect? true : true"/>
+ <line text="aspectOf? PerTypeWithinInstance : PerTypeWithinInstance"/>
+ <line text="after"/>
+ <line text="hasAspect? false : false"/>
+ <line text="aspectOf? null : null"/>
+ </stderr>
+ </run>
+ </ajc-test>
+
<ajc-test dir="bugs152/pr126355" title="bizarre generic error with itds">
<compile files="Pair.java" options="-1.5"/>