xref: /aosp_15_r20/external/ksp/test-utils/testData/api/annotationWithArrayValue.kt (revision af87fb4bb8e3042070d2a054e912924f599b22b7)
1 /*
2  * Copyright 2020 Google LLC
3  * Copyright 2010-2020 JetBrains s.r.o. and Kotlin Programming Language contributors.
4  *
5  * Licensed under the Apache License, Version 2.0 (the "License");
6  * you may not use this file except in compliance with the License.
7  * You may obtain a copy of the License at
8  *
9  * http://www.apache.org/licenses/LICENSE-2.0
10  *
11  * Unless required by applicable law or agreed to in writing, software
12  * distributed under the License is distributed on an "AS IS" BASIS,
13  * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
14  * See the License for the specific language governing permissions and
15  * limitations under the License.
16  */
17 // TEST PROCESSOR: AnnotationArrayValueProcessor
18 // EXPECTED:
19 // KotlinAnnotated
20 // KotlinAnnotation ->
21 // stringArray = [a, b, null, c]
22 // classArray = [Any, List<*>]
23 // JavaAnnotation ->
24 // stringArray = [x, y, null, z]
25 // classArray = [String, Long]
26 // JavaAnnotated
27 // KotlinAnnotation ->
28 // stringArray = [j-a, j-b, null, j-c]
29 // classArray = [Object, List<*>]
30 // JavaAnnotation ->
31 // stringArray = [j-x, j-y, null, j-z]
32 // classArray = [Integer, Character]
33 // END
34 // FILE: a.kt
35 
36 annotation class KotlinAnnotation(val stringArray: Array<String?>, val classArray: Array<KClass<*>?>)
37 
38 @KotlinAnnotation(
39     stringArray = ["a", "b", null, "c"],
40     classArray = [Any::class, List::class]
41 )
42 @JavaAnnotation(
43     stringArray = ["x", "y", null, "z"],
44     classArray = [String::class, Long::class]
45 )
46 class KotlinAnnotated
47 
48 // FILE: JavaAnnotation.java
49 public @interface JavaAnnotation {
50     String[] stringArray();
51     Class[] classArray();
52 }
53 
54 // FILE: JavaAnnotated.java
55 import java.util.*;
56 @KotlinAnnotation(
57     stringArray = {"j-a", "j-b", null, "j-c"},
58     classArray = {Object.class, List.class}
59 )
60 @JavaAnnotation(
61     stringArray = {"j-x", "j-y", null, "j-z"},
62     classArray = {Integer.class, Character.class}
63 )
64 public class JavaAnnotated {
65 }
66