Browse Source

PR336880 PR336774 PR336745

tags/V1_6_11RC1
aclement 13 years ago
parent
commit
01be71f629

+ 10
- 0
tests/bugs1611/pr336745/Foo.aj View File

@@ -0,0 +1,10 @@
aspect Foo {
public <T extends I> void C.mitd(T something) {}
}

class C {
<T extends I> void m(T something) {}
}

interface I {}


+ 7
- 0
tests/bugs1611/pr336774/First.java View File

@@ -0,0 +1,7 @@
interface NodeBacked {
// <T extends NodeBacked> T projectTo(Class<T> cts);
}

aspect X {
public <T extends NodeBacked> T NodeBacked.projectTo(Class<T> cts) {return null;}
}

+ 7
- 0
tests/bugs1611/pr336774/One.java View File

@@ -0,0 +1,7 @@
interface NodeBacked2 {
Object projectTo(Class cts);
}

aspect X {
public Object NodeBacked2.projectTo(Class cts) {return null;}
}

+ 5
- 0
tests/bugs1611/pr336774/Test.java View File

@@ -0,0 +1,5 @@
class Test implements NodeBacked {
public void test() {
projectTo(null);
}
}

+ 5
- 0
tests/bugs1611/pr336774/Two.java View File

@@ -0,0 +1,5 @@
class Two implements NodeBacked2 {
public void test() {
projectTo(null);
}
}

+ 11
- 0
tests/bugs1611/pr336880/First.java View File

@@ -0,0 +1,11 @@
interface II {}


aspect X {
public <XXX extends I1, YYY extends I2> YYY II.foo(XXX r, Class<YYY> ct) {
return null;
}
}

interface I1 {}
interface I2 {}

+ 13
- 0
tests/bugs1611/pr336880/Second.java View File

@@ -0,0 +1,13 @@
class C implements II {}

class D {
public static void m() {
C c = new C();
E1 e1 = new E1();
E2 e2 = new E2();
c.foo(e1,e2.getClass());
}
}

class E1 implements I1 {}
class E2 implements I2 {}

+ 34
- 0
tests/src/org/aspectj/systemtest/ajc1611/Ajc1611Tests.java View File

@@ -14,6 +14,9 @@ import java.io.File;

import junit.framework.Test;

import org.aspectj.apache.bcel.classfile.JavaClass;
import org.aspectj.apache.bcel.classfile.Method;
import org.aspectj.systemtest.ajc150.GenericsTests;
import org.aspectj.testing.XMLBasedAjcTestCase;

/**
@@ -21,6 +24,37 @@ import org.aspectj.testing.XMLBasedAjcTestCase;
*/
public class Ajc1611Tests extends org.aspectj.testing.XMLBasedAjcTestCase {

// error without the fix:
// Second.java:8:0::0 Bound mismatch: The generic method foo(R, Class<T>) of type II is not applicable for the arguments (E1,
// Class<capture#1-of ? extends E2>). The inferred type capture#1-of ? extends E2 is not a valid substitute for the bounded
// parameter <R extends I1>
public void testBoundsChecking_pr336880() {
runTest("bounds check confusion");
}

public void testClashingItds_pr336774() {
runTest("clashing itds");
}

public void testBadGenericSigAttribute_pr336745() {
runTest("incorrect signature");
JavaClass jc = GenericsTests.getClass(ajc, "C");
assertNotNull(jc);
Method m = getMethod(jc, "m");
Method mitd = getMethod(jc, "mitd");
assertEquals("<T::LI;>(TT;)V", m.getGenericSignature());
assertEquals("<T::LI;>(TT;)V", mitd.getGenericSignature());
}

private Method getMethod(JavaClass jc, String name) {
for (Method m : jc.getMethods()) {
if (m.getName().equals(name)) {
return m;
}
}
return null;
}

public void testESJP_336471() {
runTest("esjp");
}

+ 14
- 0
tests/src/org/aspectj/systemtest/ajc1611/ajc1611.xml View File

@@ -2,6 +2,20 @@

<suite>

<ajc-test dir="bugs1611/pr336880" title="bounds check confusion">
<compile files="First.java" options="-1.5"/>
<compile files="Second.java" aspectpath="." options="-1.5"/>
</ajc-test>
<ajc-test dir="bugs1611/pr336774" title="clashing itds">
<compile files="First.java" options="-1.5"/>
<compile files="Test.java" aspectpath="." options="-1.5"/>
</ajc-test>
<ajc-test dir="bugs1611/pr336745" title="incorrect signature">
<compile files="Foo.aj" options="-1.5"/>
</ajc-test>
<ajc-test dir="bugs1611/pr336471" title="esjp">
<compile files="Tester.aj" options="-1.5 -Xset:targetRuntime1_6_10=true"/>
<run class="Tester">

Loading…
Cancel
Save