xref: /aosp_15_r20/external/auto/value/src/it/functional/src/test/java/com/google/auto/value/KotlinData.kt (revision 1c2bbba85eccddce6de79cbbf1645fda32e723f0)
1 /*
2  * Copyright 2021 Google LLC
3  *
4  * Licensed under the Apache License, Version 2.0 (the "License");
5  * you may not use this file except in compliance with the License.
6  * You may obtain a copy of the License at
7  *
8  * http://www.apache.org/licenses/LICENSE-2.0
9  *
10  * Unless required by applicable law or agreed to in writing, software
11  * distributed under the License is distributed on an "AS IS" BASIS,
12  * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
13  * See the License for the specific language governing permissions and
14  * limitations under the License.
15  */
16 package com.google.auto.value
17 
18 import com.google.common.collect.ImmutableList
19 
20 data class KotlinData(val int: Int, val string: String)
21 
22 data class KotlinDataWithNullable(val anInt: Int?, val aString: String?)
23 
24 data class KotlinDataWithDefaults(
25   val anInt: Int = 23,
26   val anImmutableList: ImmutableList<String> = ImmutableList.of("foo"),
27   val notDefaulted: Long,
28   val aString: String = "skidoo"
29 )
30 
31 // Exactly 8 defaulted properties, in case we have a problem with sign-extending byte bitmasks.
32 data class KotlinDataEightDefaults(
33   val a1: Int = 1,
34   val a2: Int = 2,
35   val a3: Int = 3,
36   val a4: Int = 4,
37   val a5: Int = 5,
38   val a6: Int = 6,
39   val a7: Int = 7,
40   val a8: Int = 8,
41 )
42 
43 data class KotlinDataSomeDefaults(
44   val requiredInt: Int,
45   val requiredString: String,
46   val optionalInt: Int = 23,
47   val optionalString: String = "Skidoo"
48 )
49 
50 // CharSequence is an interface so the parameter appears from Java as List<? extends CharSequence>,
51 // but getList() appears as returning List<CharSequence>.
52 data class KotlinDataWithList(val list: List<CharSequence>, val number: Int)
53