Add KCallable.returnType
This commit is contained in:
@@ -39,6 +39,11 @@ public interface KCallable<out R> {
|
||||
*/
|
||||
public val parameters: List<KParameter>
|
||||
|
||||
/**
|
||||
* The type of values returned by this callable.
|
||||
*/
|
||||
public val returnType: KType
|
||||
|
||||
/**
|
||||
* Calls this callable with the specified arguments and returns the result.
|
||||
* Throws an exception if the number of specified arguments is not equal to the size of [parameters],
|
||||
|
||||
@@ -20,6 +20,7 @@ import org.jetbrains.kotlin.descriptors.CallableMemberDescriptor
|
||||
import java.util.ArrayList
|
||||
import kotlin.reflect.KCallable
|
||||
import kotlin.reflect.KParameter
|
||||
import kotlin.reflect.KType
|
||||
|
||||
interface KCallableImpl<out R> : KCallable<R> {
|
||||
val descriptor: CallableMemberDescriptor
|
||||
@@ -44,4 +45,7 @@ interface KCallableImpl<out R> : KCallable<R> {
|
||||
result.trimToSize()
|
||||
return result
|
||||
}
|
||||
|
||||
override val returnType: KType
|
||||
get() = KTypeImpl(descriptor.returnType!!)
|
||||
}
|
||||
|
||||
@@ -20,6 +20,7 @@ import kotlin.jvm.KotlinReflectionNotSupportedError;
|
||||
import kotlin.reflect.KCallable;
|
||||
import kotlin.reflect.KDeclarationContainer;
|
||||
import kotlin.reflect.KParameter;
|
||||
import kotlin.reflect.KType;
|
||||
import org.jetbrains.annotations.NotNull;
|
||||
|
||||
import java.util.List;
|
||||
@@ -69,6 +70,11 @@ public abstract class CallableReference implements KCallable {
|
||||
throw error();
|
||||
}
|
||||
|
||||
@Override
|
||||
public KType getReturnType() {
|
||||
throw error();
|
||||
}
|
||||
|
||||
@Override
|
||||
public Object call(@NotNull Object... args) {
|
||||
throw error();
|
||||
|
||||
@@ -66,6 +66,11 @@ public class FunctionReference
|
||||
throw error();
|
||||
}
|
||||
|
||||
@Override
|
||||
public KType getReturnType() {
|
||||
throw error();
|
||||
}
|
||||
|
||||
@Override
|
||||
public Object call(@NotNull Object... args) {
|
||||
throw error();
|
||||
|
||||
Reference in New Issue
Block a user