NameDateSize

..12-Dec-201714

AnnotationsTestBase.javaH A D12-Dec-201711.7 KiB

ClassType.javaH A D12-Dec-20174.9 KiB

README.txtH A D12-Dec-20173 KiB

RuntimeAnnotationsForGenericMethodTest.javaH A D12-Dec-20173.7 KiB

RuntimeAnnotationsForInnerAnnotationTest.javaH A D12-Dec-20173.5 KiB

RuntimeAnnotationsForInnerClassTest.javaH A D12-Dec-20174.2 KiB

RuntimeAnnotationsForInnerEnumTest.javaH A D12-Dec-20174.2 KiB

RuntimeAnnotationsForInnerInterfaceTest.javaH A D12-Dec-20174.2 KiB

RuntimeAnnotationsForTopLevelClassTest.javaH A D12-Dec-20174.7 KiB

RuntimeAnnotationsTestBase.javaH A D12-Dec-20176.9 KiB

RuntimeParameterAnnotationsForGenericMethodTest.javaH A D12-Dec-20173.6 KiB

RuntimeParameterAnnotationsForLambdaTest.javaH A D12-Dec-20175.4 KiB

RuntimeParameterAnnotationsTest.javaH A D12-Dec-20174.3 KiB

RuntimeParameterAnnotationsTestBase.javaH A D12-Dec-20176.7 KiB

TestAnnotationInfo.javaH A D12-Dec-201716.9 KiB

TestCase.javaH A D12-Dec-201717.8 KiB

WorkAnnotations.javaH A D12-Dec-20175.2 KiB

README.txt

1/*
2 * Copyright (c) 2015, Oracle and/or its affiliates. All rights reserved.
3 * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
4 *
5 * This code is free software; you can redistribute it and/or modify it
6 * under the terms of the GNU General Public License version 2 only, as
7 * published by the Free Software Foundation.
8 *
9 * This code is distributed in the hope that it will be useful, but WITHOUT
10 * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
11 * FITNESS FOR A PARTICULAR PURPOSE.  See the GNU General Public License
12 * version 2 for more details (a copy is included in the LICENSE file that
13 * accompanied this code).
14 *
15 * You should have received a copy of the GNU General Public License version
16 * 2 along with this work; if not, write to the Free Software Foundation,
17 * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
18 *
19 * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
20 * or visit www.oracle.com if you need additional information or have any
21 * questions.
22 */
23
24== Description of tests for RuntimeVisibleAnnotations, RuntimeInVisibleAnnotations
25RuntimeVisibleParameterAnnotations and RuntimeInvisibleParameterAnnotations attributes ==
26
27* AnnotationsTestBase class is a base class for the Annotations attribute tests.
28It contains some convenience methods which might be used in derived classes.
29
30* ClassType is a enum which is used for convenience code generation (see TestCase).
31
32* TestCase is a class which represent a test case. TestCase contains TestClassInfo,
33which represents a class, TestMethodInfo, which represents a method, TestFieldInfo,
34which represents a field, and TestParameterInfo, which represents a method's parameter.
35The class is used as test case builder. For example, the following code creates
36the top-level class Test with method classMethod() and local class Local.
37Each program member is annotated by some annotation which is an instance of
38TestAnnotationInfo (see TestAnnotationInfo):
39
40    TestCase test = new TestCase(ClassType.CLASS, "Test", "public");
41    test.clazz.addAnnotation(annotations);
42    TestCase.TestMethodInfo classMethod = test.clazz.addMethod("classMethod()");
43    classMethod.addAnnotation(annotation);
44    TestCase.TestClassInfo localClassInClassMethod = classMethod.addLocalClass("Local");
45    localClassInClassMethod.addAnnotation(annotations);
46
47Let "annotations" be a list of annotations A, B(i = 2). Thus, a test will generate the
48following code:
49
50    @A
51    @B(i = 2)
52    public class Test {
53        @A
54        @B(i = 2)
55        void classMethod() {
56            @A
57            @B(i = 2)
58            class Local {
59            }
60        }
61    }
62
63Thus, TestCase contains information about structure of classes and golden data
64about annotations. Thereafter, sources can be generated from this class representation
65by calling method generateSource(). Enum ClassType is used to handle "class type specific"
66code generation. For example, not-abstract method in a class always has body,
67while not-static and not-default method in an interface does not.