xref: /aosp_15_r20/external/ksp/test-utils/testData/api/docString.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: DocStringProcessor
19 // EXPECTED:
20 // <init>: \n This is a java doc\n\n This is a second line\n\n more lines\n
21 // <init>: \n inner class\n
22 // <init>: \n nest class\n
23 // <init>: \n top level class\n\n doc can have multiple lines\n\n third non-empty line\n
24 // Inner: \n inner class\n
25 // JavaSrc: \n This is a java doc\n\n This is a second line\n\n more lines\n
26 // Nested: \n nest class\n
27 // TopClass: \n top level class\n\n doc can have multiple lines\n\n third non-empty line\n
28 // f1: \n top level function\n
29 // f2: \n member function\n
30 // foo: \n\n\n member function\n\n
31 // j1: \n field\n
32 // j2: null
33 // j3: null
34 // v1: \n\n top level property\n\n
35 // v2:  Irregular doc comment 1
36 // v3: \n Irregular doc comment 2
37 // v4: Irregular doc comment 3 *\n
38 // v5: \n owned doc comment\n
39 // v6: null
40 // v7: null
41 // v8: \n member property\n
42 // END
43 // FILE: KotlinSrc.kt
44 
45 /**
46  * top level function
47  */
f1null48 fun f1() = 0
49 
50 /**
51  *
52  * top level property
53  *
54  */
55 val v1 = 0
56 
57 
58 /** * Irregular doc comment 1***/
59 val v2 = 0
60 
61 /**
62  * Irregular doc comment 2*/
63 val v3 = 0
64 
65 /** Irregular doc comment 3 *
66  */
67 val v4 = 0
68 
69 /**
70  * unassociated doc comment
71  */
72 /**
73  * owned doc comment
74  */
75 val v5 = 0
76 
77 /* Not doc comment 1 */
78 val v6 = 0
79 
80 // Not doc comment 2
81 val v7 = 0
82 
83 /**
84  * top level class
85  *
86  * doc can have multiple lines
87  *
88  * third non-empty line
89  */
90 class TopClass {
91     /**
92      * nest class
93      */
94     class Nested
95 
96     /**
97      * inner class
98      */
99     class Inner
100 
101     /**
102      * member function
103      */
104     fun f2() = 0
105 
106     /**
107      * member property
108      */
109     val v8 = 0
110 }
111 
112 // FILE: JavaSrc.java
113 /**
114  * This is a java doc
115  *
116  * This is a second line
117  *
118  * more lines
119  */
120 class JavaSrc {
121     /**
122      *
123      *
124      * member function
125      *
126      */
127     int foo() {
128         return 0;
129     }
130 
131     /**
132      * field
133      */
134     int j1 = 0;
135 
136     // Not a doc
137     int j2 = 0;
138 
139     /* Not a doc */
140     int j3 = 0;
141 }
142