瀏覽代碼

203367: testcase added

tags/V1_6_1rc1
aclement 16 年之前
父節點
當前提交
11ebdd83e5

+ 43
- 0
tests/bugs161/pr203367/CantMatchOnInterfaceIntroducedToGenericClass.java 查看文件

@@ -0,0 +1,43 @@
package bug; // I used a "bug" package under the "src" source folder.

public aspect CantMatchOnInterfaceIntroducedToGenericClass {
public static interface Marker {}
public static class NonGenericClass {
public void doit(String msg) {
System.out.println("doit(): msg = "+msg);
}
}
public static class GenericClass<T> {
public void doit(T t) {
System.out.println("doit<T>(): t = "+t);
}
}

declare parents: NonGenericClass implements Marker;
declare parents: GenericClass implements Marker;

pointcut nonGenericCall(): call (void NonGenericClass.doit(..));
pointcut genericCall(): call (void GenericClass.doit(..));
pointcut markerCall(): call (void Marker+.doit(..));

private static int mCount = 0;
before(): nonGenericCall() {
System.out.println("nonGenericCall advice hit");
}
before(): genericCall() {
System.out.println("genericCall advice hit");
}
before(): markerCall() {
mCount++;
System.out.println("markerCall advice hit");
}

public static void main(String args[]) {
new NonGenericClass().doit("message1");
new GenericClass<Integer>().doit(new Integer(2));
if (mCount!=2) {
throw new RuntimeException("Did not hit marker+ advice twice!");
}
}
}

+ 1
- 0
tests/src/org/aspectj/systemtest/ajc161/Ajc161Tests.java 查看文件

@@ -23,6 +23,7 @@ import org.aspectj.testing.XMLBasedAjcTestCase;
public class Ajc161Tests extends org.aspectj.testing.XMLBasedAjcTestCase {
// AspectJ1.6.1
public void testGenericMarkerMatch_pr203367() { runTest("generic marker match");}
// public void testSuperItds_pr134425() { runTest("super itds"); }
public void testSuperItds_pr198196_1() { runTest("super itds - 2"); }
public void testSuperItds_pr198196_2() { runTest("super itds - 3"); }

+ 5
- 0
tests/src/org/aspectj/systemtest/ajc161/ajc161.xml 查看文件

@@ -3,6 +3,11 @@
<!-- AspectJ v1.6.1 Tests -->
<suite>

<ajc-test dir="bugs161/pr203367" title="generic marker match">
<compile files="CantMatchOnInterfaceIntroducedToGenericClass.java" options="-1.5"/>
<run class="bug.CantMatchOnInterfaceIntroducedToGenericClass"/>
</ajc-test>
<ajc-test dir="bugs161/pr198196" title="super itds - 2">
<compile files="Marker.java Foo.java MarkerAspect2.java"/>
<run class="Foo">

Loading…
取消
儲存