Introduce module 'reflection', move KFunctionN to it

Metadata for KFunction classes is now longer serialized along with built-in
classes. This effectively means that it's no longer possible to find KFunction
classes via dependency on built-ins. There should be a kotlin-runtime library
in the specified classpath for reflection types to be resolvable.

A lot of tests were moved and changed, because tests on callable references
require stdlib in classpath from now on
This commit is contained in:
Alexander Udalov
2014-05-07 18:35:45 +04:00
parent c1cd8bf069
commit c7a7f31e82
124 changed files with 619 additions and 847 deletions
@@ -39,7 +39,7 @@ enum class FunctionKind(
fun getImplClassName(i: Int) = classNamePrefix + "Impl" + i
fun getSuperClassName(i: Int) = superClassNamePrefix?.plus(i)
private fun isReflection() = superClassNamePrefix != null
fun isReflection() = superClassNamePrefix != null
}
abstract class GenerateFunctionsBase(out: PrintWriter, val kind: FunctionKind): BuiltInsSourceGenerator(out) {
@@ -31,6 +31,7 @@ fun assertExists(file: File): Unit =
val BUILT_INS_NATIVE_DIR = File("core/builtins/native/kotlin/")
val BUILT_INS_SRC_DIR = File("core/builtins/src/kotlin/")
val REFLECTION_DIR = File("core/reflection/src/kotlin/")
val RUNTIME_JVM_DIR = File("core/runtime.jvm/src/kotlin/")
abstract class BuiltInsSourceGenerator(val out: PrintWriter) {
@@ -54,10 +55,11 @@ abstract class BuiltInsSourceGenerator(val out: PrintWriter) {
fun generateBuiltIns(generate: (File, (PrintWriter) -> BuiltInsSourceGenerator) -> Unit) {
assertExists(BUILT_INS_NATIVE_DIR)
assertExists(BUILT_INS_SRC_DIR)
assertExists(REFLECTION_DIR)
assertExists(RUNTIME_JVM_DIR)
for (kind in FunctionKind.values()) {
generate(File(BUILT_INS_SRC_DIR, kind.getFileName())) { GenerateFunctions(it, kind) }
generate(File(if (kind.isReflection()) REFLECTION_DIR else BUILT_INS_SRC_DIR, kind.getFileName())) { GenerateFunctions(it, kind) }
generate(File(RUNTIME_JVM_DIR, kind.getImplFileName()), { GenerateFunctionsImpl(it, kind) })
}