Browse Source

remove accidental 1.5 dependency in tests module

tags/V1_5_0M2
acolyer 19 years ago
parent
commit
4ca8479d63

+ 13
- 1
tests/java5/annotations/aspectMembers/a/AnnotatedAspect05.aj View File

package a; package a;


import org.aspectj.lang.annotation.SuppressAjWarnings; import org.aspectj.lang.annotation.SuppressAjWarnings;
import java.lang.annotation.Annotation;


@TypeAnnotation @TypeAnnotation
public aspect AnnotatedAspect05 { public aspect AnnotatedAspect05 {
@MethodAnnotation @MethodAnnotation
@SuppressAjWarnings @SuppressAjWarnings
void around() : call(new(..)) { proceed(); }
Object around() : call(new(..)) { return proceed(); }
public static void main(String[] args) {
java.lang.reflect.Method[] methods = AnnotatedAspect05.class.getDeclaredMethods();
for (int i = 0; i < methods.length; i++) {
if (methods[i].getName().startsWith("ajc$afterThrowing")) {
Annotation annotation = methods[i].getAnnotation(AnyAnnotation.class);
if (annotation == null) {
throw new RuntimeException("advice should be annotated");
}
}
}
}
} }



+ 0
- 18
tests/src/org/aspectj/systemtest/ajc150/Annotations.java View File

package org.aspectj.systemtest.ajc150; package org.aspectj.systemtest.ajc150;


import java.io.File; import java.io.File;
import java.lang.annotation.Annotation;
import java.net.URL;
import java.net.URLClassLoader;


import junit.framework.Test; import junit.framework.Test;


public void testAnnotatedAdvice() { public void testAnnotatedAdvice() {
runTest("annotated advice"); runTest("annotated advice");
try {
File classFile = new File(ajc.getSandboxDirectory(),"a/AnnotatedAspect05.class");
ClassLoader cl = new URLClassLoader(new URL[] {ajc.getSandboxDirectory().toURI().toURL()});
Class c = cl.loadClass("a.AnnotatedAspect05");
Class ann = cl.loadClass("a.AnyAnnotation");
java.lang.reflect.Method[] methods = c.getDeclaredMethods();
for (int i = 0; i < methods.length; i++) {
if (methods[i].getName().startsWith("ajc$afterThrowing")) {
Annotation annotation = methods[i].getAnnotation(ann);
assertNotNull("Should have @AnyAnnotation",annotation);
}
}
} catch (Exception ex) {
fail(ex.getMessage());
}
} }
public void testAnnotatedAdviceWithWrongAnnotationType() { public void testAnnotatedAdviceWithWrongAnnotationType() {

+ 2
- 1
tests/src/org/aspectj/systemtest/ajc150/ajc150.xml View File



<ajc-test dir="java5/annotations/aspectMembers" title="annotated advice"> <ajc-test dir="java5/annotations/aspectMembers" title="annotated advice">
<compile files="a/Annotations.java,a/AnnotatedAspect05.aj" options="-1.5"> <compile files="a/Annotations.java,a/AnnotatedAspect05.aj" options="-1.5">
<message kind="warning" line="16"/>
<message kind="warning" line="17"/>
</compile> </compile>
<run class="a.AnnotatedAspect05"/>
</ajc-test> </ajc-test>


<ajc-test dir="java5/annotations/aspectMembers" title="annotated advice with bad target"> <ajc-test dir="java5/annotations/aspectMembers" title="annotated advice with bad target">

Loading…
Cancel
Save