Browse Source

223605: itd on generic type: test and fix

tags/V1_6_0rc1
aclement 16 years ago
parent
commit
e372e39011

+ 51
- 0
tests/bugs160/pr223605/GenericConfigurableBugTest.java View File

@@ -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<T> {
}


+ 3
- 0
tests/src/org/aspectj/systemtest/ajc160/Ajc160Tests.java View File

@@ -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");
}

+ 6
- 0
tests/src/org/aspectj/systemtest/ajc160/ajc160.xml View File

@@ -3,6 +3,12 @@
<!-- AspectJ v1.6.0 Tests -->
<suite>

<ajc-test dir="bugs160/pr223605" title="generic decp ltw">
<compile files="GenericConfigurableBugTest.java" options="-1.5"><!-- -showWeaveInfo"-->
</compile>
<run class="test.GenericConfigurableBugTest"/>
</ajc-test>

<ajc-test dir="bugs160/pr173602" title="duplicate itd npe">
<compile files="X.java">
<message kind="error" line="2" text="intertype declaration from "/>

Loading…
Cancel
Save