From ad03f314f66a7c49737f32fc23b4aea6bef3d8cf Mon Sep 17 00:00:00 2001 From: aclement Date: Mon, 7 Jul 2008 22:32:39 +0000 Subject: [PATCH] 238992: test and fix --- tests/bugs162/pr238992/Foo.java | 36 +++++++++++++++++++ tests/bugs162/pr238992/Foo2.java | 36 +++++++++++++++++++ tests/bugs162/pr238992/Foo3.java | 36 +++++++++++++++++++ tests/bugs162/pr238992/Foo4.java | 36 +++++++++++++++++++ .../systemtest/ajc162/Ajc162Tests.java | 8 +++-- .../org/aspectj/systemtest/ajc162/ajc162.xml | 30 ++++++++++++++++ 6 files changed, 180 insertions(+), 2 deletions(-) create mode 100644 tests/bugs162/pr238992/Foo.java create mode 100644 tests/bugs162/pr238992/Foo2.java create mode 100644 tests/bugs162/pr238992/Foo3.java create mode 100644 tests/bugs162/pr238992/Foo4.java diff --git a/tests/bugs162/pr238992/Foo.java b/tests/bugs162/pr238992/Foo.java new file mode 100644 index 000000000..d4fe3600d --- /dev/null +++ b/tests/bugs162/pr238992/Foo.java @@ -0,0 +1,36 @@ +import java.lang.annotation.*; +import java.io.*; + +@Entity(indexed=false) +public class Foo { + public static void main(String []argv) { + Foo f = new Foo(); + Goo g = new Goo(); + if (f instanceof Serializable) { + throw new RuntimeException("Foo should not implement it"); + } + if (!(g instanceof Serializable)) { + throw new RuntimeException("Goo should implement it"); + } + if (new Hoo() instanceof Serializable) { + throw new RuntimeException("Hoo should not implement it"); + } + } +} + +@Entity(indexed=true) +class Goo { +} + +@Entity // default is false +class Hoo { +} + +@Retention(RetentionPolicy.RUNTIME) +@interface Entity { + boolean indexed() default false; +} + +aspect X { + declare parents: (@Entity(indexed=true) *) implements java.io.Serializable; +} diff --git a/tests/bugs162/pr238992/Foo2.java b/tests/bugs162/pr238992/Foo2.java new file mode 100644 index 000000000..38f496dd5 --- /dev/null +++ b/tests/bugs162/pr238992/Foo2.java @@ -0,0 +1,36 @@ +import java.lang.annotation.*; +import java.io.*; + +@Entity(indexed=false) +public class Foo2 { + public static void main(String []argv) { + Foo2 f = new Foo2(); + Goo g = new Goo(); + if (f instanceof Serializable) { + throw new RuntimeException("Foo2 should not implement it"); + } + if (!(g instanceof Serializable)) { + throw new RuntimeException("Goo should implement it"); + } + if (!(new Hoo() instanceof Serializable)) { + throw new RuntimeException("Hoo should implement it"); + } + } +} + +@Entity(indexed=true) +class Goo { +} + +@Entity // default is true +class Hoo { +} + +@Retention(RetentionPolicy.RUNTIME) +@interface Entity { + boolean indexed() default true; +} + +aspect X { + declare parents: (@Entity(indexed=true) *) implements java.io.Serializable; +} diff --git a/tests/bugs162/pr238992/Foo3.java b/tests/bugs162/pr238992/Foo3.java new file mode 100644 index 000000000..5935688ed --- /dev/null +++ b/tests/bugs162/pr238992/Foo3.java @@ -0,0 +1,36 @@ +import java.lang.annotation.*; +import java.io.*; + +@Entity(i=1) +public class Foo3 { + public static void main(String []argv) { + Foo3 f = new Foo3(); + Goo g = new Goo(); + if (f instanceof Serializable) { + throw new RuntimeException("Foo3 should not implement it"); + } + if (!(g instanceof Serializable)) { + throw new RuntimeException("Goo should implement it"); + } + if (new Hoo() instanceof Serializable) { + throw new RuntimeException("Hoo should not implement it"); + } + } +} + +@Entity(i=2) +class Goo { +} + +@Entity // default is 1 +class Hoo { +} + +@Retention(RetentionPolicy.RUNTIME) +@interface Entity { + int i() default 1; +} + +aspect X { + declare parents: (@Entity(i=2) *) implements java.io.Serializable; +} diff --git a/tests/bugs162/pr238992/Foo4.java b/tests/bugs162/pr238992/Foo4.java new file mode 100644 index 000000000..87ee3c6b2 --- /dev/null +++ b/tests/bugs162/pr238992/Foo4.java @@ -0,0 +1,36 @@ +import java.lang.annotation.*; +import java.io.*; + +@Entity(i=1) +public class Foo4 { + public static void main(String []argv) { + Foo4 f = new Foo4(); + Goo g = new Goo(); + if (f instanceof Serializable) { + throw new RuntimeException("Foo4 should not implement it"); + } + if (!(g instanceof Serializable)) { + throw new RuntimeException("Goo should implement it"); + } + if (!(new Hoo() instanceof Serializable)) { + throw new RuntimeException("Hoo should implement it"); + } + } +} + +@Entity(i=2) +class Goo { +} + +@Entity // default is 2 +class Hoo { +} + +@Retention(RetentionPolicy.RUNTIME) +@interface Entity { + int i() default 2; +} + +aspect X { + declare parents: (@Entity(i=2) *) implements java.io.Serializable; +} diff --git a/tests/src/org/aspectj/systemtest/ajc162/Ajc162Tests.java b/tests/src/org/aspectj/systemtest/ajc162/Ajc162Tests.java index d8d539b24..2cb1d3826 100644 --- a/tests/src/org/aspectj/systemtest/ajc162/Ajc162Tests.java +++ b/tests/src/org/aspectj/systemtest/ajc162/Ajc162Tests.java @@ -19,8 +19,12 @@ import org.aspectj.testing.XMLBasedAjcTestCase; public class Ajc162Tests extends org.aspectj.testing.XMLBasedAjcTestCase { // AspectJ1.6.2 - public void testAnnotationDecp_pr239441() { runTest("annotation decp"); } - +// public void testAnnotationDecp_pr239441() { runTest("annotation decp"); } + public void testAnnotationValueDecp_pr238992() { runTest("annotation value decp"); } + public void testAnnotationValueDecp_pr238992_2() { runTest("annotation value decp - 2"); } + public void testAnnotationValueDecp_pr238992_3() { runTest("annotation value decp - 3"); } + public void testAnnotationValueDecp_pr238992_4() { runTest("annotation value decp - 4"); } + public static Test suite() { return XMLBasedAjcTestCase.loadSuite(Ajc162Tests.class); } diff --git a/tests/src/org/aspectj/systemtest/ajc162/ajc162.xml b/tests/src/org/aspectj/systemtest/ajc162/ajc162.xml index 08e86272d..5b2b599ba 100644 --- a/tests/src/org/aspectj/systemtest/ajc162/ajc162.xml +++ b/tests/src/org/aspectj/systemtest/ajc162/ajc162.xml @@ -7,5 +7,35 @@ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + \ No newline at end of file -- 2.39.5