]> source.dussan.org Git - aspectj.git/commitdiff
354470
authoraclement <aclement>
Wed, 14 Sep 2011 00:04:38 +0000 (00:04 +0000)
committeraclement <aclement>
Wed, 14 Sep 2011 00:04:38 +0000 (00:04 +0000)
tests/bugs1612/pr354470/Code.java [new file with mode: 0644]
tests/bugs1612/pr354470/Code2.java [new file with mode: 0644]
tests/bugs1612/pr354470/Code3.java [new file with mode: 0644]
tests/src/org/aspectj/systemtest/ajc1612/Ajc1612Tests.java
tests/src/org/aspectj/systemtest/ajc1612/ajc1612.xml

diff --git a/tests/bugs1612/pr354470/Code.java b/tests/bugs1612/pr354470/Code.java
new file mode 100644 (file)
index 0000000..0449662
--- /dev/null
@@ -0,0 +1,48 @@
+import org.aspectj.lang.annotation.*;
+import java.lang.annotation.*;
+import java.lang.reflect.*;
+
+@Aspect("perthis(transactional())")
+public class Code {
+   @Pointcut("execution(@Transactional * * (..))")
+   public void transactional() { }
+   
+   public static void main(String[] args) {
+          print(AAA.class);
+          print(BBB.class);
+          print(CCC.class);
+   }
+   
+   public static void print(Class clazz) {
+          System.out.println(clazz.getName());
+          Class[] ifs = clazz.getInterfaces();
+          if (ifs!=null) {
+                  for (int i=0;i<ifs.length;i++) {
+                          System.out.println(ifs[i]);
+                  }
+          }
+          Field[] fs = clazz.getDeclaredFields();
+          if (fs!=null) {
+                  for (int i=0;i<fs.length;i++) {
+                          System.out.println(fs[i]);
+                  }
+          }
+   }
+}
+
+class AAA { 
+  public void m() { }
+}
+
+class BBB { 
+  public void m() { }
+}
+
+class CCC {
+  @Transactional
+  public void m() { }
+}
+
+
+@Retention(RetentionPolicy.RUNTIME) @interface Transactional {}
+
diff --git a/tests/bugs1612/pr354470/Code2.java b/tests/bugs1612/pr354470/Code2.java
new file mode 100644 (file)
index 0000000..1cc1ea4
--- /dev/null
@@ -0,0 +1,39 @@
+import org.aspectj.lang.annotation.*;
+import java.lang.annotation.*;
+import java.lang.reflect.*;
+import org.aspectj.lang.*;
+
+@Aspect("perthis(transactional())")
+public class Code2 {
+   @Pointcut("execution(@Transactional * * (..))")
+   public void transactional() { }
+   
+   @Before("execution(* *(..))")
+   public void m(JoinPoint.StaticPart thisJoinPointStaticPart) {
+     System.out.println(thisJoinPointStaticPart);
+     }
+   
+   public static void main(String[] args) {
+     new AAA().m();
+     new BBB().m();
+     new CCC().m();
+   }
+  
+}
+
+class AAA { 
+  public void m() { }
+}
+
+class BBB { 
+  public void m() { }
+}
+
+class CCC {
+  @Transactional
+  public void m() { }
+}
+
+
+@Retention(RetentionPolicy.RUNTIME) @interface Transactional {}
+
diff --git a/tests/bugs1612/pr354470/Code3.java b/tests/bugs1612/pr354470/Code3.java
new file mode 100644 (file)
index 0000000..7199b68
--- /dev/null
@@ -0,0 +1,41 @@
+import org.aspectj.lang.annotation.*;
+import java.lang.annotation.*;
+import java.lang.reflect.*;
+import org.aspectj.lang.*;
+
+@Aspect("perthis(transactional())")
+public class Code3 {
+   @Pointcut("execution(@Transactional * * (..))")
+   public void transactional() { }
+   
+   @Before("execution(* *(..))")
+   public void m(JoinPoint.StaticPart thisJoinPointStaticPart) {
+     System.out.println(thisJoinPointStaticPart);
+     }
+   
+   public static void main(String[] args) {
+     new AAA().m();
+     new BBB().m();
+     new CCC().m();
+   }
+  
+}
+
+aspect XXX {
+       @Transactional public void CCC.m() {}
+}
+
+class AAA { 
+  public void m() { }
+}
+
+class BBB { 
+  public void m() { }
+}
+
+class CCC {
+}
+
+
+@Retention(RetentionPolicy.RUNTIME) @interface Transactional {}
+
index 27f6c58ae3bad66ffd9fa2de66de66d062a98366..43c638702f5877fb4fbb744eeb2362fee5f4b04c 100644 (file)
@@ -35,6 +35,18 @@ public class Ajc1612Tests extends org.aspectj.testing.XMLBasedAjcTestCase {
        // runTest("itd split compilation");
        // }
 
+       public void testPervasivePerthis_354470() throws Exception {
+               runTest("perthis too pervasive");
+       }
+
+       public void testPervasivePerthis_354470_2() throws Exception {
+               runTest("perthis too pervasive 2");
+       }
+
+       public void testPervasivePerthis_354470_3() throws Exception {
+               runTest("perthis too pervasive 3");
+       }
+
        public void testNotEqualWithAnnotationValues_357013() throws Exception {
                runTest("annotation values not equal");
        }
index b54f5e85572f98a9a734b7ff98026852e342b5f8..f37b8834eadd57a178c7e361f9958beaebb0b13d 100644 (file)
@@ -2,6 +2,34 @@
 
 <suite>
 
+<ajc-test dir="bugs1612/pr354470" title="perthis too pervasive">
+<compile files="Code.java" options="-1.5"/>
+<run class="Code">
+<stdout>
+       <line text="AAA"/>
+       <line text="BBB"/>
+       <line text="CCC"/>
+       <line text="interface Code$ajcMightHaveAspect"/>
+       <line text="private transient Code CCC.ajc$Code$perObjectField"/>
+</stdout></run>
+</ajc-test>
+
+<ajc-test dir="bugs1612/pr354470" title="perthis too pervasive 2">
+<compile files="Code2.java" options="-1.5"/>
+<run class="Code2">
+<stdout>
+       <line text="execution(void CCC.m())"/>
+</stdout></run>
+</ajc-test>
+
+<ajc-test dir="bugs1612/pr354470" title="perthis too pervasive 3">
+<compile files="Code3.java" options="-1.5"/>
+<run class="Code3">
+<stdout>
+       <line text="execution(void CCC.m())"/>
+</stdout></run>
+</ajc-test>
+
 <ajc-test dir="bugs1612/prx" title="class reference in annotation value">
 <compile files="C.java" options="-1.5 -showWeaveInfo">
 <message kind="weave" text="Join point 'field-get(int C.i)' in Type 'C' (C.java:17) advised by before advice from 'X' (C.java:22)"/>