Don't create KClass and KPackage instances in <clinit>

This proved to be a fragile technique, which probably doesn't even improve
performance in most cases but has lots of unexpected problems: unconditional
initialization of reflection classes, increasing the size of the bytecode, bugs
with <clinit> in annotations on JVM 6, inability to support conversion of a
class from Kotlin to Java without recompiling clients which use it
reflectively, etc.
This commit is contained in:
Alexander Udalov
2015-10-06 21:55:49 +03:00
parent fe737886cd
commit a4732b442d
24 changed files with 51 additions and 161 deletions
@@ -52,8 +52,6 @@ public final class JvmAbi {
public static final String INSTANCE_FIELD = "INSTANCE";
public static final String DEPRECATED_INSTANCE_FIELD = "INSTANCE$";
public static final String KOTLIN_CLASS_FIELD_NAME = "$kotlinClass";
public static final String KOTLIN_PACKAGE_FIELD_NAME = "$kotlinPackage";
public static final String MODULE_NAME_FIELD = "$moduleName";
public static final String DEFAULT_MODULE_NAME = "main";
public static final ClassId REFLECTION_FACTORY_IMPL = ClassId.topLevel(new FqName("kotlin.reflect.jvm.internal.ReflectionFactoryImpl"));