Convert FunctionBase to Kotlin, add type parameter to Lambda

This will make it possible to avoid raw types when inheriting from both
FunctionBase and Function<R>. This change adds a generic type parameter
to FunctionBase and Lambda which is not source-breaking under our policy
because both FunctionBase and Lambda are internal classes (located in
package kotlin.jvm.internal)
This commit is contained in:
Alexander Udalov
2018-04-17 19:13:50 +02:00
committed by Ilya Gorbunov
parent e35ebff4e1
commit 51979b9ffa
7 changed files with 14 additions and 22 deletions
@@ -3,10 +3,8 @@
* that can be found in the license/LICENSE.txt file.
*/
package kotlin.jvm.internal;
package kotlin.jvm.internal
import kotlin.Function;
public interface FunctionBase extends Function {
int getArity();
interface FunctionBase<out R> : Function<R> {
val arity: Int
}
@@ -7,8 +7,6 @@ package kotlin.jvm.internal
import java.io.Serializable
abstract class Lambda(private val arity: Int) : FunctionBase, Serializable {
override fun getArity(): Int = arity
abstract class Lambda<out R>(override val arity: Int) : FunctionBase<R>, Serializable {
override fun toString(): String = Reflection.renderLambdaToString(this)
}