Keep built-in metadata for reflection interfaces
Reflection interfaces (interfaces in kotlin.reflect.* in core/builtins/) are now fully considered as built-ins and can be accessed via KotlinBuiltIns. This increases runtime size by ~20kb, but only because KotlinBuiltIns is static and is therefore constructed only via resource loading from the compiler classpath at the moment. As soon as it's possible to inject KotlinBuiltIns to the particular resolution process, the metadata on JVM will be loaded via standard annotation mechanism (kotlin.jvm.internal.KotlinClass/KotlinPackage) and wasted runtime space will be reclaimed
This commit is contained in:
@@ -38,6 +38,7 @@ import org.jetbrains.kotlin.types.checker.JetTypeChecker;
|
||||
import java.io.InputStream;
|
||||
import java.util.*;
|
||||
|
||||
import static kotlin.KotlinPackage.setOf;
|
||||
import static kotlin.KotlinPackage.single;
|
||||
import static org.jetbrains.kotlin.builtins.PrimitiveType.*;
|
||||
import static org.jetbrains.kotlin.resolve.DescriptorUtils.getFqName;
|
||||
@@ -113,7 +114,8 @@ public class KotlinBuiltIns {
|
||||
);
|
||||
|
||||
PackageFragmentProvider packageFragmentProvider = BuiltinsPackage.createBuiltInPackageFragmentProvider(
|
||||
storageManager, builtInsModule, Collections.singleton(BUILT_INS_PACKAGE_FQ_NAME),
|
||||
storageManager, builtInsModule,
|
||||
setOf(BUILT_INS_PACKAGE_FQ_NAME, BuiltinsPackage.getKOTLIN_REFLECT_FQ_NAME()),
|
||||
FlexibleTypeCapabilitiesDeserializer.ThrowException.INSTANCE$, new Function1<String, InputStream>() {
|
||||
@Override
|
||||
public InputStream invoke(String path) {
|
||||
|
||||
@@ -16,7 +16,6 @@
|
||||
|
||||
package org.jetbrains.kotlin.builtins
|
||||
|
||||
import org.jetbrains.kotlin.builtins.KotlinBuiltIns
|
||||
import org.jetbrains.kotlin.descriptors.ClassDescriptor
|
||||
import org.jetbrains.kotlin.descriptors.ModuleDescriptor
|
||||
import org.jetbrains.kotlin.descriptors.annotations.Annotations
|
||||
@@ -29,7 +28,7 @@ import org.jetbrains.kotlin.types.*
|
||||
import java.util.ArrayList
|
||||
import kotlin.properties.Delegates
|
||||
|
||||
private val KOTLIN_REFLECT_FQ_NAME = FqName("kotlin.reflect")
|
||||
val KOTLIN_REFLECT_FQ_NAME = FqName("kotlin.reflect")
|
||||
|
||||
public class ReflectionTypes(private val module: ModuleDescriptor) {
|
||||
private val kotlinReflectScope: JetScope? by Delegates.lazy {
|
||||
|
||||
Reference in New Issue
Block a user