Reflection: add KClass.typeParameters, KCallable.typeParameters
Inheritance from KCallable is removed in kt9078.kt because it was irrelevant to the test and because it gets in the way of modification of KCallable
This commit is contained in:
@@ -83,6 +83,12 @@ public abstract class CallableReference implements KCallable {
|
||||
return getReflected().getAnnotations();
|
||||
}
|
||||
|
||||
@NotNull
|
||||
@Override
|
||||
public List<KTypeParameter> getTypeParameters() {
|
||||
return getReflected().getTypeParameters();
|
||||
}
|
||||
|
||||
@Override
|
||||
public Object call(@NotNull Object... args) {
|
||||
return getReflected().call(args);
|
||||
|
||||
@@ -19,6 +19,7 @@ package kotlin.jvm.internal
|
||||
import kotlin.reflect.KCallable
|
||||
import kotlin.reflect.KClass
|
||||
import kotlin.reflect.KFunction
|
||||
import kotlin.reflect.KTypeParameter
|
||||
|
||||
class ClassReference(override val jClass: Class<*>) : KClass<Any>, ClassBasedDeclarationContainer {
|
||||
override val simpleName: String?
|
||||
@@ -42,6 +43,9 @@ class ClassReference(override val jClass: Class<*>) : KClass<Any>, ClassBasedDec
|
||||
override val objectInstance: Any?
|
||||
get() = error()
|
||||
|
||||
override val typeParameters: List<KTypeParameter>
|
||||
get() = error()
|
||||
|
||||
private fun error(): Nothing = throw KotlinReflectionNotSupportedError()
|
||||
|
||||
override fun equals(other: Any?) =
|
||||
|
||||
@@ -17,10 +17,7 @@
|
||||
package kotlin.jvm.internal;
|
||||
|
||||
import kotlin.jvm.KotlinReflectionNotSupportedError;
|
||||
import kotlin.reflect.KDeclarationContainer;
|
||||
import kotlin.reflect.KFunction;
|
||||
import kotlin.reflect.KParameter;
|
||||
import kotlin.reflect.KType;
|
||||
import kotlin.reflect.*;
|
||||
import org.jetbrains.annotations.NotNull;
|
||||
|
||||
import java.lang.annotation.Annotation;
|
||||
@@ -71,6 +68,12 @@ public class FunctionReference extends FunctionImpl implements KFunction {
|
||||
return getReflected().getAnnotations();
|
||||
}
|
||||
|
||||
@NotNull
|
||||
@Override
|
||||
public List<KTypeParameter> getTypeParameters() {
|
||||
return getReflected().getTypeParameters();
|
||||
}
|
||||
|
||||
@Override
|
||||
public Object call(@NotNull Object... args) {
|
||||
return getReflected().call(args);
|
||||
|
||||
Reference in New Issue
Block a user