xref: /aosp_15_r20/external/ksp/test-utils/testData/api/allFunctions_kt_inherits_java.kt (revision af87fb4bb8e3042070d2a054e912924f599b22b7)
1 /*
2  * Copyright 2022 Google LLC
3  * Copyright 2010-2022 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 // WITH_RUNTIME
19 // TEST PROCESSOR: AllFunctionsProcessor
20 // EXPECTED:
21 // class: C
22 // aFromC
23 // bFromC
24 // cFromC
25 // <init>(): C
26 // equals(kotlin.Any): kotlin.Boolean
27 // hashCode(): kotlin.Int
28 // javaListFun(): kotlin.collections.MutableCollection
29 // javaPrivateFun(): kotlin.Unit
30 // javaStrFun(): kotlin.String
31 // toString(): kotlin.String
32 // class: Foo
33 // aFromC
34 // cFromC
35 // size
36 // <init>(): Foo
37 // bar(): kotlin.Boolean
38 // baz(kotlin.String,kotlin.String(hasDefault),kotlin.String(hasDefault)): kotlin.Boolean
39 // contains(kotlin.Number): kotlin.Boolean
40 // containsAll(kotlin.collections.Collection): kotlin.Boolean
41 // equals(kotlin.Any): kotlin.Boolean
42 // forEach(java.util.function.Consumer): kotlin.Unit
43 // get(kotlin.Int): kotlin.Number
44 // hashCode(): kotlin.Int
45 // indexOf(kotlin.Number): kotlin.Int
46 // isEmpty(): kotlin.Boolean
47 // iterator(): kotlin.collections.Iterator
48 // javaListFun(): kotlin.collections.List
49 // javaStrFun(): kotlin.String
50 // lastIndexOf(kotlin.Number): kotlin.Int
51 // listIterator(): kotlin.collections.ListIterator
52 // listIterator(kotlin.Int): kotlin.collections.ListIterator
53 // parallelStream(): java.util.stream.Stream
54 // spliterator(): java.util.Spliterator
55 // stream(): java.util.stream.Stream
56 // subList(kotlin.Int,kotlin.Int): kotlin.collections.List
57 // toArray(java.util.function.IntFunction): kotlin.Array
58 // toString(): kotlin.String
59 // END
60 // FILE: a.kt
61 abstract class Foo : C(), List<out Number> {
javaListFunnull62     override fun javaListFun(): List<Int> {
63         throw java.lang.IllegalStateException()
64     }
65 
barnull66     fun bar(): Boolean {
67         return false
68     }
69 
baznull70     fun baz(input: String, input2: String? = null, input3: String = ""): Boolean {
71         return false
72     }
73 }
74 
75 // FILE: C.java
76 import java.util.Collection;
77 
78 class C {
79     public int aFromC = 1;
80     private int bFromC = 2;
81     protected int cFromC = 3;
<lambda>null82     private void javaPrivateFun() {
83 
84     }
85 
86     protected Collection<Integer> javaListFun() {
87         return Arrays.asList(1,2,3)
88     }
89 
<lambda>null90     public String javaStrFun() {
91         return "str"
92     }
93 }
94