1*3a22c0a3SAlix /* 2*3a22c0a3SAlix * * Copyright 2022 Google LLC. All rights reserved. 3*3a22c0a3SAlix * 4*3a22c0a3SAlix * Licensed under the Apache License, Version 2.0 (the License); 5*3a22c0a3SAlix * you may not use this file except in compliance with the License. 6*3a22c0a3SAlix * You may obtain a copy of the License at 7*3a22c0a3SAlix * 8*3a22c0a3SAlix * http://www.apache.org/licenses/LICENSE-2.0 9*3a22c0a3SAlix * 10*3a22c0a3SAlix * Unless required by applicable law or agreed to in writing, software 11*3a22c0a3SAlix * distributed under the License is distributed on an "AS IS" BASIS, 12*3a22c0a3SAlix * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 13*3a22c0a3SAlix * See the License for the specific language governing permissions and 14*3a22c0a3SAlix * limitations under the License. 15*3a22c0a3SAlix */ 16*3a22c0a3SAlix 17*3a22c0a3SAlix package ijar 18*3a22c0a3SAlix 19*3a22c0a3SAlix import java.util.function.Function 20*3a22c0a3SAlix 21*3a22c0a3SAlix // kotlinc requires the anonymous inner class of this function to be on the classpath in order to 22*3a22c0a3SAlix // inline this function. appendernull23*3a22c0a3SAlixinline fun appender(append: String): Function<String, String> { 24*3a22c0a3SAlix return object : Function<String, String> { 25*3a22c0a3SAlix override fun apply(arg: String) = arg + append 26*3a22c0a3SAlix } 27*3a22c0a3SAlix } 28*3a22c0a3SAlix 29*3a22c0a3SAlix // Additional regression test for https://youtrack.jetbrains.net/issue/KT-29471 appendernull30*3a22c0a3SAlixinline fun appender(crossinline init: () -> String): Function<String, String> { 31*3a22c0a3SAlix return object : Function<String, String> { 32*3a22c0a3SAlix private val base = init() 33*3a22c0a3SAlix override fun apply(arg: String) = base + arg 34*3a22c0a3SAlix } 35*3a22c0a3SAlix } 36