From 6403ef39eb3d2af5b28ce0fdef076c2b7a5a77ac Mon Sep 17 00:00:00 2001 From: Evgeny Gerashchenko Date: Thu, 28 May 2015 17:24:17 +0300 Subject: [PATCH] KT-7521 Compilation problem of dependent modules with different jdks #KT-7521 fixed --- .../kotlin/codegen/ClassBuilderFactories.java | 14 +++++++------- 1 file changed, 7 insertions(+), 7 deletions(-) diff --git a/compiler/backend/src/org/jetbrains/kotlin/codegen/ClassBuilderFactories.java b/compiler/backend/src/org/jetbrains/kotlin/codegen/ClassBuilderFactories.java index aa6f1fad6ba..bec8d118fc6 100644 --- a/compiler/backend/src/org/jetbrains/kotlin/codegen/ClassBuilderFactories.java +++ b/compiler/backend/src/org/jetbrains/kotlin/codegen/ClassBuilderFactories.java @@ -132,13 +132,13 @@ public class ClassBuilderFactories { @Override protected String getCommonSuperClass(@NotNull String type1, @NotNull String type2) { - try { - return super.getCommonSuperClass(type1, type2); - } - catch (Throwable t) { - // @todo we might need at some point do more sophisticated handling - return "java/lang/Object"; - } + // This method is needed to generate StackFrameMap: bytecode metadata for JVM verification. For bytecode version 50.0 (JDK 6) + // these maps can be invalid: in this case, JVM would generate them itself (potentially slowing class loading), + // for bytecode 51.0+ (JDK 7+) JVM would crash with VerifyError. + // It seems that for bytecode emitted by Kotlin compiler, it is safe to return "Object" here, because there will + // be "checkcast" generated before making a call, anyway. + + return "java/lang/Object"; } }