From e372e390116d3d90f3ed5f6d8d1689c29932655f Mon Sep 17 00:00:00 2001 From: aclement Date: Mon, 24 Mar 2008 18:36:57 +0000 Subject: [PATCH] 223605: itd on generic type: test and fix --- .../pr223605/GenericConfigurableBugTest.java | 51 +++++++++++++++++++ .../systemtest/ajc160/Ajc160Tests.java | 3 ++ .../org/aspectj/systemtest/ajc160/ajc160.xml | 6 +++ 3 files changed, 60 insertions(+) create mode 100644 tests/bugs160/pr223605/GenericConfigurableBugTest.java diff --git a/tests/bugs160/pr223605/GenericConfigurableBugTest.java b/tests/bugs160/pr223605/GenericConfigurableBugTest.java new file mode 100644 index 000000000..b62f3f995 --- /dev/null +++ b/tests/bugs160/pr223605/GenericConfigurableBugTest.java @@ -0,0 +1,51 @@ +package test; + +import junit.framework.TestCase; + +/** + * Test case to illustrate problem with SPR-4587. + * + * @author Ramnivas Laddad + * + */ +public class GenericConfigurableBugTest { + public static void main(String[] argv) { + RegularClass regular = new RegularClass(); + GenericParameterClass generic = new GenericParameterClass(); + + if (!(regular instanceof ConfigurableObject)) + throw new RuntimeException("regular not instanceof ConfigurableObject"); + + if (!(generic instanceof ConfigurableObject)) + throw new RuntimeException("generic not instanceof ConfigurableObject"); + + if (TestAspect.aspectOf().count!=4) + throw new RuntimeException("Count should be 4 but is "+TestAspect.aspectOf().count); + } +} + +aspect TestAspect { + int count = 0; + + after() : initialization(ConfigurableObject+.new(..)) { + System.out.println(thisJoinPoint); + count++; + } + + declare parents: @Configurable * implements ConfigurableObject; +} + +interface ConfigurableObject { +} + +@interface Configurable { +} + +@Configurable +class RegularClass { +} + +@Configurable +class GenericParameterClass { +} + diff --git a/tests/src/org/aspectj/systemtest/ajc160/Ajc160Tests.java b/tests/src/org/aspectj/systemtest/ajc160/Ajc160Tests.java index 2d2fc87e1..93f01640b 100644 --- a/tests/src/org/aspectj/systemtest/ajc160/Ajc160Tests.java +++ b/tests/src/org/aspectj/systemtest/ajc160/Ajc160Tests.java @@ -22,6 +22,9 @@ import org.aspectj.testing.XMLBasedAjcTestCase; public class Ajc160Tests extends org.aspectj.testing.XMLBasedAjcTestCase { // AspectJ1.6.0rc1 + public void testGenericDecpLtw_pr223605() { + runTest("generic decp ltw"); + } public void testDuplicateITDsNPE_pr173602() { runTest("duplicate itd npe"); } diff --git a/tests/src/org/aspectj/systemtest/ajc160/ajc160.xml b/tests/src/org/aspectj/systemtest/ajc160/ajc160.xml index 3669dce2f..b7167cc78 100644 --- a/tests/src/org/aspectj/systemtest/ajc160/ajc160.xml +++ b/tests/src/org/aspectj/systemtest/ajc160/ajc160.xml @@ -3,6 +3,12 @@ + + + + + + -- 2.39.5