diff options
author | Andy Clement <andrew.clement@gmail.com> | 2012-06-15 11:29:35 -0700 |
---|---|---|
committer | Andy Clement <andrew.clement@gmail.com> | 2012-06-15 11:29:35 -0700 |
commit | ba9d43ccaf2660ddc9916ea48f79a77ba60d435e (patch) | |
tree | 6f73f5ae340be4559e5551ec6d51b80447dc627f /tests/bugs170 | |
parent | 4b101d9686d97db694585c94d742c4dcb8417aaa (diff) | |
download | aspectj-ba9d43ccaf2660ddc9916ea48f79a77ba60d435e.tar.gz aspectj-ba9d43ccaf2660ddc9916ea48f79a77ba60d435e.zip |
382723
Diffstat (limited to 'tests/bugs170')
-rw-r--r-- | tests/bugs170/pr382723/Foo.java | 44 | ||||
-rw-r--r-- | tests/bugs170/pr382723/FooAspect.java | 35 | ||||
-rw-r--r-- | tests/bugs170/pr382723/FooAspect2.java | 35 | ||||
-rw-r--r-- | tests/bugs170/pr382723/FooAspect3.java | 35 |
4 files changed, 149 insertions, 0 deletions
diff --git a/tests/bugs170/pr382723/Foo.java b/tests/bugs170/pr382723/Foo.java new file mode 100644 index 000000000..cbb32b914 --- /dev/null +++ b/tests/bugs170/pr382723/Foo.java @@ -0,0 +1,44 @@ +import java.util.AbstractList; +import java.util.LinkedList; +import java.util.List; + +abstract aspect FooAspectParent<T extends List> { + protected int getNumber(int k) { + return -1*k; + } +} + +abstract privileged aspect FooAspect<T extends AbstractList> extends FooAspectParent<T> { + pointcut pc(): call(T.new()) && !within(Bar); + + T around():pc() { + System.out.println("superaspect getNumber returns "+getNumber(2)); + System.out.println("abstract method returns "+method()); + localMethod(); + Math.random(); //<-- works + hashCode(); //<-- works + return null; + } + + private void localMethod(){} + + protected abstract T method(); +} + +aspect Bar extends FooAspect<LinkedList> { + protected LinkedList method() { + System.out.println("Bar.method() running"); + return new LinkedList(); + } +} + +public class Foo { + + public static void main(String[] argv) { + new Foo().bar(); + } + public LinkedList bar() { + new LinkedList(); + return null; + } +} diff --git a/tests/bugs170/pr382723/FooAspect.java b/tests/bugs170/pr382723/FooAspect.java new file mode 100644 index 000000000..5b5c866c5 --- /dev/null +++ b/tests/bugs170/pr382723/FooAspect.java @@ -0,0 +1,35 @@ +import java.util.AbstractList; +import java.util.LinkedList; +import java.util.List; + +abstract aspect FooAspectParent<T extends List> { + protected int getNumber(int k) { + return -1*k; + } +} + +abstract privileged aspect FooAspect<T extends AbstractList> extends FooAspectParent<T> { + pointcut pc(): call(T.new()); + + T around():pc() { + //getNumber(1); //<-- method call to superAspect fails + method(); // <-- method call to abstract local defined method fails + //localMethod(); //<-- method call to local private method fails + Math.random(); //<-- works + hashCode(); //<-- works + return null; + } + + private void localMethod(){} + + protected abstract T method(); +} + +/* +class Foo { + public LinkedList bar() { + new LinkedList(); + return null; + } +} +*/ diff --git a/tests/bugs170/pr382723/FooAspect2.java b/tests/bugs170/pr382723/FooAspect2.java new file mode 100644 index 000000000..d0faa53c4 --- /dev/null +++ b/tests/bugs170/pr382723/FooAspect2.java @@ -0,0 +1,35 @@ +import java.util.AbstractList; +import java.util.LinkedList; +import java.util.List; + +abstract aspect FooAspectParent<T extends List> { + protected int getNumber(int k) { + return -1*k; + } +} + +abstract privileged aspect FooAspect<T extends AbstractList> extends FooAspectParent<T> { + pointcut pc(): call(T.new()); + + T around():pc() { + getNumber(1); //<-- method call to superAspect fails + //method(); // <-- method call to abstract local defined method fails + //localMethod(); //<-- method call to local private method fails + Math.random(); //<-- works + hashCode(); //<-- works + return null; + } + + private void localMethod(){} + + protected abstract T method(); +} + +/* +class Foo { + public LinkedList bar() { + new LinkedList(); + return null; + } +} +*/ diff --git a/tests/bugs170/pr382723/FooAspect3.java b/tests/bugs170/pr382723/FooAspect3.java new file mode 100644 index 000000000..f0a034505 --- /dev/null +++ b/tests/bugs170/pr382723/FooAspect3.java @@ -0,0 +1,35 @@ +import java.util.AbstractList; +import java.util.LinkedList; +import java.util.List; + +abstract aspect FooAspectParent<T extends List> { + protected int getNumber(int k) { + return -1*k; + } +} + +abstract privileged aspect FooAspect<T extends AbstractList> extends FooAspectParent<T> { + pointcut pc(): call(T.new()); + + T around():pc() { + //getNumber(1); //<-- method call to superAspect fails + //method(); // <-- method call to abstract local defined method fails + localMethod(); //<-- method call to local private method fails + Math.random(); //<-- works + hashCode(); //<-- works + return null; + } + + private void localMethod(){} + + protected abstract T method(); +} + +/* +class Foo { + public LinkedList bar() { + new LinkedList(); + return null; + } +} +*/ |