diff options
author | aclement <aclement> | 2009-01-23 20:38:58 +0000 |
---|---|---|
committer | aclement <aclement> | 2009-01-23 20:38:58 +0000 |
commit | ab75342042aa9a5e0ed0c512bf50d68f9bfb2d19 (patch) | |
tree | b8d87f28da5a799d0c7acff7913e1a108d7f03f5 /tests/multiIncremental | |
parent | 0afe6b3137e636e126d58d6db1a21d2990c06d95 (diff) | |
download | aspectj-ab75342042aa9a5e0ed0c512bf50d68f9bfb2d19.tar.gz aspectj-ab75342042aa9a5e0ed0c512bf50d68f9bfb2d19.zip |
262218: test and fix
Diffstat (limited to 'tests/multiIncremental')
9 files changed, 229 insertions, 0 deletions
diff --git a/tests/multiIncremental/pr262218/base/src/generics/ActionExecutor.java b/tests/multiIncremental/pr262218/base/src/generics/ActionExecutor.java new file mode 100644 index 000000000..e323cc01a --- /dev/null +++ b/tests/multiIncremental/pr262218/base/src/generics/ActionExecutor.java @@ -0,0 +1,18 @@ +package generics; + +public class ActionExecutor { + public static void main(String[] args) { + DeleteAction<String> d = new DeleteAction<String>() { + public String getSelected() { + throw new RuntimeException(); + } + + }; + d.delete2++; + d.delete3.add(null); + } + + void nothing2(DeleteAction<String> g) { + g.delete2++; + } +}
\ No newline at end of file diff --git a/tests/multiIncremental/pr262218/base/src/generics/DeleteAction.java b/tests/multiIncremental/pr262218/base/src/generics/DeleteAction.java new file mode 100644 index 000000000..05c136a3d --- /dev/null +++ b/tests/multiIncremental/pr262218/base/src/generics/DeleteAction.java @@ -0,0 +1,12 @@ +package generics; +import java.util.List; + + +public interface DeleteAction<T extends Object>{ + + public void delete(); + + public T getSelected(); + +} +
\ No newline at end of file diff --git a/tests/multiIncremental/pr262218/base/src/generics/DeleteActionAspect.aj b/tests/multiIncremental/pr262218/base/src/generics/DeleteActionAspect.aj new file mode 100644 index 000000000..499981e37 --- /dev/null +++ b/tests/multiIncremental/pr262218/base/src/generics/DeleteActionAspect.aj @@ -0,0 +1,30 @@ +package generics; + +import java.util.List; + + +public aspect DeleteActionAspect { + + public void DeleteAction<T extends Object>.delete() { + Object selected = getSelected(); + selected.toString(); + delete3.add(""); + } + + public int DeleteAction<T extends Object>.delete2; + + public List<String> DeleteAction.delete3; + + + public static void main(String[] args) { + DeleteAction<String> d = new DeleteAction<String>() { + public String getSelected() { + throw new RuntimeException(); + } + + }; + d.delete2++; + d.delete3.add(null); + } + +}
\ No newline at end of file diff --git a/tests/multiIncremental/pr262218/base/src/test/Demo.aj b/tests/multiIncremental/pr262218/base/src/test/Demo.aj new file mode 100644 index 000000000..174680bc8 --- /dev/null +++ b/tests/multiIncremental/pr262218/base/src/test/Demo.aj @@ -0,0 +1,14 @@ +package test; + +import java.util.List; + +public class Demo { + + void g() { + new Demo(7).foo(null); + x++; + this.x++; + MyAspect.aspectOf(); + MyAspect.hasAspect(); + } +}
\ No newline at end of file diff --git a/tests/multiIncremental/pr262218/base/src/test/MyAspect.aj b/tests/multiIncremental/pr262218/base/src/test/MyAspect.aj new file mode 100644 index 000000000..7d3efc989 --- /dev/null +++ b/tests/multiIncremental/pr262218/base/src/test/MyAspect.aj @@ -0,0 +1,50 @@ +package test; +import java.util.List; + +public aspect MyAspect { + List<String> Demo.list = null; + declare @type : Demo : @Deprecated; + int Demo.x = 5; + + void Demo.foo(List<String> x) { + MyAspect.hasAspect(); + } + + public Demo.new(int x) { + this(); + } + + declare warning : execution(* *.nothing(..)) : "blah"; + + declare error : execution(* *.nothing(..)) : "blah"; + + declare soft : Exception : execution(* *.nothing(..)); + + + protected pointcut s(): + call(String Demo.toString(..)); + + before (): s() { + } + after (): s() { + } + void around (): s() { + proceed(); + return; + } + after () returning(): s() { + } + after () throwing(): s() { + thisEnclosingJoinPointStaticPart.getClass(); + thisJoinPoint.getClass(); + thisJoinPointStaticPart.getClass(); + } + + @interface MyAnnotation { } + + // try out declare annotation + declare @field: int Demo.x: @MyAnnotation; + declare @method: void Demo.foo(..): @MyAnnotation; + declare @constructor: public Demo.new(int): @MyAnnotation; + +} diff --git a/tests/multiIncremental/pr262218/base/src/test/OtherClass.aj b/tests/multiIncremental/pr262218/base/src/test/OtherClass.aj new file mode 100644 index 000000000..a24940d9c --- /dev/null +++ b/tests/multiIncremental/pr262218/base/src/test/OtherClass.aj @@ -0,0 +1,10 @@ +package test; + + +public class OtherClass { + void x() { + Demo d = new Demo(4); + d.foo(null); + d.x ++; + } +}
\ No newline at end of file diff --git a/tests/multiIncremental/pr262218/base/src/test2/MyAspect2.aj b/tests/multiIncremental/pr262218/base/src/test2/MyAspect2.aj new file mode 100644 index 000000000..5f79df23d --- /dev/null +++ b/tests/multiIncremental/pr262218/base/src/test2/MyAspect2.aj @@ -0,0 +1,29 @@ +package test2; + +import test.Demo; +import test2.MyAspect2; + +public aspect MyAspect2 { + + static interface Bar { + + } + declare parents : Demo implements Bar, Cloneable; + + public int Bar.bar() { + return 7; + } + + + static class Foo { + public Foo() { + + } + } + declare parents : Demo extends Foo; + + public int Foo.baz() { + return 7; + } + +} diff --git a/tests/multiIncremental/pr262218/base/src/test2/OtherClass2.aj b/tests/multiIncremental/pr262218/base/src/test2/OtherClass2.aj new file mode 100644 index 000000000..5922fa931 --- /dev/null +++ b/tests/multiIncremental/pr262218/base/src/test2/OtherClass2.aj @@ -0,0 +1,15 @@ +package test2; + +import test.Demo; + +public class OtherClass2 { + void x() { + Demo d = new Demo(4); + d.bar(); + d.baz(); + // causes error for now see note at end of AJCompilationUnitProblemFinder.isARealProblem +// ((MyAspect2.Bar) d).bar(); + ((MyAspect2.Foo) d).baz(); + ((Cloneable) d).toString(); + } +}
\ No newline at end of file diff --git a/tests/multiIncremental/pr262218/inc1/src/test/MyAspect.aj b/tests/multiIncremental/pr262218/inc1/src/test/MyAspect.aj new file mode 100644 index 000000000..e655e5954 --- /dev/null +++ b/tests/multiIncremental/pr262218/inc1/src/test/MyAspect.aj @@ -0,0 +1,51 @@ +package test; +import java.util.List; + + +public aspect MyAspect { + List<String> Demo.list = null; + declare @type : Demo : @Deprecated; + int Demo.x = 5; + + void Demo.foo(List<String> x) { + MyAspect.hasAspect(); + } + + public Demo.new(int x) { + this(); + } + + declare warning : execution(* *.nothing(..)) : "blah"; + + declare error : execution(* *.nothing(..)) : "blah"; + + declare soft : Exception : execution(* *.nothing(..)); + + + protected pointcut s(): + call(String Demo.toString(..)); + + before (): s() { + } + after (): s() { + } + void around (): s() { + proceed(); + return; + } + after () returning(): s() { + } + after () throwing(): s() { + thisEnclosingJoinPointStaticPart.getClass(); + thisJoinPoint.getClass(); + thisJoinPointStaticPart.getClass(); + } + + @interface MyAnnotation { } + + // try out declare annotation + declare @field: int Demo.x: @MyAnnotation; + declare @method: void Demo.foo(..): @MyAnnotation; + declare @constructor: public Demo.new(int): @MyAnnotation; + +} |