Package org.codehaus.backport175.compiler.bytecode

Examples of org.codehaus.backport175.compiler.bytecode.AnnotationEnhancer


        Target5.Test test = (Target5.Test)reader;
        assertEquals("test", test.test());
    }

    public void testJava5FieldAnnotation() {
        Annotation reader = org.codehaus.backport175.reader.Annotations.getAnnotation(
                Target5.Test.class, Target5.FIELD
        );
        Class type = reader.annotationType();
        assertEquals(Target5.Test.class, type);

        Target5.Test test = (Target5.Test)reader;
        assertEquals("test", test.test());
    }
View Full Code Here


        AnnotationElement.Annotation e = AnnotationDefaults.getDefaults(Target5.DefaultedTest.class);
        assertEquals(2, e.getElements().size());
        assertEquals("test=1", (e.getElements().get(0)).toString());
        assertEquals("test2=default", (e.getElements().get(1)).toString());

        Annotation defaulted = Annotations.getAnnotation(Target5.DefaultedTest.class, Target5.class);
        assertNotNull(defaulted);
        assertEquals(1, ((Target5.DefaultedTest)defaulted).test());
        assertEquals("notdefault", ((Target5.DefaultedTest)defaulted).test2());
    }
View Full Code Here

        assertEquals("hello", ann.value());
    }

    public void testFieldAnn3() {
        final AnnotationReader reader = AnnotationReader.getReaderFor(Target.FIELD.getDeclaringClass());
        Annotation annotation = reader.getAnnotation("test.TestAnnotations$Simple", Target.FIELD);
        Class type = annotation.annotationType();
        assertEquals(TestAnnotations.Simple.class, type);

        TestAnnotations.Simple ann = (TestAnnotations.Simple)annotation;
        assertEquals("foo", ann.val());
        assertEquals("bar", ann.s());
View Full Code Here

        assertEquals("bar", ann.s());
    }

    public void testFieldAnn4() {
        final AnnotationReader reader = AnnotationReader.getReaderFor(Target.FIELD.getDeclaringClass());
        Annotation annotation = reader.getAnnotation("test.TestAnnotations$StringArray", Target.FIELD);
        Class type = annotation.annotationType();
        assertEquals(TestAnnotations.StringArray.class, type);

        TestAnnotations.StringArray ann = (TestAnnotations.StringArray)annotation;
        String[] ss = ann.ss();
        assertEquals("hello", ss[0]);
View Full Code Here

        assertEquals("world", ss[1]);
    }

    public void testFieldAnn5() {
        final AnnotationReader reader = AnnotationReader.getReaderFor(Target.FIELD.getDeclaringClass());
        Annotation annotation = reader.getAnnotation("test.TestAnnotations$LongArray", Target.FIELD);
        Class type = annotation.annotationType();
        assertEquals(TestAnnotations.LongArray.class, type);

        TestAnnotations.LongArray ann = (TestAnnotations.LongArray)annotation;
        long[] longArr = ann.l();
        assertEquals(1l, longArr[0]);
View Full Code Here

        assertEquals(6l, longArr[2]);
    }

    public void testFieldAnn6() {
        final AnnotationReader reader = AnnotationReader.getReaderFor(Target.FIELD.getDeclaringClass());
        Annotation annotation = reader.getAnnotation("test.TestAnnotations$Complex", Target.FIELD);
        Class type = annotation.annotationType();
        assertEquals(TestAnnotations.Complex.class, type);

        TestAnnotations.Complex ann = (TestAnnotations.Complex)annotation;
        assertEquals(3, ann.i());
View Full Code Here

        assertEquals(int.class, ann.type());
    }

    public void testFieldAnn7() {
        final AnnotationReader reader = AnnotationReader.getReaderFor(Target.FIELD.getDeclaringClass());
        Annotation annotation = reader.getAnnotation("test.TestAnnotations$NestedAnnotation", Target.FIELD);
        Class type = annotation.annotationType();
        assertEquals(TestAnnotations.NestedAnnotation.class, type);

        TestAnnotations.NestedAnnotation ann = (TestAnnotations.NestedAnnotation)annotation;
        TestAnnotations.Simple simple = ann.ann();
        assertEquals("foo", simple.val());
View Full Code Here

        assertEquals("foo", simple.val());
    }

    public void testFieldAnn8() {
        final AnnotationReader reader = AnnotationReader.getReaderFor(Target.FIELD.getDeclaringClass());
        Annotation annotation = reader.getAnnotation("test.TestAnnotations$NestedAnnotationArray", Target.FIELD);
        Class type = annotation.annotationType();
        assertEquals(TestAnnotations.NestedAnnotationArray.class, type);

        TestAnnotations.NestedAnnotationArray ann = (TestAnnotations.NestedAnnotationArray)annotation;
        TestAnnotations.Simple[] simpleAnnArray = ann.annArr();
        assertEquals("foo", simpleAnnArray[0].val());
View Full Code Here

        assertFalse(Annotations.isAnnotationPresent(Target.class, Target.CONSTRUCTOR));
    }

    public void testConstructorAnn1() {
        final AnnotationReader reader = AnnotationReader.getReaderFor(Target.CONSTRUCTOR.getDeclaringClass());
        Annotation annotation = reader.getAnnotation("test.TestAnnotations$VoidTyped", Target.CONSTRUCTOR);
        Class type = annotation.annotationType();
        assertEquals(TestAnnotations.VoidTyped.class, type);
    }
View Full Code Here

        assertEquals(TestAnnotations.VoidTyped.class, type);
    }

    public void testConstructorAnn2() {
        final AnnotationReader reader = AnnotationReader.getReaderFor(Target.CONSTRUCTOR.getDeclaringClass());
        Annotation annotation = reader.getAnnotation("test.TestAnnotations$DefaultString", Target.CONSTRUCTOR);
        Class type = annotation.annotationType();
        assertEquals(TestAnnotations.DefaultString.class, type);

        TestAnnotations.DefaultString ann = (TestAnnotations.DefaultString)annotation;
        assertEquals("hello", ann.value());
    }
View Full Code Here

TOP

Related Classes of org.codehaus.backport175.compiler.bytecode.AnnotationEnhancer

Copyright © 2018 www.massapicom. All rights reserved.
All source code are property of their respective owners. Java is a trademark of Sun Microsystems, Inc and owned by ORACLE Inc. Contact coftware#gmail.com.