xref: /aosp_15_r20/external/ksp/test-utils/testData/api/interfaceWithDefault.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: DefaultFunctionProcessor
19 // EXPECTED:
20 // funLiteral: false
21 // funWithBody: false
22 // emptyFun: true
23 // foo: false
24 // bar: true
25 // iterator: true
26 // equals: false
27 // interfaceProperty: isAbstract: true: isMutable: false
28 // interfaceVar: isAbstract: true: isMutable: true
29 // nonAbstractInterfaceProp: isAbstract: false: isMutable: false
30 // B: true
31 // parameterVal: isAbstract: false: isMutable: false
32 // parameterVar: isAbstract: false: isMutable: true
33 // abstractVar: isAbstract: true: isMutable: true
34 // abstractProperty: isAbstract: true: isMutable: false
35 // a: false
36 // normalField: isMutable: true
37 // finalField: isMutable: false
38 // END
39 // FILE: a.kt
40 interface KTInterface: Sequence<String> {
funLiteralnull41     fun funLiteral() = 1
42 
43     fun funWithBody(): Int {
44         return 1
45     }
46 
emptyFunnull47     fun emptyFun()
48 
49     val interfaceProperty: String
50 
51     var interfaceVar: Int
52 
53     val nonAbstractInterfaceProp: Int
54     get() = 1
55 }
56 
57 abstract class B(val parameterVal: String, var parameterVar: String) {
58     abstract var abstractVar: String
59     abstract val abstractProperty: String
60     val a: String = "str"
61 }
62 
63 // FILE: C.java
64 interface C {
<lambda>null65     default int foo() {
66         return 1;
67     }
68 
69     int bar()
70 }
71 
72 // FILE: D.java
73 
74 class D {
75     int normalField;
76 
77     final int finalField;
78 }
79