From d283a7e6ce41b0e0167230eeef0bf04864b496e8 Mon Sep 17 00:00:00 2001 From: Vladimir Krivosheev Date: Tue, 7 Oct 2025 08:07:15 +0200 Subject: [PATCH] IJPL-209476 cleanup GitOrigin-RevId: e2f3ea9ac9710b77abc2d51146aa24cad812cfd8 --- .../intellij/util/lang/PathClassLoader.java | 2 +- .../ide/plugins/cl/PluginClassLoader.kt | 26 +++++++++---------- .../intellij/util/lang/UrlClassLoader.java | 4 +-- 3 files changed, 16 insertions(+), 16 deletions(-) diff --git a/platform/boot/src/com/intellij/util/lang/PathClassLoader.java b/platform/boot/src/com/intellij/util/lang/PathClassLoader.java index 154781f49669..9e0f0be5d2f1 100644 --- a/platform/boot/src/com/intellij/util/lang/PathClassLoader.java +++ b/platform/boot/src/com/intellij/util/lang/PathClassLoader.java @@ -47,7 +47,7 @@ public final class PathClassLoader extends UrlClassLoader { } } - private static final boolean isParallelCapable = ClassLoader.registerAsParallelCapable(); + private static final boolean isParallelCapable = registerAsParallelCapable(); private BytecodeTransformer transformer; diff --git a/platform/core-impl/src/com/intellij/ide/plugins/cl/PluginClassLoader.kt b/platform/core-impl/src/com/intellij/ide/plugins/cl/PluginClassLoader.kt index 13e86269ea1d..da09402ec8f5 100644 --- a/platform/core-impl/src/com/intellij/ide/plugins/cl/PluginClassLoader.kt +++ b/platform/core-impl/src/com/intellij/ide/plugins/cl/PluginClassLoader.kt @@ -178,7 +178,7 @@ class PluginClassLoader( _resolveScopeManager.isDefinitelyAlienClass(name = name, packagePrefix = it, force = forceLoadFromSubPluginClassloader) } if (consistencyError == null) { - c = loadClassInsideSelf(name = name, fileName = fileName, packageNameHash = packageNameHash, forceLoadFromSubPluginClassloader = forceLoadFromSubPluginClassloader) + c = loadClassInsideSelf(name = name, fileName = fileName, packageNameHash = packageNameHash) } else { if (!consistencyError.isEmpty()) { @@ -206,7 +206,7 @@ class PluginClassLoader( } continue } - c = classloader.loadClassInsideSelf(name = name, fileName = fileName, packageNameHash = packageNameHash, forceLoadFromSubPluginClassloader = false) + c = classloader.loadClassInsideSelf(name = name, fileName = fileName, packageNameHash = packageNameHash) } catch (e: IOException) { throw ClassNotFoundException(name, e) @@ -316,10 +316,10 @@ class PluginClassLoader( val fileNameWithoutExtension = name.replace('.', '/') val fileName = fileNameWithoutExtension + ClasspathCache.CLASS_EXTENSION val packageNameHash = ClasspathCache.getPackageNameHash(fileNameWithoutExtension, fileNameWithoutExtension.lastIndexOf('/')) - return loadClassInsideSelf(name, fileName, packageNameHash, false) + return loadClassInsideSelf(name = name, fileName = fileName, packageNameHash = packageNameHash) } - private fun loadClassInsideSelf(name: String, fileName: String, packageNameHash: Long, forceLoadFromSubPluginClassloader: Boolean): Class<*>? { + private fun loadClassInsideSelf(name: String, fileName: String, packageNameHash: Long): Class<*>? { synchronized(getClassLoadingLock(name)) { var c = findLoadedClass(name) if (c?.classLoader === this) { @@ -517,11 +517,11 @@ private fun computeKotlinStdlibClassesUsedInSignatures(): Set { "kotlin.Function", "kotlin.sequences.Sequence", "kotlin.ranges.IntRange", - "kotlin.ranges.IntRange\$Companion", + $$"kotlin.ranges.IntRange$Companion", "kotlin.ranges.IntProgression", "kotlin.ranges.ClosedRange", "kotlin.ranges.IntProgressionIterator", - "kotlin.ranges.IntProgression\$Companion", + $$"kotlin.ranges.IntProgression$Companion", "kotlin.ranges.IntProgression", "kotlin.collections.IntIterator", "kotlin.Lazy", "kotlin.Unit", @@ -534,13 +534,13 @@ private fun computeKotlinStdlibClassesUsedInSignatures(): Set { "kotlin.coroutines.Continuation", "kotlin.coroutines.CoroutineContext", - "kotlin.coroutines.CoroutineContext\$Element", - "kotlin.coroutines.CoroutineContext\$Key", + $$"kotlin.coroutines.CoroutineContext$Element", + $$"kotlin.coroutines.CoroutineContext$Key", "kotlin.coroutines.EmptyCoroutineContext", "kotlin.Result", - "kotlin.Result\$Failure", - "kotlin.Result\$Companion", // even though it's an internal class, it can leak (and it does) into API surface because it's exposed by public + $$"kotlin.Result$Failure", + $$"kotlin.Result$Companion", // even though it's an internal class, it can leak (and it does) into API surface because it's exposed by public // `kotlin.coroutines.intrinsics.COROUTINE_SUSPENDED` property "kotlin.coroutines.intrinsics.CoroutineSingletons", "kotlin.coroutines.AbstractCoroutineContextElement", @@ -549,7 +549,7 @@ private fun computeKotlinStdlibClassesUsedInSignatures(): Set { "kotlin.coroutines.jvm.internal.BaseContinuationImpl", // IDEA-295189 "kotlin.coroutines.jvm.internal.CoroutineStackFrame", // IDEA-295189 "kotlin.time.Duration", - "kotlin.time.Duration\$Companion", + $$"kotlin.time.Duration$Companion", "kotlin.jvm.internal.ReflectionFactory", "kotlin.jvm.internal.Reflection", "kotlin.jvm.internal.Lambda", @@ -567,12 +567,12 @@ private fun mustBeLoadedByPlatform(name: @NonNls String): Boolean { // 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 the platform's methods with these types in a signatures from such a plugin. + // of kotlin-runtime.jar, it won't be possible to call the platform's methods with these types in a signature from such a plugin. // We assume that these classes don't change between Kotlin versions, so it's safe to always load them from the platform's kotlin-runtime. return name.startsWith("kotlin.") && (name.startsWith("kotlin.jvm.functions.") || // Those are kotlin-reflect related classes, but unfortunately, they are placed in kotlin-stdlib. - // Since we always want to load reflect from platform, we should force those classes with platform classloader as well. + // Since we always want to load reflect lib from platform, we should force those classes with platform classloader as well. name.startsWith("kotlin.reflect.") || name.startsWith("kotlin.jvm.internal.CallableReference") || name.startsWith("kotlin.jvm.internal.ClassReference") || diff --git a/platform/util-class-loader/src/com/intellij/util/lang/UrlClassLoader.java b/platform/util-class-loader/src/com/intellij/util/lang/UrlClassLoader.java index f1bdc453eb4f..1f33d7100008 100644 --- a/platform/util-class-loader/src/com/intellij/util/lang/UrlClassLoader.java +++ b/platform/util-class-loader/src/com/intellij/util/lang/UrlClassLoader.java @@ -7,7 +7,6 @@ import org.jetbrains.annotations.NotNull; import org.jetbrains.annotations.Nullable; import org.jetbrains.annotations.VisibleForTesting; -import java.io.File; import java.io.IOException; import java.io.InputStream; import java.lang.invoke.MethodHandles; @@ -138,7 +137,8 @@ public class UrlClassLoader extends ClassLoader implements ClassPath.ClassDataCo configuration.files = files; } else { - String[] parts = System.getProperty("java.class.path").split(File.pathSeparator); + @SuppressWarnings({"IO_FILE_USAGE", "UnnecessaryFullyQualifiedName"}) + String[] parts = System.getProperty("java.class.path").split(java.io.File.pathSeparator); Set files = new LinkedHashSet<>(parts.length); for (String s : parts) { files.add(fileSystem.getPath(s));