From: aclement Date: Fri, 12 Aug 2011 17:39:57 +0000 (+0000) Subject: 239649 X-Git-Tag: V1_6_12M2~25 X-Git-Url: https://source.dussan.org/?a=commitdiff_plain;h=22b6f012cb3c2b03b77d043a6234583bf2a417a2;p=aspectj.git 239649 --- diff --git a/tests/bugs1612/pr239649/Eight.java b/tests/bugs1612/pr239649/Eight.java new file mode 100644 index 000000000..5103f72a7 --- /dev/null +++ b/tests/bugs1612/pr239649/Eight.java @@ -0,0 +1,27 @@ +public class Eight { + public static void main(String[] argv) { + Eight a = new Eight(); + a.m(); + } + + public void m() { + System.out.println("Method m() running"); + } +} + +abstract aspect Y { + abstract pointcut p(); + before(): execution(* m(..)) && p() { + System.out.println("In advice()"); + } +} + +aspect X extends Y { + pointcut p(): if(thisAspectInstance.doit()); + + boolean doit() { + System.out.println("in doit(): class="+this.getClass().getName()); + return true; + } + +} diff --git a/tests/bugs1612/pr239649/Eleven.java b/tests/bugs1612/pr239649/Eleven.java new file mode 100644 index 000000000..fc771f4af --- /dev/null +++ b/tests/bugs1612/pr239649/Eleven.java @@ -0,0 +1,22 @@ +public class Eleven { + public static void main(String[] argv) { + Eleven a = new Eleven(); + a.m(); + } + + public void m() { + System.out.println("Method m() running"); + } +} + +aspect X perthis(this(Eleven)) { + + boolean doit() { + System.out.println("In instance check method doit()"); + return true; + } + + before():execution(* m(..)) && if(thisAspectInstance.doit()){ + System.out.println("In advice()"); + } +} diff --git a/tests/bugs1612/pr239649/Fifteen.java b/tests/bugs1612/pr239649/Fifteen.java new file mode 100644 index 000000000..304b3a355 --- /dev/null +++ b/tests/bugs1612/pr239649/Fifteen.java @@ -0,0 +1,25 @@ +public class Fifteen { + public static void main(String[] argv) { + Fifteen a = new Fifteen(); + a.m(); + } + + public void m() { + System.out.println("Method m() running"); + } +} + +abstract aspect Y { + abstract pointcut p(); + before(): if(thisAspectInstance.doit()) && p() { + System.out.println("In advice()"); + } + boolean doit() { + System.out.println("in doit(): class="+this.getClass().getName()); + return true; + } +} + +aspect X extends Y { + pointcut p(): execution(* m(..)); +} diff --git a/tests/bugs1612/pr239649/Five.java b/tests/bugs1612/pr239649/Five.java new file mode 100644 index 000000000..80b8d21bc --- /dev/null +++ b/tests/bugs1612/pr239649/Five.java @@ -0,0 +1,21 @@ +public class Five { + public static void main(String[] argv) { + Five a = new Five(); + a.m("abc"); + } + + public void m(String s) { + System.out.println("Method m() running"); + } +} + +aspect X { + boolean doit() { + System.out.println("In instance check method doit()"); + return true; + } + + before():execution(* m(..)) && if(thisAspectInstance.doit()){ + System.out.println("In advice() arg0="+thisJoinPoint.getArgs()[0]); + } +} diff --git a/tests/bugs1612/pr239649/Four.java b/tests/bugs1612/pr239649/Four.java new file mode 100644 index 000000000..bcf7e660d --- /dev/null +++ b/tests/bugs1612/pr239649/Four.java @@ -0,0 +1,21 @@ +public class Four { + public static void main(String[] argv) { + Four a = new Four(); + a.m(); + } + + public void m() { + System.out.println("Method m() running"); + } +} + +aspect X { + boolean doit() { + System.out.println("In instance check method doit()"); + return true; + } + + before():execution(* m(..)) && if(thisAspectInstance.doit()){ + System.out.println("In advice() "+thisJoinPointStaticPart); + } +} diff --git a/tests/bugs1612/pr239649/Fourteen.java b/tests/bugs1612/pr239649/Fourteen.java new file mode 100644 index 000000000..0b157bdc4 --- /dev/null +++ b/tests/bugs1612/pr239649/Fourteen.java @@ -0,0 +1,22 @@ +public class Fourteen { + public static void main(String[] argv) { + Fourteen a = new Fourteen(); + a.m("abc"); + } + + public void m(String s) { + System.out.println("Method m() running"); + } +} + +aspect X { + + static boolean printit(Object o) { + System.out.println("instance is "+o.getClass().getName()); +return true; + } + + before(String s):args(s) && execution(* m(..)) && if(printit(thisAspectInstance)) && if(thisJoinPointStaticPart.toString().indexOf("Fourteen")!=-1) { + System.out.println("In advice() arg="+s+" tjpsp="+thisJoinPointStaticPart); + } +} diff --git a/tests/bugs1612/pr239649/Nine.java b/tests/bugs1612/pr239649/Nine.java new file mode 100644 index 000000000..05d4c88f0 --- /dev/null +++ b/tests/bugs1612/pr239649/Nine.java @@ -0,0 +1,25 @@ +public class Nine { + public static void main(String[] argv) { + Nine a = new Nine(); + a.m(); + } + + public void m() { + System.out.println("Method m() running"); + } +} + +abstract aspect Y { + abstract pointcut p(); + before(): execution(* m(..)) && p() { + System.out.println("In advice()"); + } + boolean doit() { + System.out.println("in doit(): class="+this.getClass().getName()); + return true; + } +} + +aspect X extends Y { + pointcut p(): if(thisAspectInstance.doit()); +} diff --git a/tests/bugs1612/pr239649/One.java b/tests/bugs1612/pr239649/One.java new file mode 100644 index 000000000..c35d5afcf --- /dev/null +++ b/tests/bugs1612/pr239649/One.java @@ -0,0 +1,21 @@ +public class One { + public static void main(String[] argv) { + One a = new One(); + a.m(); + } + + public void m() { + System.out.println("Method m() running"); + } +} + +aspect X { + boolean doit() { + System.out.println("In instance check method doit()"); + return true; + } + + before():execution(* m(..)) && if(thisAspectInstance.doit()){ + System.out.println("In advice()"); + } +} diff --git a/tests/bugs1612/pr239649/Seven.java b/tests/bugs1612/pr239649/Seven.java new file mode 100644 index 000000000..782a27251 --- /dev/null +++ b/tests/bugs1612/pr239649/Seven.java @@ -0,0 +1,21 @@ +public class Seven { + public static void main(String[] argv) { + Seven a = new Seven(); + a.m(); + } + + public void m() { + System.out.println("Method m() running"); + } +} + +aspect X { + boolean doit() { + System.out.println("In instance check method doit()"); + return true; + } + + before(): call(* m(..)) && if(thisAspectInstance.doit()){ + System.out.println("In advice() "+thisJoinPoint+" "+thisEnclosingJoinPointStaticPart); + } +} diff --git a/tests/bugs1612/pr239649/Six.java b/tests/bugs1612/pr239649/Six.java new file mode 100644 index 000000000..f2c46b3f6 --- /dev/null +++ b/tests/bugs1612/pr239649/Six.java @@ -0,0 +1,21 @@ +public class Six { + public static void main(String[] argv) { + Six a = new Six(); + a.m(); + } + + public void m() { + System.out.println("Method m() running"); + } +} + +aspect X { + boolean doit() { + System.out.println("In instance check method doit()"); + return true; + } + + before():call(* m(..)) && if(thisAspectInstance.doit()){ + System.out.println("In advice() "+thisEnclosingJoinPointStaticPart); + } +} diff --git a/tests/bugs1612/pr239649/Ten.java b/tests/bugs1612/pr239649/Ten.java new file mode 100644 index 000000000..bd7f4fdaa --- /dev/null +++ b/tests/bugs1612/pr239649/Ten.java @@ -0,0 +1,23 @@ +package com.foo.bar; + +public class Ten { + public static void main(String[] argv) { + Ten a = new Ten(); + a.m(); + } + + public void m() { + System.out.println("Method m() running"); + } +} + +aspect X { + boolean doit() { + System.out.println("In instance check method doit() class="+this.getClass().getName()); + return true; + } + + before():execution(* m(..)) && if(thisAspectInstance.doit()){ + System.out.println("In advice()"); + } +} diff --git a/tests/bugs1612/pr239649/Thirteen.java b/tests/bugs1612/pr239649/Thirteen.java new file mode 100644 index 000000000..aa18dc0ab --- /dev/null +++ b/tests/bugs1612/pr239649/Thirteen.java @@ -0,0 +1,22 @@ +public class Thirteen { + public static void main(String[] argv) { + Thirteen a = new Thirteen(); + a.m("abc"); + } + + public void m(String s) { + System.out.println("Method m() running"); + } +} + +aspect X { + + static boolean printit(Object o) { + System.out.println("instance is "+o.getClass().getName()); +return true; + } + + before(String s):args(s) && execution(* m(..)) && if(printit(thisAspectInstance)){ + System.out.println("In advice() arg="+s+" tjpsp="+thisJoinPointStaticPart); + } +} diff --git a/tests/bugs1612/pr239649/Three.java b/tests/bugs1612/pr239649/Three.java new file mode 100644 index 000000000..144902e5a --- /dev/null +++ b/tests/bugs1612/pr239649/Three.java @@ -0,0 +1,27 @@ +public class Three { + public static void main(String[] argv) { + Three a = new Three(); + a.m(); + a.m(); + a.m(); + a.m(); + } + + public void m() { + System.out.println("Method m() running"); + } +} + +aspect X { + int count = 0; + + boolean doit() { + count++; + System.out.println("In instance check method, count="+count+" so doit returns "+((count%2)==0)); + return (count%2)==0; + } + + after():call(* m(..)) && if(thisAspectInstance.doit()){ + System.out.println("In advice()"); + } +} diff --git a/tests/bugs1612/pr239649/Twelve.java b/tests/bugs1612/pr239649/Twelve.java new file mode 100644 index 000000000..8e3989b06 --- /dev/null +++ b/tests/bugs1612/pr239649/Twelve.java @@ -0,0 +1,22 @@ +public class Twelve { + public static void main(String[] argv) { + Twelve a = new Twelve(); + a.m("abc"); + } + + public void m(String s) { + System.out.println("Method m() running"); + } +} + +aspect X { + + boolean doit() { + System.out.println("In instance check method doit()"); + return true; + } + + before(String s):execution(* m(..)) && if(thisAspectInstance.doit()) && args(s) { + System.out.println("In advice() arg="+s+" tjpsp="+thisJoinPointStaticPart); + } +} diff --git a/tests/bugs1612/pr239649/Two.java b/tests/bugs1612/pr239649/Two.java new file mode 100644 index 000000000..5d4414e21 --- /dev/null +++ b/tests/bugs1612/pr239649/Two.java @@ -0,0 +1,27 @@ +public class Two { + public static void main(String[] argv) { + Two a = new Two(); + a.m(); + a.m(); + a.m(); + a.m(); + } + + public void m() { + System.out.println("Method m() running"); + } +} + +aspect X { + int count = 0; + + boolean doit() { + count++; + System.out.println("In instance check method, count="+count+" so doit returns "+((count%2)==0)); + return (count%2)==0; + } + + before():call(* m(..)) && if(thisAspectInstance.doit()){ + System.out.println("In advice()"); + } +}