From 47b1728bdce19ddb5339aa492464765cc1bb4982 Mon Sep 17 00:00:00 2001 From: aclement Date: Thu, 5 Aug 2010 16:48:05 +0000 Subject: [PATCH] 278496: anon inner types affected by aspects --- .../base/src/generics/ActionExecutor.java | 18 +++ .../base/src/generics/DeleteAction.java | 12 ++ .../base/src/generics/DeleteActionAspect.aj | 30 ++++ .../pr278496_8/base/src/test/Demo.aj | 14 ++ .../pr278496_8/base/src/test/MyAspect.aj | 63 ++++++++ .../pr278496_8/base/src/test/OtherClass.aj | 10 ++ .../pr278496_8/base/src/test2/MyAspect2.aj | 29 ++++ .../pr278496_8/base/src/test2/OtherClass2.aj | 15 ++ .../tools/IncrementalCompilationTests.java | 149 +++++++++++++++++- 9 files changed, 339 insertions(+), 1 deletion(-) create mode 100644 tests/multiIncremental/pr278496_8/base/src/generics/ActionExecutor.java create mode 100644 tests/multiIncremental/pr278496_8/base/src/generics/DeleteAction.java create mode 100644 tests/multiIncremental/pr278496_8/base/src/generics/DeleteActionAspect.aj create mode 100644 tests/multiIncremental/pr278496_8/base/src/test/Demo.aj create mode 100644 tests/multiIncremental/pr278496_8/base/src/test/MyAspect.aj create mode 100644 tests/multiIncremental/pr278496_8/base/src/test/OtherClass.aj create mode 100644 tests/multiIncremental/pr278496_8/base/src/test2/MyAspect2.aj create mode 100644 tests/multiIncremental/pr278496_8/base/src/test2/OtherClass2.aj diff --git a/tests/multiIncremental/pr278496_8/base/src/generics/ActionExecutor.java b/tests/multiIncremental/pr278496_8/base/src/generics/ActionExecutor.java new file mode 100644 index 000000000..5305dd4cf --- /dev/null +++ b/tests/multiIncremental/pr278496_8/base/src/generics/ActionExecutor.java @@ -0,0 +1,18 @@ +package generics; + +public class ActionExecutor { + public static void main(String[] args) { + DeleteAction d = new DeleteAction() { + public String getSelected() { + throw new RuntimeException(); + } + + }; + d.delete2++; + d.delete3.add(null); + } + + void nothing2(DeleteAction g) { + g.delete2++; + } +} \ No newline at end of file diff --git a/tests/multiIncremental/pr278496_8/base/src/generics/DeleteAction.java b/tests/multiIncremental/pr278496_8/base/src/generics/DeleteAction.java new file mode 100644 index 000000000..05c136a3d --- /dev/null +++ b/tests/multiIncremental/pr278496_8/base/src/generics/DeleteAction.java @@ -0,0 +1,12 @@ +package generics; +import java.util.List; + + +public interface DeleteAction{ + + public void delete(); + + public T getSelected(); + +} + \ No newline at end of file diff --git a/tests/multiIncremental/pr278496_8/base/src/generics/DeleteActionAspect.aj b/tests/multiIncremental/pr278496_8/base/src/generics/DeleteActionAspect.aj new file mode 100644 index 000000000..499981e37 --- /dev/null +++ b/tests/multiIncremental/pr278496_8/base/src/generics/DeleteActionAspect.aj @@ -0,0 +1,30 @@ +package generics; + +import java.util.List; + + +public aspect DeleteActionAspect { + + public void DeleteAction.delete() { + Object selected = getSelected(); + selected.toString(); + delete3.add(""); + } + + public int DeleteAction.delete2; + + public List DeleteAction.delete3; + + + public static void main(String[] args) { + DeleteAction d = new DeleteAction() { + public String getSelected() { + throw new RuntimeException(); + } + + }; + d.delete2++; + d.delete3.add(null); + } + +} \ No newline at end of file diff --git a/tests/multiIncremental/pr278496_8/base/src/test/Demo.aj b/tests/multiIncremental/pr278496_8/base/src/test/Demo.aj new file mode 100644 index 000000000..174680bc8 --- /dev/null +++ b/tests/multiIncremental/pr278496_8/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/pr278496_8/base/src/test/MyAspect.aj b/tests/multiIncremental/pr278496_8/base/src/test/MyAspect.aj new file mode 100644 index 000000000..23704a0d9 --- /dev/null +++ b/tests/multiIncremental/pr278496_8/base/src/test/MyAspect.aj @@ -0,0 +1,63 @@ +package test; +import java.util.List; + +public aspect MyAspect { + + @MyAnnotation(val = 5) + private Integer Demo.version; + + + List Demo.list = null; + int Demo.x = 5; + + void Demo.foo(List 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 { + int val() default 5; + } + + // try out declare annotation + declare @type : Demo : @MyAnnotation; + declare @field: int Demo.x: @MyAnnotation; + declare @method: void Demo.foo(..): @MyAnnotation; + declare @constructor: public Demo.new(int): @MyAnnotation; + + // try out abstract ITDs + public abstract long Abstract.nothing(); + + public static abstract class Abstract { } + + +} diff --git a/tests/multiIncremental/pr278496_8/base/src/test/OtherClass.aj b/tests/multiIncremental/pr278496_8/base/src/test/OtherClass.aj new file mode 100644 index 000000000..a24940d9c --- /dev/null +++ b/tests/multiIncremental/pr278496_8/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/pr278496_8/base/src/test2/MyAspect2.aj b/tests/multiIncremental/pr278496_8/base/src/test2/MyAspect2.aj new file mode 100644 index 000000000..5f79df23d --- /dev/null +++ b/tests/multiIncremental/pr278496_8/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/pr278496_8/base/src/test2/OtherClass2.aj b/tests/multiIncremental/pr278496_8/base/src/test2/OtherClass2.aj new file mode 100644 index 000000000..5922fa931 --- /dev/null +++ b/tests/multiIncremental/pr278496_8/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/src/org/aspectj/systemtest/incremental/tools/IncrementalCompilationTests.java b/tests/src/org/aspectj/systemtest/incremental/tools/IncrementalCompilationTests.java index 9cf58112d..550445db2 100644 --- a/tests/src/org/aspectj/systemtest/incremental/tools/IncrementalCompilationTests.java +++ b/tests/src/org/aspectj/systemtest/incremental/tools/IncrementalCompilationTests.java @@ -543,7 +543,7 @@ public class IncrementalCompilationTests extends AbstractMultiProjectIncremental configureNonStandardCompileOptions(p, "-Xset:minimalModel=true"); build(p); checkWasFullBuild(); - printModel(p); + // printModel(p); // Here is the model without deletion. // PR278496_4 [build configuration file] hid:=PR278496_4 // foo [package] hid:=PR278496_4() {..} [class] 20 hid:=PR278496_8() {..} [class] 5 hid:=PR278496_8) [method] 15 hid:=PR278496_8; + // DeleteAction.java [java source file] 1 hid:=PR278496_8) [inter-type method] 13 hid:=PR278496_8; + // Demo.Demo(int) [inter-type constructor] 17 hid:=PR278496_8; + // Hid:11:(targets=8) =PR278496_8; (declared on) =PR278496_8