xref: /aosp_15_r20/external/ksp/test-utils/testData/api/implicitElements.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 
18 // TEST PROCESSOR: ImplicitElementProcessor
19 // EXPECTED:
20 // <init>; origin: SYNTHETIC
21 // synthetic constructor for Cls
22 // <null>
23 // <null>
24 // <init>,<init>,<init>
25 // readOnly.get(): SYNTHETIC annotations from property: GetAnno
26 // readOnly.getter.owner: readOnly: KOTLIN
27 // readWrite.get(): KOTLIN
28 // readWrite.set(): SYNTHETIC annotations from property: SetAnno
29 // <init>
30 // comp1.get(): SYNTHETIC
31 // comp2.get(): SYNTHETIC
32 // comp2.set(): SYNTHETIC
33 // GetAnno
34 // <init>
35 // synthetic constructor for ImplictConstructorJava
36 // END
37 // FILE: a.kt
38 annotation class GetAnno
39 annotation class SetAnno
40 
41 class Cls {
42     @get:GetAnno
43     val readOnly: Int = 1
44 
45     @set:SetAnno
46     var readWrite: Int = 2
47     get() = 1
48 }
49 
50 data class Data(@get:GetAnno val comp1: Int, var comp2: Int)
51 
52 class ClassWithoutImplicitPrimaryConstructor : ITF {
53     constructor(x: Int)
54 }
55 
56 interface ITF
57 
58 // FILE: JavaClass.java
59 public class JavaClass {
60     public JavaClass() { this(1); }
61     public JavaClass(int a) { this(a, "ok"); }
62     public JavaClass(int a, String s) { }
63 }
64 
65 // FILE:ImplictConstructorJava.java
66 
67 public class ImplictConstructorJava {
68 
69 }