From f600f9cdfb123c90e2ba3a97939d8ab840f8665f Mon Sep 17 00:00:00 2001 From: Vladimir Krivosheev Date: Wed, 21 Oct 2020 10:05:49 +0200 Subject: [PATCH] kotlin.coroutines.* classes must be loaded from platform provided library otherwise plugin cannot use platform API that uses coroutines GitOrigin-RevId: 6f951c368ad37ff07a3756608a104d5eda17bd8e --- .../ide/plugins/cl/PluginClassLoader.java | 17 ++++++++++------- 1 file changed, 10 insertions(+), 7 deletions(-) diff --git a/platform/core-impl/src/com/intellij/ide/plugins/cl/PluginClassLoader.java b/platform/core-impl/src/com/intellij/ide/plugins/cl/PluginClassLoader.java index 02196885c19a..0c59084b116e 100644 --- a/platform/core-impl/src/com/intellij/ide/plugins/cl/PluginClassLoader.java +++ b/platform/core-impl/src/com/intellij/ide/plugins/cl/PluginClassLoader.java @@ -239,13 +239,15 @@ public final class PluginClassLoader extends UrlClassLoader implements PluginAwa } @SuppressWarnings("SSBasedInspection") - private static final Set KOTLIN_STDLIB_CLASSES_USED_IN_SIGNATURES = new HashSet<>(Arrays.asList("kotlin.sequences.Sequence", - "kotlin.Lazy", "kotlin.Unit", - "kotlin.Pair", "kotlin.Triple", - "kotlin.jvm.internal.DefaultConstructorMarker", - "kotlin.jvm.internal.ClassBasedDeclarationContainer", - "kotlin.properties.ReadWriteProperty", - "kotlin.properties.ReadOnlyProperty")); + private static final Set KOTLIN_STDLIB_CLASSES_USED_IN_SIGNATURES = new HashSet<>(Arrays.asList( + "kotlin.sequences.Sequence", + "kotlin.Lazy", "kotlin.Unit", + "kotlin.Pair", "kotlin.Triple", + "kotlin.jvm.internal.DefaultConstructorMarker", + "kotlin.jvm.internal.ClassBasedDeclarationContainer", + "kotlin.properties.ReadWriteProperty", + "kotlin.properties.ReadOnlyProperty" + )); private static boolean mustBeLoadedByPlatform(@NonNls String className) { if (className.startsWith("java.")) { @@ -256,6 +258,7 @@ public final class PluginClassLoader extends UrlClassLoader implements PluginAwa // of kotlin-runtime.jar it won't be possible to call platform's methods with these types in signatures from such a plugin. // We assume that these classes don't change between Kotlin versions so it's safe to always load them from platform's kotlin-runtime. return className.startsWith("kotlin.") && (className.startsWith("kotlin.jvm.functions.") || + className.startsWith("kotlin.coroutines.") || (className.startsWith("kotlin.reflect.") && className.indexOf('.', 15 /* "kotlin.reflect".length */) < 0) || KOTLIN_STDLIB_CLASSES_USED_IN_SIGNATURES.contains(className));