From 6be741934a0053ed150bb3ca7ebf76b0854dce27 Mon Sep 17 00:00:00 2001 From: Vadim Salavatov Date: Thu, 14 Aug 2025 16:51:18 +0200 Subject: [PATCH] [plugins] IJPL-202170 use weak interner for ModuleIds GitOrigin-RevId: 1122527cf2d1c0ea252d72f6b38588c2c8368f3a --- .../core-impl/src/com/intellij/ide/plugins/ModuleId.kt | 10 +++++++++- 1 file changed, 9 insertions(+), 1 deletion(-) diff --git a/platform/core-impl/src/com/intellij/ide/plugins/ModuleId.kt b/platform/core-impl/src/com/intellij/ide/plugins/ModuleId.kt index f873a453b6b1..c7c4cdf4d683 100644 --- a/platform/core-impl/src/com/intellij/ide/plugins/ModuleId.kt +++ b/platform/core-impl/src/com/intellij/ide/plugins/ModuleId.kt @@ -2,6 +2,7 @@ package com.intellij.ide.plugins import com.intellij.openapi.util.IntellijInternalApi +import com.intellij.util.containers.Interner import org.jetbrains.annotations.ApiStatus /** @@ -10,4 +11,11 @@ import org.jetbrains.annotations.ApiStatus @JvmInline @ApiStatus.Internal @IntellijInternalApi -value class ModuleId(val id: String) \ No newline at end of file +value class ModuleId private constructor(val id: String){ + companion object { + // ModuleId can be either boxed or unboxed, so only interning of value matters + private val interner = Interner.createWeakInterner() + + operator fun invoke(id: String): ModuleId = ModuleId(interner.intern(id)) + } +} \ No newline at end of file