commons-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From mben...@apache.org
Subject svn commit: r1445319 - in /commons/sandbox/weaver/branches/mjb/processor/src: main/java/org/apache/commons/weaver/ test/java/org/apache/commons/weaver/ test/java/org/apache/commons/weaver/test/ test/java/org/apache/commons/weaver/test/beans/
Date Tue, 12 Feb 2013 19:16:20 GMT
Author: mbenson
Date: Tue Feb 12 19:16:20 2013
New Revision: 1445319

URL: http://svn.apache.org/r1445319
Log:
clean up and test annotation inflation

Added:
    commons/sandbox/weaver/branches/mjb/processor/src/test/java/org/apache/commons/weaver/FinderTest.java
  (with props)
    commons/sandbox/weaver/branches/mjb/processor/src/test/java/org/apache/commons/weaver/test/beans/ComplexAnnotations.java
  (with props)
Modified:
    commons/sandbox/weaver/branches/mjb/processor/src/main/java/org/apache/commons/weaver/Finder.java
    commons/sandbox/weaver/branches/mjb/processor/src/test/java/org/apache/commons/weaver/test/WeaverTestBase.java

Modified: commons/sandbox/weaver/branches/mjb/processor/src/main/java/org/apache/commons/weaver/Finder.java
URL: http://svn.apache.org/viewvc/commons/sandbox/weaver/branches/mjb/processor/src/main/java/org/apache/commons/weaver/Finder.java?rev=1445319&r1=1445318&r2=1445319&view=diff
==============================================================================
--- commons/sandbox/weaver/branches/mjb/processor/src/main/java/org/apache/commons/weaver/Finder.java
(original)
+++ commons/sandbox/weaver/branches/mjb/processor/src/main/java/org/apache/commons/weaver/Finder.java
Tue Feb 12 19:16:20 2013
@@ -9,6 +9,7 @@ import java.lang.reflect.Constructor;
 import java.lang.reflect.Field;
 import java.lang.reflect.Method;
 import java.util.ArrayList;
+import java.util.Arrays;
 import java.util.IdentityHashMap;
 import java.util.LinkedHashMap;
 import java.util.List;
