aboutsummaryrefslogtreecommitdiffstats
path: root/tests
diff options
context:
space:
mode:
authorAndy Clement <aclement@pivotal.io>2016-12-09 09:04:56 -0800
committerAndy Clement <aclement@pivotal.io>2016-12-09 09:04:56 -0800
commit90aa179e2c0b2870d8678f8e9948bf631840c93b (patch)
tree764b680f72a92865d58c604e62cce37a57920378 /tests
parent2365f957eea267377b703d6c35e678d55a87ae2d (diff)
downloadaspectj-90aa179e2c0b2870d8678f8e9948bf631840c93b.tar.gz
aspectj-90aa179e2c0b2870d8678f8e9948bf631840c93b.zip
508661: testcode
Diffstat (limited to 'tests')
-rw-r--r--tests/bugs1810/508661/A_yes.java8
-rw-r--r--tests/bugs1810/508661/B_no.java7
-rw-r--r--tests/bugs1810/508661/CacheMethodResult.java4
-rw-r--r--tests/bugs1810/508661/CacheMethodResultAspect.java10
-rw-r--r--tests/bugs1810/508661/Run.java6
-rw-r--r--tests/bugs1810/508661/aop.xml10
-rw-r--r--tests/src/org/aspectj/systemtest/ajc1810/Ajc1810Tests.java4
-rw-r--r--tests/src/org/aspectj/systemtest/ajc1810/ajc1810.xml14
8 files changed, 63 insertions, 0 deletions
diff --git a/tests/bugs1810/508661/A_yes.java b/tests/bugs1810/508661/A_yes.java
new file mode 100644
index 000000000..9920f069a
--- /dev/null
+++ b/tests/bugs1810/508661/A_yes.java
@@ -0,0 +1,8 @@
+public class A_yes {
+ @CacheMethodResult
+ public void m() {
+ System.out.println("A_yes.m()");
+ Class[] itfs = A_yes.class.getInterfaces();
+ System.out.println("A_yes has interface? "+((itfs==null||itfs.length==0)?"no":itfs[0].getName()));
+ }
+}
diff --git a/tests/bugs1810/508661/B_no.java b/tests/bugs1810/508661/B_no.java
new file mode 100644
index 000000000..e65d63377
--- /dev/null
+++ b/tests/bugs1810/508661/B_no.java
@@ -0,0 +1,7 @@
+class B_no {
+ public void m() {
+ System.out.println("B_no.m()");
+ Class[] itfs = B_no.class.getInterfaces();
+ System.out.println("B_no has interface? "+((itfs==null||itfs.length==0)?"no":itfs[0].getName()));
+ }
+}
diff --git a/tests/bugs1810/508661/CacheMethodResult.java b/tests/bugs1810/508661/CacheMethodResult.java
new file mode 100644
index 000000000..fd919bd5b
--- /dev/null
+++ b/tests/bugs1810/508661/CacheMethodResult.java
@@ -0,0 +1,4 @@
+import java.lang.annotation.*;
+
+@Retention(RetentionPolicy.RUNTIME)
+@interface CacheMethodResult {}
diff --git a/tests/bugs1810/508661/CacheMethodResultAspect.java b/tests/bugs1810/508661/CacheMethodResultAspect.java
new file mode 100644
index 000000000..d7626a917
--- /dev/null
+++ b/tests/bugs1810/508661/CacheMethodResultAspect.java
@@ -0,0 +1,10 @@
+aspect CacheMethodResultAspect perthis(cache()) {
+
+ pointcut cache() : execution(@CacheMethodResult * *.*(..));
+
+ Object around() : cache() {
+ System.out.println("around: "+thisJoinPointStaticPart.getSignature());
+ return proceed();
+ }
+}
+
diff --git a/tests/bugs1810/508661/Run.java b/tests/bugs1810/508661/Run.java
new file mode 100644
index 000000000..176e5a499
--- /dev/null
+++ b/tests/bugs1810/508661/Run.java
@@ -0,0 +1,6 @@
+public class Run {
+ public static void main(String []argv) {
+ new A_yes().m();
+ new B_no().m();
+ }
+}
diff --git a/tests/bugs1810/508661/aop.xml b/tests/bugs1810/508661/aop.xml
new file mode 100644
index 000000000..5b89e6614
--- /dev/null
+++ b/tests/bugs1810/508661/aop.xml
@@ -0,0 +1,10 @@
+<!DOCTYPE aspectj PUBLIC "-//AspectJ//DTD//EN" "http://www.eclipse.org/aspectj/dtd/aspectj.dtd">
+<aspectj>
+ <weaver>
+ </weaver>
+
+ <aspects>
+ <aspect name="CacheMethodResultAspect" />
+ </aspects>
+
+</aspectj>
diff --git a/tests/src/org/aspectj/systemtest/ajc1810/Ajc1810Tests.java b/tests/src/org/aspectj/systemtest/ajc1810/Ajc1810Tests.java
index 3cae1378c..37896b42f 100644
--- a/tests/src/org/aspectj/systemtest/ajc1810/Ajc1810Tests.java
+++ b/tests/src/org/aspectj/systemtest/ajc1810/Ajc1810Tests.java
@@ -24,6 +24,10 @@ import junit.framework.Test;
*/
public class Ajc1810Tests extends org.aspectj.testing.XMLBasedAjcTestCase {
+ public void testBinding_508661() {
+ runTest("various ltw");
+ }
+
public void testBinding_500035() {
runTest("ataspectj binding");
}
diff --git a/tests/src/org/aspectj/systemtest/ajc1810/ajc1810.xml b/tests/src/org/aspectj/systemtest/ajc1810/ajc1810.xml
index 7485c1c20..0171f5b55 100644
--- a/tests/src/org/aspectj/systemtest/ajc1810/ajc1810.xml
+++ b/tests/src/org/aspectj/systemtest/ajc1810/ajc1810.xml
@@ -2,6 +2,20 @@
<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">