From: aclement Date: Thu, 16 Feb 2006 18:48:49 +0000 (+0000) Subject: feature: Use ASM for non-woven types: testcode X-Git-Tag: POST_MEMORY_CHANGES~69 X-Git-Url: https://source.dussan.org/?a=commitdiff_plain;h=9ee775954d74a5387b3fd89e0002e659647e99ac;p=aspectj.git feature: Use ASM for non-woven types: testcode --- diff --git a/weaver/testdata/forAsmDelegateTesting/AnnotatedClass.java b/weaver/testdata/forAsmDelegateTesting/AnnotatedClass.java new file mode 100644 index 000000000..033d2e8e5 --- /dev/null +++ b/weaver/testdata/forAsmDelegateTesting/AnnotatedClass.java @@ -0,0 +1,3 @@ +@AnnotationStringElement(stringval="hello") +public class AnnotatedClass { +} diff --git a/weaver/testdata/forAsmDelegateTesting/AnnotatedFields.java b/weaver/testdata/forAsmDelegateTesting/AnnotatedFields.java new file mode 100644 index 000000000..a9cd8e396 --- /dev/null +++ b/weaver/testdata/forAsmDelegateTesting/AnnotatedFields.java @@ -0,0 +1,5 @@ +public class AnnotatedFields { + @SimpleAnnotation3(id=1) int i; + + @SimpleAnnotation3(id=2) String s; +} diff --git a/weaver/testdata/forAsmDelegateTesting/AnnotatedMethods.java b/weaver/testdata/forAsmDelegateTesting/AnnotatedMethods.java new file mode 100644 index 000000000..e7c43a88e --- /dev/null +++ b/weaver/testdata/forAsmDelegateTesting/AnnotatedMethods.java @@ -0,0 +1,10 @@ +public class AnnotatedMethods { + + @SimpleAnnotation3(id=1) + public void method1() { + } + + @SimpleAnnotation3(id=2) + public void method2() { + } +} diff --git a/weaver/testdata/forAsmDelegateTesting/AnnotatedParameters.java b/weaver/testdata/forAsmDelegateTesting/AnnotatedParameters.java new file mode 100644 index 000000000..9cfb2b80b --- /dev/null +++ b/weaver/testdata/forAsmDelegateTesting/AnnotatedParameters.java @@ -0,0 +1,15 @@ +public class AnnotatedParameters { + + + public static void main(@SimpleAnnotation(id=1) String args[]) { + } + + public void foo(@SimpleAnnotation(id=2) int arg1, + @SimpleAnnotation(id=3) @AnnotationEnumElement(enumval=SimpleEnum.Red) String arg2) { + try { + throw new RuntimeException("eee"); + } catch (@SimpleAnnotation(id=5) Exception ex) { + } + } + +} diff --git a/weaver/testdata/forAsmDelegateTesting/AnnotatedWithClassClass.java b/weaver/testdata/forAsmDelegateTesting/AnnotatedWithClassClass.java new file mode 100644 index 000000000..a9dc32138 --- /dev/null +++ b/weaver/testdata/forAsmDelegateTesting/AnnotatedWithClassClass.java @@ -0,0 +1,3 @@ +@AnnotationClassElement(clz=Integer.class) +public class AnnotatedWithClassClass { +} diff --git a/weaver/testdata/forAsmDelegateTesting/AnnotatedWithCombinedAnnotation.java b/weaver/testdata/forAsmDelegateTesting/AnnotatedWithCombinedAnnotation.java new file mode 100644 index 000000000..c63e6bcaf --- /dev/null +++ b/weaver/testdata/forAsmDelegateTesting/AnnotatedWithCombinedAnnotation.java @@ -0,0 +1,3 @@ +@CombinedAnnotation({@SimpleAnnotation(id=4)}) +public class AnnotatedWithCombinedAnnotation { +} diff --git a/weaver/testdata/forAsmDelegateTesting/AnnotatedWithEnumClass.java b/weaver/testdata/forAsmDelegateTesting/AnnotatedWithEnumClass.java new file mode 100644 index 000000000..5f532ff6b --- /dev/null +++ b/weaver/testdata/forAsmDelegateTesting/AnnotatedWithEnumClass.java @@ -0,0 +1,3 @@ +@AnnotationEnumElement(enumval=SimpleEnum.Red) +public class AnnotatedWithEnumClass { +} diff --git a/weaver/testdata/forAsmDelegateTesting/AnnotationClassElement.java b/weaver/testdata/forAsmDelegateTesting/AnnotationClassElement.java new file mode 100644 index 000000000..629bd2155 --- /dev/null +++ b/weaver/testdata/forAsmDelegateTesting/AnnotationClassElement.java @@ -0,0 +1,6 @@ +import java.lang.annotation.*; + +@Retention(RetentionPolicy.RUNTIME) +public @interface AnnotationClassElement { + Class clz(); +} diff --git a/weaver/testdata/forAsmDelegateTesting/AnnotationEnumElement.java b/weaver/testdata/forAsmDelegateTesting/AnnotationEnumElement.java new file mode 100644 index 000000000..201b34ad2 --- /dev/null +++ b/weaver/testdata/forAsmDelegateTesting/AnnotationEnumElement.java @@ -0,0 +1,6 @@ +import java.lang.annotation.*; + +@Retention(RetentionPolicy.RUNTIME) +public @interface AnnotationEnumElement { + SimpleEnum enumval(); +} diff --git a/weaver/testdata/forAsmDelegateTesting/AnnotationStringElement.java b/weaver/testdata/forAsmDelegateTesting/AnnotationStringElement.java new file mode 100644 index 000000000..dc68cf2e9 --- /dev/null +++ b/weaver/testdata/forAsmDelegateTesting/AnnotationStringElement.java @@ -0,0 +1,6 @@ +import java.lang.annotation.*; + +@Retention(RetentionPolicy.RUNTIME) +public @interface AnnotationStringElement { + String stringval(); +} diff --git a/weaver/testdata/forAsmDelegateTesting/AnonymousClassTest.java b/weaver/testdata/forAsmDelegateTesting/AnonymousClassTest.java new file mode 100644 index 000000000..ca1c50101 --- /dev/null +++ b/weaver/testdata/forAsmDelegateTesting/AnonymousClassTest.java @@ -0,0 +1,16 @@ +public class AnonymousClassTest { + + public void foo() { + + new Runnable() { + public void run() {}; + }.run(); + + + } + + class X {} + + static class Y {} + +} \ No newline at end of file diff --git a/weaver/testdata/forAsmDelegateTesting/AspectFromHell.java b/weaver/testdata/forAsmDelegateTesting/AspectFromHell.java new file mode 100644 index 000000000..def65b428 --- /dev/null +++ b/weaver/testdata/forAsmDelegateTesting/AspectFromHell.java @@ -0,0 +1,24 @@ +import java.util.*; + +public aspect AspectFromHell { + + public void Foo.m1() {} + public int Foo.m2() {return 2;} + public void Foo.m3(String s) {} + public Foo.new(String s) {super();} + public int Foo.x; + public List Foo.y; + + + before(): execution(void Goo.m1()) {} + after(): execution(void Goo.m2(String)) { System.err.println(thisJoinPoint);} + void around(int i): execution(void Goo.m3(..)) && args(i) { } + + class Goo { + void m1() {} + void m2(String s) {} + void m3(int i) {} + } +} + + class Foo { } diff --git a/weaver/testdata/forAsmDelegateTesting/AttributeTestClassEM01.java b/weaver/testdata/forAsmDelegateTesting/AttributeTestClassEM01.java new file mode 100644 index 000000000..e8bb5c7f5 --- /dev/null +++ b/weaver/testdata/forAsmDelegateTesting/AttributeTestClassEM01.java @@ -0,0 +1,8 @@ +public class AttributeTestClassEM01 { + + public static void main(String[]argv) { + class S { + public void sayhello() { System.err.println("hello");} + } + } +} diff --git a/weaver/testdata/forAsmDelegateTesting/AttributeTestClassEM02.java b/weaver/testdata/forAsmDelegateTesting/AttributeTestClassEM02.java new file mode 100644 index 000000000..b152854a6 --- /dev/null +++ b/weaver/testdata/forAsmDelegateTesting/AttributeTestClassEM02.java @@ -0,0 +1,8 @@ +public class AttributeTestClassEM02 { + + Runnable r = new Runnable() { + public void run() { System.err.println("hello");} + }; + public static void main(String[]argv) { + } +} diff --git a/weaver/testdata/forAsmDelegateTesting/CombinedAnnotation.java b/weaver/testdata/forAsmDelegateTesting/CombinedAnnotation.java new file mode 100644 index 000000000..a262c868f --- /dev/null +++ b/weaver/testdata/forAsmDelegateTesting/CombinedAnnotation.java @@ -0,0 +1,6 @@ +import java.lang.annotation.*; + +@Retention(RetentionPolicy.RUNTIME) +public @interface CombinedAnnotation { + public SimpleAnnotation[] value(); +} diff --git a/weaver/testdata/forAsmDelegateTesting/Complex.java b/weaver/testdata/forAsmDelegateTesting/Complex.java new file mode 100644 index 000000000..88c17cd51 --- /dev/null +++ b/weaver/testdata/forAsmDelegateTesting/Complex.java @@ -0,0 +1,13 @@ +// Class contains everything, for delegate comparing.. + +public class Complex { + + int field1; + String field2; + Foo[] field3; + + + + static class Foo { + } +} diff --git a/weaver/testdata/forAsmDelegateTesting/ComplexAnnotatedClass.java b/weaver/testdata/forAsmDelegateTesting/ComplexAnnotatedClass.java new file mode 100644 index 000000000..1e6214a4a --- /dev/null +++ b/weaver/testdata/forAsmDelegateTesting/ComplexAnnotatedClass.java @@ -0,0 +1,3 @@ +@ComplexAnnotation(ival=4,bval=2,cval='5',fval=3.0f,dval=33.4,zval=false,jval=56,sval=99) +public class ComplexAnnotatedClass { +} diff --git a/weaver/testdata/forAsmDelegateTesting/ComplexAnnotation.java b/weaver/testdata/forAsmDelegateTesting/ComplexAnnotation.java new file mode 100644 index 000000000..c5a76c71e --- /dev/null +++ b/weaver/testdata/forAsmDelegateTesting/ComplexAnnotation.java @@ -0,0 +1,13 @@ +import java.lang.annotation.*; + +@Retention(RetentionPolicy.RUNTIME) +public @interface ComplexAnnotation { + int ival(); + byte bval(); + char cval(); + long jval(); + double dval(); + boolean zval(); + short sval(); + float fval(); +} diff --git a/weaver/testdata/forAsmDelegateTesting/ErasureTestData.java b/weaver/testdata/forAsmDelegateTesting/ErasureTestData.java new file mode 100644 index 000000000..493f59a14 --- /dev/null +++ b/weaver/testdata/forAsmDelegateTesting/ErasureTestData.java @@ -0,0 +1,7 @@ +import java.util.*; + +public class ErasureTestData { + + public Vector getData() { return null; } + +} diff --git a/weaver/testdata/forAsmDelegateTesting/HelloWorld.java b/weaver/testdata/forAsmDelegateTesting/HelloWorld.java new file mode 100644 index 000000000..9146fed8c --- /dev/null +++ b/weaver/testdata/forAsmDelegateTesting/HelloWorld.java @@ -0,0 +1,14 @@ +import java.io.*; + +public class HelloWorld { + public static void main(String[] argv) { + BufferedReader in = new BufferedReader(new InputStreamReader(System.in)); + String name = null; + + try { + System.out.print("Please enter your name> "); + name = in.readLine(); + } catch(IOException e) { return; } + System.out.println("Hello, " + name); + } + } diff --git a/weaver/testdata/forAsmDelegateTesting/MarkedType.java b/weaver/testdata/forAsmDelegateTesting/MarkedType.java new file mode 100644 index 000000000..2b0948438 --- /dev/null +++ b/weaver/testdata/forAsmDelegateTesting/MarkedType.java @@ -0,0 +1,4 @@ +@MarkerAnnotationInvisible +@MarkerAnnotation +public class MarkedType { +} diff --git a/weaver/testdata/forAsmDelegateTesting/MarkerAnnotation.java b/weaver/testdata/forAsmDelegateTesting/MarkerAnnotation.java new file mode 100644 index 000000000..f314a9432 --- /dev/null +++ b/weaver/testdata/forAsmDelegateTesting/MarkerAnnotation.java @@ -0,0 +1,4 @@ +import java.lang.annotation.*; + +@Retention(RetentionPolicy.RUNTIME) +public @interface MarkerAnnotation { } diff --git a/weaver/testdata/forAsmDelegateTesting/MarkerAnnotationInvisible.java b/weaver/testdata/forAsmDelegateTesting/MarkerAnnotationInvisible.java new file mode 100644 index 000000000..9b41a593a --- /dev/null +++ b/weaver/testdata/forAsmDelegateTesting/MarkerAnnotationInvisible.java @@ -0,0 +1,4 @@ +import java.lang.annotation.*; + +@Retention(RetentionPolicy.CLASS) +public @interface MarkerAnnotationInvisible { } diff --git a/weaver/testdata/forAsmDelegateTesting/PossibleGenericsSigs.java b/weaver/testdata/forAsmDelegateTesting/PossibleGenericsSigs.java new file mode 100644 index 000000000..ee687b280 --- /dev/null +++ b/weaver/testdata/forAsmDelegateTesting/PossibleGenericsSigs.java @@ -0,0 +1,36 @@ +import java.util.*; + +public class PossibleGenericsSigs { + + public void a(List List_String) {} + + public void b(List List_Double) {} + + public void c(List q_extends_Number) {} + + public void d(List q_super_Number) {} + + public void e(List List_q) {} + + public void f(Map Map_q_q_super_Number) {} + + + + > void r(List l) {} + + > T s(Collection col) {return null;} + + static > T t(Collection col) {return null;} + + static > T u(Collection col) {return null;} + + X v(Collection x) {return null;} + + public void w(List>>>> wtf) {} + + static void x(List a,List b) {} + + void y(Map n) {} + + static void z(T[] ts,Collection c) {} +} diff --git a/weaver/testdata/forAsmDelegateTesting/README b/weaver/testdata/forAsmDelegateTesting/README new file mode 100644 index 000000000..e6907208d --- /dev/null +++ b/weaver/testdata/forAsmDelegateTesting/README @@ -0,0 +1,5 @@ +Rebuilding? + +Just do this: + +ajc -1.5 *.java -outjar stuff.jar diff --git a/weaver/testdata/forAsmDelegateTesting/SimpleAnnotatedClass.java b/weaver/testdata/forAsmDelegateTesting/SimpleAnnotatedClass.java new file mode 100644 index 000000000..8d4e4ac95 --- /dev/null +++ b/weaver/testdata/forAsmDelegateTesting/SimpleAnnotatedClass.java @@ -0,0 +1,3 @@ +@SimpleAnnotation(id=4) +public class SimpleAnnotatedClass { +} diff --git a/weaver/testdata/forAsmDelegateTesting/SimpleAnnotation.java b/weaver/testdata/forAsmDelegateTesting/SimpleAnnotation.java new file mode 100644 index 000000000..94291dc13 --- /dev/null +++ b/weaver/testdata/forAsmDelegateTesting/SimpleAnnotation.java @@ -0,0 +1,7 @@ +import java.lang.annotation.*; + +@Retention(RetentionPolicy.SOURCE) +public @interface SimpleAnnotation { + int id(); + String fruit() default "bananas"; +} diff --git a/weaver/testdata/forAsmDelegateTesting/SimpleAnnotation2.java b/weaver/testdata/forAsmDelegateTesting/SimpleAnnotation2.java new file mode 100644 index 000000000..64c4a77d1 --- /dev/null +++ b/weaver/testdata/forAsmDelegateTesting/SimpleAnnotation2.java @@ -0,0 +1,8 @@ +import java.lang.annotation.*; + +@Retention(RetentionPolicy.CLASS) +public @interface SimpleAnnotation2 { + int id(); + String fruit() default "bananas"; +} + diff --git a/weaver/testdata/forAsmDelegateTesting/SimpleAnnotation3.java b/weaver/testdata/forAsmDelegateTesting/SimpleAnnotation3.java new file mode 100644 index 000000000..2f4d94add --- /dev/null +++ b/weaver/testdata/forAsmDelegateTesting/SimpleAnnotation3.java @@ -0,0 +1,8 @@ +import java.lang.annotation.*; + +@Retention(RetentionPolicy.RUNTIME) +public @interface SimpleAnnotation3 { + int id(); + String fruit() default "bananas"; +} + diff --git a/weaver/testdata/forAsmDelegateTesting/SimpleAnnotation4.java b/weaver/testdata/forAsmDelegateTesting/SimpleAnnotation4.java new file mode 100644 index 000000000..24a4c5977 --- /dev/null +++ b/weaver/testdata/forAsmDelegateTesting/SimpleAnnotation4.java @@ -0,0 +1,7 @@ +import java.lang.annotation.*; + +public @interface SimpleAnnotation4 { + int id(); + String fruit() default "bananas"; +} + diff --git a/weaver/testdata/forAsmDelegateTesting/SimpleAspect.java b/weaver/testdata/forAsmDelegateTesting/SimpleAspect.java new file mode 100644 index 000000000..b5c4abe2e --- /dev/null +++ b/weaver/testdata/forAsmDelegateTesting/SimpleAspect.java @@ -0,0 +1,12 @@ +public aspect SimpleAspect { + pointcut p(): call(* *(..)); + + before(): p() { + + } + + int SimpleAspect.i; + + public void SimpleAspect.m() { } + +} diff --git a/weaver/testdata/forAsmDelegateTesting/SimpleClass.java b/weaver/testdata/forAsmDelegateTesting/SimpleClass.java new file mode 100644 index 000000000..9920c4912 --- /dev/null +++ b/weaver/testdata/forAsmDelegateTesting/SimpleClass.java @@ -0,0 +1,5 @@ +public class SimpleClass { + public static void main(String[] argv) { + // Nothing unusual in this class + } +} diff --git a/weaver/testdata/forAsmDelegateTesting/SimpleEnum.java b/weaver/testdata/forAsmDelegateTesting/SimpleEnum.java new file mode 100644 index 000000000..2df536880 --- /dev/null +++ b/weaver/testdata/forAsmDelegateTesting/SimpleEnum.java @@ -0,0 +1 @@ +public enum SimpleEnum { Red,Orange,Yellow,Green,Blue,Indigo,Violet }; diff --git a/weaver/testdata/forAsmDelegateTesting/SimpleGenericsProgram.java b/weaver/testdata/forAsmDelegateTesting/SimpleGenericsProgram.java new file mode 100644 index 000000000..2457a9155 --- /dev/null +++ b/weaver/testdata/forAsmDelegateTesting/SimpleGenericsProgram.java @@ -0,0 +1,26 @@ +import java.util.*; + +class TreasureChest { + + protected Set contents; + + public TreasureChest() { + contents = new HashSet(); + } + + public void add(T o) { + contents.add(o); + } +} + +public class SimpleGenericsProgram { + + public static void main(String []argv) { + TreasureChest tc1 = new TreasureChest(); + TreasureChest tc2 = new TreasureChest(); + + tc1.add("dubloon"); + tc2.add(new Integer("777")); + + } +} diff --git a/weaver/testdata/forAsmDelegateTesting/SimpleGenericsUsage.java b/weaver/testdata/forAsmDelegateTesting/SimpleGenericsUsage.java new file mode 100644 index 000000000..74a8df574 --- /dev/null +++ b/weaver/testdata/forAsmDelegateTesting/SimpleGenericsUsage.java @@ -0,0 +1,12 @@ +import java.util.*; + +public class SimpleGenericsUsage { + + public static void main(String[]argv) { + ArrayList fruits = new ArrayList(); + fruits.add("Oranges"); + fruits.add("Apples"); + fruits.add("Pears"); + System.err.println(fruits.size()+" fruits defined"); + } +} diff --git a/weaver/testdata/forAsmDelegateTesting/SimpleStringAnnotation.java b/weaver/testdata/forAsmDelegateTesting/SimpleStringAnnotation.java new file mode 100644 index 000000000..af3b5ce36 --- /dev/null +++ b/weaver/testdata/forAsmDelegateTesting/SimpleStringAnnotation.java @@ -0,0 +1,6 @@ +import java.lang.annotation.*; + +@Retention(RetentionPolicy.RUNTIME) +public @interface SimpleStringAnnotation { + String fruit(); +} diff --git a/weaver/testdata/forAsmDelegateTesting/SimpleType.java b/weaver/testdata/forAsmDelegateTesting/SimpleType.java new file mode 100644 index 000000000..2b0563bba --- /dev/null +++ b/weaver/testdata/forAsmDelegateTesting/SimpleType.java @@ -0,0 +1,6 @@ +class SimpleType { + public Integer i; + + public void setI(Integer i) { this.i=i;} + public Integer getI() { return i;} +} diff --git a/weaver/testdata/forAsmDelegateTesting/SimpleVarargs.java b/weaver/testdata/forAsmDelegateTesting/SimpleVarargs.java new file mode 100644 index 000000000..3994d2cfb --- /dev/null +++ b/weaver/testdata/forAsmDelegateTesting/SimpleVarargs.java @@ -0,0 +1,12 @@ + +public class SimpleVarargs { + public static void main(String[] argv) { + callfoo("a","b","c","d","e"); + } + + public static void callfoo(Object... args) { + for (int i = 0 ; i