Browse Source

508661: testcode

tags/V1_8_10
Andy Clement 7 years ago
parent
commit
90aa179e2c

+ 8
- 0
tests/bugs1810/508661/A_yes.java View File

@@ -0,0 +1,8 @@
public class A_yes {
@CacheMethodResult
public void m() {
System.out.println("A_yes.m()");
Class[] itfs = A_yes.class.getInterfaces();
System.out.println("A_yes has interface? "+((itfs==null||itfs.length==0)?"no":itfs[0].getName()));
}
}

+ 7
- 0
tests/bugs1810/508661/B_no.java View File

@@ -0,0 +1,7 @@
class B_no {
public void m() {
System.out.println("B_no.m()");
Class[] itfs = B_no.class.getInterfaces();
System.out.println("B_no has interface? "+((itfs==null||itfs.length==0)?"no":itfs[0].getName()));
}
}

+ 4
- 0
tests/bugs1810/508661/CacheMethodResult.java View File

@@ -0,0 +1,4 @@
import java.lang.annotation.*;

@Retention(RetentionPolicy.RUNTIME)
@interface CacheMethodResult {}

+ 10
- 0
tests/bugs1810/508661/CacheMethodResultAspect.java View File

@@ -0,0 +1,10 @@
aspect CacheMethodResultAspect perthis(cache()) {

pointcut cache() : execution(@CacheMethodResult * *.*(..));

Object around() : cache() {
System.out.println("around: "+thisJoinPointStaticPart.getSignature());
return proceed();
}
}


+ 6
- 0
tests/bugs1810/508661/Run.java View File

@@ -0,0 +1,6 @@
public class Run {
public static void main(String []argv) {
new A_yes().m();
new B_no().m();
}
}

+ 10
- 0
tests/bugs1810/508661/aop.xml View File

@@ -0,0 +1,10 @@
<!DOCTYPE aspectj PUBLIC "-//AspectJ//DTD//EN" "http://www.eclipse.org/aspectj/dtd/aspectj.dtd">
<aspectj>
<weaver>
</weaver>

<aspects>
<aspect name="CacheMethodResultAspect" />
</aspects>

</aspectj>

+ 4
- 0
tests/src/org/aspectj/systemtest/ajc1810/Ajc1810Tests.java View File

@@ -24,6 +24,10 @@ import junit.framework.Test;
*/
public class Ajc1810Tests extends org.aspectj.testing.XMLBasedAjcTestCase {

public void testBinding_508661() {
runTest("various ltw");
}
public void testBinding_500035() {
runTest("ataspectj binding");
}

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

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

<suite>

<ajc-test dir="bugs1810/508661" title="various ltw">
<compile options="-1.8" files="CacheMethodResult.java A_yes.java B_no.java Run.java" outjar="classes.jar"/>
<compile options="-1.8 -Xlint:ignore" files="CacheMethodResultAspect.java" outjar="aspects.jar"/>
<run class="Run" ltw="aop.xml">
<stdout>
<line text="around: void A_yes.m()"/>
<line text="A_yes.m()"/>
<line text="A_yes has interface? CacheMethodResultAspect$ajcMightHaveAspect"/>
<line text="B_no.m()"/>
<line text="B_no has interface? no"/>
</stdout>
</run>
</ajc-test>

<ajc-test dir="bugs1810/500035" title="ataspectj binding">
<compile options="-1.8" files="Code.java"/>
<run class="Code">

Loading…
Cancel
Save