From bc2f36fdbf0e0a8d59e9613b69a3b4639b1dd668 Mon Sep 17 00:00:00 2001 From: aclement Date: Tue, 17 Oct 2006 08:08:12 +0000 Subject: [PATCH] test for 149293: declare atType for private annotation --- .../base/src/mypackage/MyAbstractClass.java | 19 +++++++++++++++++++ .../base/src/mypackage/MyAspect.java | 7 +++++++ .../base/src/mypackage/MyBaseClass.java | 5 +++++ .../base/src/mypackage/MyInterface.java | 5 +++++ .../inc1/src/mypackage/MySubclass.java | 7 +++++++ .../tools/MultiProjectIncrementalTests.java | 15 +++++++++++++++ 6 files changed, 58 insertions(+) create mode 100644 tests/multiIncremental/PR149293_1/base/src/mypackage/MyAbstractClass.java create mode 100644 tests/multiIncremental/PR149293_1/base/src/mypackage/MyAspect.java create mode 100644 tests/multiIncremental/PR149293_1/base/src/mypackage/MyBaseClass.java create mode 100644 tests/multiIncremental/PR149293_1/base/src/mypackage/MyInterface.java create mode 100644 tests/multiIncremental/PR149293_1/inc1/src/mypackage/MySubclass.java diff --git a/tests/multiIncremental/PR149293_1/base/src/mypackage/MyAbstractClass.java b/tests/multiIncremental/PR149293_1/base/src/mypackage/MyAbstractClass.java new file mode 100644 index 000000000..8f7fed612 --- /dev/null +++ b/tests/multiIncremental/PR149293_1/base/src/mypackage/MyAbstractClass.java @@ -0,0 +1,19 @@ +package mypackage; + +import java.lang.annotation.Retention; +import java.lang.annotation.RetentionPolicy; + +public abstract class MyAbstractClass implements MyInterface { + + @Retention(RetentionPolicy.RUNTIME) + private @interface MyAspectPresent { + } + + public MyAbstractClass() { + if (!getClass().isAnnotationPresent(MyAspectPresent.class)) { + throw new RuntimeException("MyAspect has not been woven into " + + getClass()); + } + } + +} diff --git a/tests/multiIncremental/PR149293_1/base/src/mypackage/MyAspect.java b/tests/multiIncremental/PR149293_1/base/src/mypackage/MyAspect.java new file mode 100644 index 000000000..a133ebe91 --- /dev/null +++ b/tests/multiIncremental/PR149293_1/base/src/mypackage/MyAspect.java @@ -0,0 +1,7 @@ +package mypackage; + +privileged public aspect MyAspect { + + declare @type : MyInterface+ : @MyBaseClass.MyAspectPresent; + +} diff --git a/tests/multiIncremental/PR149293_1/base/src/mypackage/MyBaseClass.java b/tests/multiIncremental/PR149293_1/base/src/mypackage/MyBaseClass.java new file mode 100644 index 000000000..6a903b0bf --- /dev/null +++ b/tests/multiIncremental/PR149293_1/base/src/mypackage/MyBaseClass.java @@ -0,0 +1,5 @@ +package mypackage; + +public abstract class MyBaseClass extends MyAbstractClass { + +} diff --git a/tests/multiIncremental/PR149293_1/base/src/mypackage/MyInterface.java b/tests/multiIncremental/PR149293_1/base/src/mypackage/MyInterface.java new file mode 100644 index 000000000..bf3b5e927 --- /dev/null +++ b/tests/multiIncremental/PR149293_1/base/src/mypackage/MyInterface.java @@ -0,0 +1,5 @@ +package mypackage; + +public interface MyInterface { + +} diff --git a/tests/multiIncremental/PR149293_1/inc1/src/mypackage/MySubclass.java b/tests/multiIncremental/PR149293_1/inc1/src/mypackage/MySubclass.java new file mode 100644 index 000000000..b42d94398 --- /dev/null +++ b/tests/multiIncremental/PR149293_1/inc1/src/mypackage/MySubclass.java @@ -0,0 +1,7 @@ +package mypackage; + +import mypackage.MyBaseClass; + +public class MySubclass extends MyBaseClass { + +} diff --git a/tests/src/org/aspectj/systemtest/incremental/tools/MultiProjectIncrementalTests.java b/tests/src/org/aspectj/systemtest/incremental/tools/MultiProjectIncrementalTests.java index ed4e048d2..75dfd99db 100644 --- a/tests/src/org/aspectj/systemtest/incremental/tools/MultiProjectIncrementalTests.java +++ b/tests/src/org/aspectj/systemtest/incremental/tools/MultiProjectIncrementalTests.java @@ -249,6 +249,17 @@ public class MultiProjectIncrementalTests extends AbstractMultiProjectIncrementa checkWasntFullBuild(); } +// public void testDeclareAtType_pr149293() { +// configureBuildStructureModel(true); +// initialiseProject("PR149293_1"); +// build("PR149293_1"); +// checkCompileWeaveCount(4,5); +// assertNoErrors(); +// alter("PR149293_1","inc1"); +// build("PR149293_1"); +// assertNoErrors(); +// } + /* public void testRefactoring_pr148285() { configureBuildStructureModel(true); @@ -1766,5 +1777,9 @@ public class MultiProjectIncrementalTests extends AbstractMultiProjectIncrementa File projDir = new File(getWorkingDir(),p); return new File(projDir,"bin"+File.separator+filename); } + + private void assertNoErrors() { + assertTrue("Should be no errors, but got "+MyTaskListManager.getErrorMessages(),MyTaskListManager.getErrorMessages().size()==0); + } } \ No newline at end of file -- 2.39.5