Support introspection of parameter names and indices in reflection

This commit is contained in:
Alexander Udalov
2015-07-07 21:02:53 +03:00
parent 87c70aa2ae
commit 5962b79126
15 changed files with 228 additions and 22 deletions
@@ -19,6 +19,9 @@ package kotlin.jvm.internal;
import kotlin.jvm.KotlinReflectionNotSupportedError;
import kotlin.reflect.KCallable;
import kotlin.reflect.KDeclarationContainer;
import kotlin.reflect.KParameter;
import java.util.List;
/**
* A superclass for all classes generated by Kotlin compiler for callable references.
@@ -60,7 +63,10 @@ public abstract class CallableReference implements KCallable {
// The following methods are the stub implementations of reflection functions.
// They are called when you're using reflection on a property reference without the reflection implementation in the classpath.
// (nothing here yet)
@Override
public List<KParameter> getParameters() {
throw error();
}
protected static Error error() {
throw new KotlinReflectionNotSupportedError();
@@ -19,6 +19,8 @@ package kotlin.jvm.internal;
import kotlin.jvm.KotlinReflectionNotSupportedError;
import kotlin.reflect.*;
import java.util.List;
@SuppressWarnings("deprecation")
public class FunctionReference
extends FunctionImpl
@@ -58,6 +60,11 @@ public class FunctionReference
throw error();
}
@Override
public List<KParameter> getParameters() {
throw error();
}
protected static Error error() {
throw new KotlinReflectionNotSupportedError();
}