From f9f63d2f1b62e5e6405d1ae44b1b7487fdbff706 Mon Sep 17 00:00:00 2001 From: Dmitry Jemerov Date: Mon, 16 Jul 2018 14:37:11 +0200 Subject: [PATCH] Force loading Kotlin classes used in the delegated properties API from the platform classloader This allows the platform to expose APIs using Kotlin delegated properties to plugins --- .../ide/plugins/cl/PluginClassLoader.java | 23 +++++-------------- 1 file changed, 6 insertions(+), 17 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 c27a6254e270..b777a63875e0 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 @@ -1,18 +1,4 @@ -/* - * Copyright 2000-2017 JetBrains s.r.o. - * - * Licensed under the Apache License, Version 2.0 (the "License"); - * you may not use this file except in compliance with the License. - * You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. - */ +// Copyright 2000-2018 JetBrains s.r.o. Use of this source code is governed by the Apache 2.0 license that can be found in the LICENSE file. package com.intellij.ide.plugins.cl; import com.intellij.diagnostic.PluginException; @@ -94,14 +80,17 @@ public class PluginClassLoader extends UrlClassLoader { "kotlin.Pair", "kotlin.Triple", "kotlin.jvm.internal.DefaultConstructorMarker", - "kotlin.reflect.KDeclarationContainer" + "kotlin.properties.ReadWriteProperty", + "kotlin.properties.ReadOnlyProperty" ); private static boolean mustBeLoadedByPlatform(String className) { //some commonly used classes from kotlin-runtime must be loaded by the platform classloader. Otherwise if a plugin bundles its own version // 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.") || KOTLIN_STDLIB_CLASSES_USED_IN_SIGNATURES.contains(className)); + return className.startsWith("kotlin.") && (className.startsWith("kotlin.jvm.functions.") || + className.startsWith("kotlin.reflect.KProperty") || + KOTLIN_STDLIB_CLASSES_USED_IN_SIGNATURES.contains(className)); } @Nullable