@@ -36,11 +37,7 @@ class Finder extends AnnotationFinder {
 
         AnnotationInflater(String desc) {
             super();
-            try {
-                this.annotationType = Class.forName(Type.getType(desc).getClassName()).asSubclass(Annotation.class);
-            } catch (ClassNotFoundException e) {
-                throw new RuntimeException(e);
-            }
+            this.annotationType = toClass(Type.getType(desc)).asSubclass(Annotation.class);
         }
 
         Annotation inflate() {
@@ -51,17 +48,26 @@ class Finder extends AnnotationFinder {
         protected void storeValue(String name, Object value) {
             Validate.notNull(value, "null annotation element");
             if (value.getClass().isArray()) {
-                final int len = Array.getLength(value);
-                final Object typedArray;
+                final Class<?> requiredType;
                 try {
-                    typedArray =
-                        Array.newInstance(annotationType.getDeclaredMethod(name).getReturnType().getComponentType(),
-                            len);
+                    requiredType = annotationType.getDeclaredMethod(name).getReturnType();
                 } catch (Exception e) {
                     throw new RuntimeException(e);
                 }
-                System.arraycopy(value, 0, typedArray, 0, len);
-                value = typedArray;
+                if (!requiredType.isInstance(value)) {
+                    final int len = Array.getLength(value);
+                    final Object typedArray = Array.newInstance(requiredType.getComponentType(),
len);
+                    for (int i = 0; i < len; i++) {
+                        Object o = Array.get(value, i);
+                        if (o instanceof Type) {
+                            o = toClass((Type) o);
+                        }
+                        Array.set(typedArray, i, o);
+                    }
+                    value = typedArray;
+                }
+            } else if (value instanceof Type) {
+                value = toClass((Type) value);
             }
             elements.put(name, value);
         }
@@ -460,6 +466,21 @@ class Finder extends AnnotationFinder {
             }
         };
 
+    private static Class<?> toClass(Type type) {
+        Class<?> result;
+        try {
+            result = Class.forName((type.getSort() == Type.ARRAY ? type.getElementType()
: type).getClassName());
+        } catch (ClassNotFoundException e) {
+            throw new RuntimeException(e);
+        }
+        if (type.getSort() == Type.ARRAY) {
+            int[] dims = new int[type.getDimensions()];
+            Arrays.fill(dims, 0);
+            result = Array.newInstance(result, dims).getClass();
+        }
+        return result;
+    }
+
     private final Map<Info, List<Annotation>> classfileAnnotations;
 
     public Finder(Archive archive) {

Added: commons/sandbox/weaver/branches/mjb/processor/src/test/java/org/apache/commons/weaver/FinderTest.java
URL: http://svn.apache.org/viewvc/commons/sandbox/weaver/branches/mjb/processor/src/test/java/org/apache/commons/weaver/FinderTest.java?rev=1445319&view=auto
==============================================================================
--- commons/sandbox/weaver/branches/mjb/processor/src/test/java/org/apache/commons/weaver/FinderTest.java
(added)
+++ commons/sandbox/weaver/branches/mjb/processor/src/test/java/org/apache/commons/weaver/FinderTest.java
Tue Feb 12 19:16:20 2013
@@ -0,0 +1,238 @@
+package org.apache.commons.weaver;
+
+import static org.apache.commons.weaver.test.beans.ComplexAnnotations.Stooge.CURLY;
+import static org.apache.commons.weaver.test.beans.ComplexAnnotations.Stooge.LARRY;
+import static org.apache.commons.weaver.test.beans.ComplexAnnotations.Stooge.MOE;
+import static org.apache.commons.weaver.test.beans.ComplexAnnotations.Stooge.SHEMP;
+import static org.junit.Assert.assertArrayEquals;
+import static org.junit.Assert.assertEquals;
+import static org.junit.Assert.assertFalse;
+import static org.junit.Assert.assertSame;
+import static org.junit.Assert.assertTrue;
+
+import java.io.IOException;
+import java.lang.reflect.Field;
+import java.net.URLClassLoader;
+import java.util.Arrays;
+import java.util.HashMap;
+import java.util.Map;
+
+import org.apache.commons.weaver.test.WeaverTestBase;
+import org.apache.commons.weaver.test.beans.ComplexAnnotations;
+import org.apache.commons.weaver.test.beans.ComplexAnnotations.NestAnnotation;
+import org.apache.commons.weaver.test.beans.ComplexAnnotations.Stooge;
+import org.apache.commons.weaver.test.beans.ComplexAnnotations.TestAnnotation;
+import org.apache.commons.weaver.utils.URLArray;
+import org.apache.xbean.finder.Annotated;
+import org.apache.xbean.finder.archive.FileArchive;
+import org.junit.Test;
+
+public class FinderTest extends WeaverTestBase {
+
+    private Finder finder() {
+        final ClassLoader classLoader = new URLClassLoader(URLArray.fromPaths(getClassPathEntries()));
+        return new Finder(new FileArchive(classLoader, getTargetFolder()));
+    }
+
+    /**
+     * The point of this is to prove that we can correctly hydate instances of
+     * annotations with class retention.
+     * 
+     * @throws IOException
+     */
+    @Test
+    public void testElements() throws IOException {
+        addClassForScanning(ComplexAnnotations.class);
+        Map<String, Annotated<Field>> fields = new HashMap<String, Annotated<Field>>();
+        for (Annotated<Field> annotated : finder().withAnnotations().findAnnotatedFields(
+            ComplexAnnotations.TestAnnotation.class)) {
+            fields.put(annotated.get().getName(), annotated);
+        }
+        assertEquals(2, fields.size());
+
+        TestAnnotation anno1 = fields.get("dummy1").getAnnotation(TestAnnotation.class);
+
+        assertFalse(anno1.booleanValue());
+        assertTrue(Arrays.equals(new boolean[] { false }, anno1.booleanValues()));
+        assertEquals((byte) 0, anno1.byteValue());
+        assertArrayEquals(new byte[] { 0 }, anno1.byteValues());
+        assertEquals((char) 0, anno1.charValue());
+        assertArrayEquals(new char[] { 0 }, anno1.charValues());
+        assertEquals(Double.valueOf(0.0), Double.valueOf(anno1.doubleValue()));
+        assertTrue(Arrays.equals(new double[] { 0.0 }, anno1.doubleValues()));
+        assertEquals(Float.valueOf(0.0f), Float.valueOf(anno1.floatValue()));
+        assertTrue(Arrays.equals(new float[] { 0.0f }, anno1.floatValues()));
+        assertEquals(0, anno1.intValue());
+        assertArrayEquals(new int[] { 0 }, anno1.intValues());
+        assertEquals(0L, anno1.longValue());
+        assertArrayEquals(new long[] { 0L }, anno1.longValues());
+
+        NestAnnotation nest1 = anno1.nest();
+        assertFalse(nest1.booleanValue());
+        assertTrue(Arrays.equals(new boolean[] { false }, nest1.booleanValues()));
+        assertEquals((byte) 0, nest1.byteValue());
+        assertArrayEquals(new byte[] { 0 }, nest1.byteValues());
+        assertEquals((char) 0, nest1.charValue());
+        assertArrayEquals(new char[] { 0 }, nest1.charValues());
+        assertEquals(Double.valueOf(0.0), Double.valueOf(nest1.doubleValue()));
+        assertTrue(Arrays.equals(new double[] { 0.0 }, nest1.doubleValues()));
+        assertEquals(Float.valueOf(0.0f), Float.valueOf(nest1.floatValue()));
+        assertTrue(Arrays.equals(new float[] { 0.0f }, nest1.floatValues()));
+        assertEquals(0, nest1.intValue());
+        assertArrayEquals(new int[] { 0 }, nest1.intValues());
+        assertEquals(0L, nest1.longValue());
+        assertArrayEquals(new long[] { 0L }, nest1.longValues());
+        assertEquals((short) 0, nest1.shortValue());
+        assertArrayEquals(new short[] { 0 }, nest1.shortValues());
+        assertSame(CURLY, nest1.stooge());
+        assertArrayEquals(new Stooge[] { MOE, LARRY, SHEMP }, nest1.stooges());
+        assertEquals("", nest1.string());
+        assertArrayEquals(new String[] { "" }, nest1.strings());
+        assertEquals(Object.class, nest1.type());
+        assertArrayEquals(new Class[] { Object.class }, nest1.types());
+
+        assertEquals(1, anno1.nests().length);
+        NestAnnotation nest1_0 = anno1.nests()[0];
+        assertFalse(nest1_0.booleanValue());
+        assertTrue(Arrays.equals(new boolean[] { false }, nest1_0.booleanValues()));
+        assertEquals((byte) 0, nest1_0.byteValue());
+        assertArrayEquals(new byte[] { 0 }, nest1_0.byteValues());
+        assertEquals((char) 0, nest1_0.charValue());
+        assertArrayEquals(new char[] { 0 }, nest1_0.charValues());
+        assertEquals(Double.valueOf(0.0), Double.valueOf(nest1_0.doubleValue()));
+        assertTrue(Arrays.equals(new double[] { 0.0 }, nest1_0.doubleValues()));
+        assertEquals(Float.valueOf(0.0f), Float.valueOf(nest1_0.floatValue()));
+        assertTrue(Arrays.equals(new float[] { 0.0f }, nest1_0.floatValues()));
+        assertEquals(0, nest1_0.intValue());
+        assertArrayEquals(new int[] { 0 }, nest1_0.intValues());
+        assertEquals(0L, nest1_0.longValue());
+        assertArrayEquals(new long[] { 0L }, nest1_0.longValues());
+        assertEquals((short) 0, nest1_0.shortValue());
+        assertArrayEquals(new short[] { 0 }, nest1_0.shortValues());
+        assertSame(CURLY, nest1_0.stooge());
+        assertArrayEquals(new Stooge[] { MOE, LARRY, SHEMP }, nest1_0.stooges());
+        assertEquals("", nest1_0.string());
+        assertArrayEquals(new String[] { "" }, nest1_0.strings());
+        assertEquals(Object[].class, nest1_0.type());
+        assertArrayEquals(new Class[] { Object[].class }, nest1_0.types());
+
+        assertEquals((short) 0, anno1.shortValue());
+        assertArrayEquals(new short[] { 0 }, anno1.shortValues());
+        assertSame(SHEMP, anno1.stooge());
+        assertArrayEquals(new Stooge[] { MOE, LARRY, CURLY }, anno1.stooges());
+        assertEquals("", anno1.string());
+        assertArrayEquals(new String[] { "" }, anno1.strings());
+        assertEquals(Object.class, anno1.type());
+        assertArrayEquals(new Class[] { Object.class }, anno1.types());
+
+        TestAnnotation anno2 = fields.get("dummy2").getAnnotation(TestAnnotation.class);
+        assertFalse(anno2.booleanValue());
+        assertTrue(Arrays.equals(new boolean[] { false }, anno2.booleanValues()));
+        assertEquals((byte) 0, anno2.byteValue());
+        assertArrayEquals(new byte[] { 0 }, anno2.byteValues());
+        assertEquals((char) 0, anno2.charValue());
+        assertArrayEquals(new char[] { 0 }, anno2.charValues());
+        assertEquals(Double.valueOf(0.0), Double.valueOf(anno2.doubleValue()));
+        assertTrue(Arrays.equals(new double[] { 0.0 }, anno2.doubleValues()));
+        assertEquals(Float.valueOf(0.0f), Float.valueOf(anno2.floatValue()));
+        assertTrue(Arrays.equals(new float[] { 0.0f }, anno2.floatValues()));
+        assertEquals(0, anno2.intValue());
+        assertArrayEquals(new int[] { 0 }, anno2.intValues());
+        assertEquals(0L, anno2.longValue());
+        assertArrayEquals(new long[] { 0L }, anno2.longValues());
+
+        NestAnnotation nest2 = anno2.nest();
+        assertFalse(nest2.booleanValue());
+        assertTrue(Arrays.equals(new boolean[] { false }, nest2.booleanValues()));
+        assertEquals((byte) 0, nest2.byteValue());
+        assertArrayEquals(new byte[] { 0 }, nest2.byteValues());
+        assertEquals((char) 0, nest2.charValue());
+        assertArrayEquals(new char[] { 0 }, nest2.charValues());
+        assertEquals(Double.valueOf(0.0), Double.valueOf(nest2.doubleValue()));
+        assertTrue(Arrays.equals(new double[] { 0.0 }, nest2.doubleValues()));
+        assertEquals(Float.valueOf(0.0f), Float.valueOf(nest2.floatValue()));
+        assertTrue(Arrays.equals(new float[] { 0.0f }, nest2.floatValues()));
+        assertEquals(0, nest2.intValue());
+        assertArrayEquals(new int[] { 0 }, nest2.intValues());
+        assertEquals(0L, nest2.longValue());
+        assertArrayEquals(new long[] { 0L }, nest2.longValues());
+        assertEquals((short) 0, nest2.shortValue());
+        assertArrayEquals(new short[] { 0 }, nest2.shortValues());
+        assertSame(CURLY, nest2.stooge());
+        assertArrayEquals(new Stooge[] { MOE, LARRY, SHEMP }, nest2.stooges());
+        assertEquals("", nest2.string());
+        assertArrayEquals(new String[] { "" }, nest2.strings());
+        assertEquals(Object.class, nest2.type());
+        assertArrayEquals(new Class[] { Object.class }, nest2.types());
+
+        assertEquals(2, anno2.nests().length);
+        NestAnnotation nest2_0 = anno2.nests()[0];
+        assertFalse(nest2_0.booleanValue());
+        assertTrue(Arrays.equals(new boolean[] { false }, nest2_0.booleanValues()));
+        assertEquals((byte) 0, nest2_0.byteValue());
+        assertArrayEquals(new byte[] { 0 }, nest2_0.byteValues());
+        assertEquals((char) 0, nest2_0.charValue());
+        assertArrayEquals(new char[] { 0 }, nest2_0.charValues());
+        assertEquals(Double.valueOf(0.0), Double.valueOf(nest2_0.doubleValue()));
+        assertTrue(Arrays.equals(new double[] { 0.0 }, nest2_0.doubleValues()));
+        assertEquals(Float.valueOf(0.0f), Float.valueOf(nest2_0.floatValue()));
+        assertTrue(Arrays.equals(new float[] { 0.0f }, nest2_0.floatValues()));
+        assertEquals(0, nest2_0.intValue());
+        assertArrayEquals(new int[] { 0 }, nest2_0.intValues());
+        assertEquals(0L, nest2_0.longValue());
+        assertArrayEquals(new long[] { 0L }, nest2_0.longValues());
+        assertEquals((short) 0, nest2_0.shortValue());
+        assertArrayEquals(new short[] { 0 }, nest2_0.shortValues());
+        assertSame(CURLY, nest2_0.stooge());
+        assertArrayEquals(new Stooge[] { MOE, LARRY, SHEMP }, nest2_0.stooges());
+        assertEquals("", nest2_0.string());
+        assertArrayEquals(new String[] { "" }, nest2_0.strings());
+        assertEquals(Object[].class, nest2_0.type());
+        assertArrayEquals(new Class[] { Object[].class }, nest2_0.types());
+
+        NestAnnotation nest2_1 = anno2.nests()[1];
+        assertFalse(nest2_1.booleanValue());
+        assertTrue(Arrays.equals(new boolean[] { false }, nest2_1.booleanValues()));
+        assertEquals((byte) 0, nest2_1.byteValue());
+        assertArrayEquals(new byte[] { 0 }, nest2_1.byteValues());
+        assertEquals((char) 0, nest2_1.charValue());
+        assertArrayEquals(new char[] { 0 }, nest2_1.charValues());
+        assertEquals(Double.valueOf(0.0), Double.valueOf(nest2_1.doubleValue()));
+        assertTrue(Arrays.equals(new double[] { 0.0 }, nest2_1.doubleValues()));
+        assertEquals(Float.valueOf(0.0f), Float.valueOf(nest2_1.floatValue()));
+        assertTrue(Arrays.equals(new float[] { 0.0f }, nest2_1.floatValues()));
+        assertEquals(0, nest2_1.intValue());
+        assertArrayEquals(new int[] { 0 }, nest2_1.intValues());
+        assertEquals(0L, nest2_1.longValue());
+        assertArrayEquals(new long[] { 0L }, nest2_1.longValues());
+        assertEquals((short) 0, nest2_1.shortValue());
+        assertArrayEquals(new short[] { 0 }, nest2_1.shortValues());
+        assertSame(CURLY, nest2_1.stooge());
+        assertArrayEquals(new Stooge[] { MOE, LARRY, SHEMP }, nest2_1.stooges());
+        assertEquals("", nest2_1.string());
+        assertArrayEquals(new String[] { "" }, nest2_1.strings());
+        assertEquals(Object[].class, nest2_1.type());
+        assertArrayEquals(new Class[] { Object[].class }, nest2_1.types());
+
+        assertEquals((short) 0, anno2.shortValue());
+        assertArrayEquals(new short[] { 0 }, anno2.shortValues());
+        assertSame(SHEMP, anno2.stooge());
+        assertArrayEquals(new Stooge[] { MOE, LARRY, CURLY }, anno2.stooges());
+        assertEquals("", anno2.string());
+        assertArrayEquals(new String[] { "" }, anno2.strings());
+        assertEquals(Object.class, anno2.type());
+        assertArrayEquals(new Class[] { Object.class }, anno2.types());
+    }
+
+    @Test
+    public void testObjectMethods() throws IOException {
+        addClassForScanning(ComplexAnnotations.class);
+        for (Annotated<Field> annotated : finder().withAnnotations().findAnnotatedFields(
+            ComplexAnnotations.TestAnnotation.class)) {
+            TestAnnotation anno = annotated.getAnnotation(TestAnnotation.class);
+            assertFalse(anno.toString().isEmpty());
+            assertFalse(anno.hashCode() == 0);
+            assertTrue(anno.equals(anno));
+        }
+    }
+}

Propchange: commons/sandbox/weaver/branches/mjb/processor/src/test/java/org/apache/commons/weaver/FinderTest.java
------------------------------------------------------------------------------
    svn:eol-style = native

Modified: commons/sandbox/weaver/branches/mjb/processor/src/test/java/org/apache/commons/weaver/test/WeaverTestBase.java
URL: http://svn.apache.org/viewvc/commons/sandbox/weaver/branches/mjb/processor/src/test/java/org/apache/commons/weaver/test/WeaverTestBase.java?rev=1445319&r1=1445318&r2=1445319&view=diff
==============================================================================
--- commons/sandbox/weaver/branches/mjb/processor/src/test/java/org/apache/commons/weaver/test/WeaverTestBase.java
(original)
+++ commons/sandbox/weaver/branches/mjb/processor/src/test/java/org/apache/commons/weaver/test/WeaverTestBase.java
Tue Feb 12 19:16:20 2013
@@ -48,17 +48,18 @@ public abstract class WeaverTestBase {
     }
 
     /**
-     * Add a class to the temporary folder.
+     * Add a class (and its inner classes) to the temporary folder.
      * @param clazz
      */
-    protected void addClassForScanning(Class clazz) throws IOException{
+    protected void addClassForScanning(Class<?> clazz) throws IOException {
         String clazzDirName = clazz.getPackage().getName().replace(".", "/");
         File targetDirFile = new File(getTargetFolder(), clazzDirName);
         targetDirFile.mkdirs();
 
-        String clazzFileName =  clazzDirName + "/" + clazz.getSimpleName() + ".class";
+        String fileName = baseName(clazz) + ".class";
+        String clazzFileName =  clazzDirName + "/" + fileName;
         URL clazzUrl = getClass().getClassLoader().getResource(clazzFileName);
-        File targetClazzFile = new File(targetDirFile, clazz.getSimpleName() + ".class");
+        File targetClazzFile = new File(targetDirFile, fileName);
 
         byte[] buffer = new byte[0xFFFF];
 
@@ -71,6 +72,26 @@ public abstract class WeaverTestBase {
         }
         fos.flush();
         fos.close();
+        
+        for (Class<?> inner : clazz.getClasses()) {
+            addClassForScanning(inner);
+        }
+    }
+
+    private String baseName(Class<?> clazz) {
+        if (clazz.getDeclaringClass() == null) {
+            return clazz.getSimpleName();
+        }
+        final StringBuilder result = new StringBuilder();
+        Class<?> current = clazz;
+        while (current != null) {
+            if (result.length() > 0) {
+                result.insert(0, '$');
+            }
+            result.insert(0, current.getSimpleName());
+            current = current.getDeclaringClass();
+        }
+        return result.toString();
     }
 
     /**

Added: commons/sandbox/weaver/branches/mjb/processor/src/test/java/org/apache/commons/weaver/test/beans/ComplexAnnotations.java
URL: http://svn.apache.org/viewvc/commons/sandbox/weaver/branches/mjb/processor/src/test/java/org/apache/commons/weaver/test/beans/ComplexAnnotations.java?rev=1445319&view=auto
==============================================================================
--- commons/sandbox/weaver/branches/mjb/processor/src/test/java/org/apache/commons/weaver/test/beans/ComplexAnnotations.java
(added)
+++ commons/sandbox/weaver/branches/mjb/processor/src/test/java/org/apache/commons/weaver/test/beans/ComplexAnnotations.java
Tue Feb 12 19:16:20 2013
@@ -0,0 +1,262 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one or more
+ * contributor license agreements.  See the NOTICE file distributed with
+ * this work for additional information regarding copyright ownership.
+ * The ASF licenses this file to You under the Apache License, Version 2.0
+ * (the "License"); you may not use this file except in compliance with
+ * the License.  You may obtain a copy of the License at
+ *
+ *      http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+package org.apache.commons.weaver.test.beans;
+
+import static java.lang.annotation.ElementType.FIELD;
+import static org.apache.commons.weaver.test.beans.ComplexAnnotations.Stooge.CURLY;
+import static org.apache.commons.weaver.test.beans.ComplexAnnotations.Stooge.LARRY;
+import static org.apache.commons.weaver.test.beans.ComplexAnnotations.Stooge.MOE;
+import static org.apache.commons.weaver.test.beans.ComplexAnnotations.Stooge.SHEMP;
+
+import java.lang.annotation.Target;
+
+public class ComplexAnnotations {
+    @TestAnnotation(
+            booleanValue = false,
+            booleanValues = { false },
+            byteValue = 0,
+            byteValues = { 0 },
+            charValue = 0,
+            charValues = { 0 },
+            doubleValue = 0,
+            doubleValues = { 0 },
+            floatValue = 0,
+            floatValues = { 0 },
+            intValue = 0,
+            intValues = { 0 },
+            longValue = 0,
+            longValues = { 0 },
+            nest = @NestAnnotation(
+                    booleanValue = false,
+                    booleanValues = { false },
+                    byteValue = 0,
+                    byteValues = { 0 },
+                    charValue = 0,
+                    charValues = { 0 },
+                    doubleValue = 0,
+                    doubleValues = { 0 },
+                    floatValue = 0,
+                    floatValues = { 0 },
+                    intValue = 0,
+                    intValues = { 0 },
+                    longValue = 0,
+                    longValues = { 0 },
+                    shortValue = 0,
+                    shortValues = { 0 },
+                    stooge = CURLY,
+                    stooges = { MOE, LARRY, SHEMP },
+                    string = "",
+                    strings = { "" },
+                    type = Object.class,
+                    types = { Object.class }
+            ),
+            nests = {
+                @NestAnnotation(
+                        booleanValue = false,
+                        booleanValues = { false },
+                        byteValue = 0,
+                        byteValues = { 0 },
+                        charValue = 0,
+                        charValues = { 0 },
+                        doubleValue = 0,
+                        doubleValues = { 0 },
+                        floatValue = 0,
+                        floatValues = { 0 },
+                        intValue = 0,
+                        intValues = { 0 },
+                        longValue = 0,
+                        longValues = { 0 },
+                        shortValue = 0,
+                        shortValues = { 0 },
+                        stooge = CURLY,
+                        stooges = { MOE, LARRY, SHEMP },
+                        string = "",
+                        strings = { "" },
+                        type = Object[].class,
+                        types = { Object[].class }
+                )
+            },
+            shortValue = 0,
+            shortValues = { 0 },
+            stooge = SHEMP,
+            stooges = { MOE, LARRY, CURLY },
+            string = "",
+            strings = { "" },
+            type = Object.class,
+            types = { Object.class }
+    )
+    public Object dummy1;
+
+    @TestAnnotation(
+            booleanValue = false,
+            booleanValues = { false },
+            byteValue = 0,
+            byteValues = { 0 },
+            charValue = 0,
+            charValues = { 0 },
+            doubleValue = 0,
+            doubleValues = { 0 },
+            floatValue = 0,
+            floatValues = { 0 },
+            intValue = 0,
+            intValues = { 0 },
+            longValue = 0,
+            longValues = { 0 },
+            nest = @NestAnnotation(
+                    booleanValue = false,
+                    booleanValues = { false },
+                    byteValue = 0,
+                    byteValues = { 0 },
+                    charValue = 0,
+                    charValues = { 0 },
+                    doubleValue = 0,
+                    doubleValues = { 0 },
+                    floatValue = 0,
+                    floatValues = { 0 },
+                    intValue = 0,
+                    intValues = { 0 },
+                    longValue = 0,
+                    longValues = { 0 },
+                    shortValue = 0,
+                    shortValues = { 0 },
+                    stooge = CURLY,
+                    stooges = { MOE, LARRY, SHEMP },
+                    string = "",
+                    strings = { "" },
+                    type = Object.class,
+                    types = { Object.class }
+            ),
+            nests = {
+                @NestAnnotation(
+                        booleanValue = false,
+                        booleanValues = { false },
+                        byteValue = 0,
+                        byteValues = { 0 },
+                        charValue = 0,
+                        charValues = { 0 },
+                        doubleValue = 0,
+                        doubleValues = { 0 },
+                        floatValue = 0,
+                        floatValues = { 0 },
+                        intValue = 0,
+                        intValues = { 0 },
+                        longValue = 0,
+                        longValues = { 0 },
+                        shortValue = 0,
+                        shortValues = { 0 },
+                        stooge = CURLY,
+                        stooges = { MOE, LARRY, SHEMP },
+                        string = "",
+                        strings = { "" },
+                        type = Object[].class,
+                        types = { Object[].class }
+                ),
+                //add a second NestAnnotation:
+                @NestAnnotation(
+                        booleanValue = false,
+                        booleanValues = { false },
+                        byteValue = 0,
+                        byteValues = { 0 },
+                        charValue = 0,
+                        charValues = { 0 },
+                        doubleValue = 0,
+                        doubleValues = { 0 },
+                        floatValue = 0,
+                        floatValues = { 0 },
+                        intValue = 0,
+                        intValues = { 0 },
+                        longValue = 0,
+                        longValues = { 0 },
+                        shortValue = 0,
+                        shortValues = { 0 },
+                        stooge = CURLY,
+                        stooges = { MOE, LARRY, SHEMP },
+                        string = "",
+                        strings = { "" },
+                        type = Object[].class,
+                        types = { Object[].class }
+                )
+            },
+            shortValue = 0,
+            shortValues = { 0 },
+            stooge = SHEMP,
+            stooges = { MOE, LARRY, CURLY },
+            string = "",
+            strings = { "" },
+            type = Object.class,
+            types = { Object.class }
+    )
+    public Object dummy2;
+
+    @Target(FIELD)
+    public @interface TestAnnotation {
+        String string();
+        String[] strings();
+        Class<?> type();
+        Class<?>[] types();
+        byte byteValue();
+        byte[] byteValues();
+        short shortValue();
+        short[] shortValues();
+        int intValue();
+        int[] intValues();
+        char charValue();
+        char[] charValues();
+        long longValue();
+        long[] longValues();
+        float floatValue();
+        float[] floatValues();
+        double doubleValue();
+        double[] doubleValues();
+        boolean booleanValue();
+        boolean[] booleanValues();
+        Stooge stooge();
+        Stooge[] stooges();
+        NestAnnotation nest();
+        NestAnnotation[] nests();
+    }
+
+    public @interface NestAnnotation {
+        String string();
+        String[] strings();
+        Class<?> type();
+        Class<?>[] types();
+        byte byteValue();
+        byte[] byteValues();
+        short shortValue();
+        short[] shortValues();
+        int intValue();
+        int[] intValues();
+        char charValue();
+        char[] charValues();
+        long longValue();
+        long[] longValues();
+        float floatValue();
+        float[] floatValues();
+        double doubleValue();
+        double[] doubleValues();
+        boolean booleanValue();
+        boolean[] booleanValues();
+        Stooge stooge();
+        Stooge[] stooges();
+    }
+
+    public static enum Stooge {
+        MOE, LARRY, CURLY, SHEMP, JOE;
+    }
+
+}

Propchange: commons/sandbox/weaver/branches/mjb/processor/src/test/java/org/apache/commons/weaver/test/beans/ComplexAnnotations.java
------------------------------------------------------------------------------
    svn:eol-style = native



Mime
View raw message