reduce the usage of kotlinx-immutable-collections

GitOrigin-RevId: f5a8cc34ffff305e2793ea2a109156dcde4014b0
This commit is contained in:
Vladimir Krivosheev
2024-03-10 10:17:09 +01:00
committed by intellij-monorepo-bot
parent edb02741c0
commit 72efd72cf0
34 changed files with 146 additions and 171 deletions

View File

@@ -49,6 +49,7 @@
<orderEntry type="library" name="opentelemetry" level="project" /> <orderEntry type="library" name="opentelemetry" level="project" />
<orderEntry type="library" name="opentelemetry-semconv" level="project" /> <orderEntry type="library" name="opentelemetry-semconv" level="project" />
<orderEntry type="module" module-name="intellij.platform.diagnostic.telemetry" /> <orderEntry type="module" module-name="intellij.platform.diagnostic.telemetry" />
<orderEntry type="library" name="kotlinx-collections-immutable" level="project" />
</component> </component>
<component name="copyright"> <component name="copyright">
<Base> <Base>

View File

@@ -1,4 +1,4 @@
// Copyright 2000-2023 JetBrains s.r.o. and contributors. Use of this source code is governed by the Apache 2.0 license. // Copyright 2000-2024 JetBrains s.r.o. and contributors. Use of this source code is governed by the Apache 2.0 license.
package com.intellij.packaging.impl.elements; package com.intellij.packaging.impl.elements;
import com.intellij.openapi.diagnostic.Logger; import com.intellij.openapi.diagnostic.Logger;
@@ -103,39 +103,33 @@ public final class PackagingElementFactoryImpl extends PackagingElementFactory {
return toPersistentList(PackagingElementType.EP_NAME.getExtensionList()).addAll(STANDARD_TYPES); return toPersistentList(PackagingElementType.EP_NAME.getExtensionList()).addAll(STANDARD_TYPES);
} }
@NotNull
@Override @Override
public PackagingElement<?> createArtifactElement(@NotNull Artifact artifact, @NotNull Project project) { public @NotNull PackagingElement<?> createArtifactElement(@NotNull Artifact artifact, @NotNull Project project) {
return new ArtifactPackagingElement(project, ArtifactPointerManager.getInstance(project).createPointer(artifact)); return new ArtifactPackagingElement(project, ArtifactPointerManager.getInstance(project).createPointer(artifact));
} }
@NotNull
@Override @Override
public PackagingElement<?> createArtifactElement(@NotNull String artifactName, @NotNull Project project) { public @NotNull PackagingElement<?> createArtifactElement(@NotNull String artifactName, @NotNull Project project) {
return new ArtifactPackagingElement(project, ArtifactPointerManager.getInstance(project).createPointer(artifactName)); return new ArtifactPackagingElement(project, ArtifactPointerManager.getInstance(project).createPointer(artifactName));
} }
@Override @Override
@NotNull public @NotNull DirectoryPackagingElement createDirectory(@NotNull @NonNls String directoryName) {
public DirectoryPackagingElement createDirectory(@NotNull @NonNls String directoryName) {
return new DirectoryPackagingElement(directoryName); return new DirectoryPackagingElement(directoryName);
} }
@NotNull
@Override @Override
public ArtifactRootElement<?> createArtifactRootElement() { public @NotNull ArtifactRootElement<?> createArtifactRootElement() {
return new ArtifactRootElementImpl(); return new ArtifactRootElementImpl();
} }
@Override @Override
@NotNull public @NotNull CompositePackagingElement<?> getOrCreateDirectory(@NotNull CompositePackagingElement<?> parent, @NotNull String relativePath) {
public CompositePackagingElement<?> getOrCreateDirectory(@NotNull CompositePackagingElement<?> parent, @NotNull String relativePath) {
return getOrCreateDirectoryOrArchive(parent, relativePath, true, false); return getOrCreateDirectoryOrArchive(parent, relativePath, true, false);
} }
@NotNull
@Override @Override
public CompositePackagingElement<?> getOrCreateArchive(@NotNull CompositePackagingElement<?> parent, @NotNull String relativePath) { public @NotNull CompositePackagingElement<?> getOrCreateArchive(@NotNull CompositePackagingElement<?> parent, @NotNull String relativePath) {
return getOrCreateDirectoryOrArchive(parent, relativePath, false, false); return getOrCreateDirectoryOrArchive(parent, relativePath, false, false);
} }
@@ -161,10 +155,9 @@ public final class PackagingElementFactoryImpl extends PackagingElementFactory {
} }
} }
@NotNull private @NotNull CompositePackagingElement<?> getOrCreateDirectoryOrArchive(@NotNull CompositePackagingElement<?> root,
private CompositePackagingElement<?> getOrCreateDirectoryOrArchive(@NotNull CompositePackagingElement<?> root, @NotNull @NonNls String path,
@NotNull @NonNls String path, final boolean directory, boolean addAsFirstChild) {
final boolean directory, boolean addAsFirstChild) {
path = StringUtil.trimStart(StringUtil.trimEnd(path, "/"), "/"); path = StringUtil.trimStart(StringUtil.trimEnd(path, "/"), "/");
if (path.isEmpty()) { if (path.isEmpty()) {
return root; return root;
@@ -185,43 +178,37 @@ public final class PackagingElementFactoryImpl extends PackagingElementFactory {
} }
@Override @Override
@NotNull public @NotNull PackagingElement<?> createModuleOutput(@NotNull String moduleName, @NotNull Project project) {
public PackagingElement<?> createModuleOutput(@NotNull String moduleName, @NotNull Project project) {
final ModulePointer pointer = ModulePointerManager.getInstance(project).create(moduleName); final ModulePointer pointer = ModulePointerManager.getInstance(project).create(moduleName);
return new ProductionModuleOutputPackagingElement(project, pointer); return new ProductionModuleOutputPackagingElement(project, pointer);
} }
@NotNull
@Override @Override
public PackagingElement<?> createModuleOutput(@NotNull Module module) { public @NotNull PackagingElement<?> createModuleOutput(@NotNull Module module) {
final ModulePointer modulePointer = ModulePointerManager.getInstance(module.getProject()).create(module); final ModulePointer modulePointer = ModulePointerManager.getInstance(module.getProject()).create(module);
return new ProductionModuleOutputPackagingElement(module.getProject(), modulePointer); return new ProductionModuleOutputPackagingElement(module.getProject(), modulePointer);
} }
@NotNull
@Override @Override
public PackagingElement<?> createModuleSource(@NotNull Module module) { public @NotNull PackagingElement<?> createModuleSource(@NotNull Module module) {
final ModulePointer modulePointer = ModulePointerManager.getInstance(module.getProject()).create(module); final ModulePointer modulePointer = ModulePointerManager.getInstance(module.getProject()).create(module);
return new ProductionModuleSourcePackagingElement(module.getProject(), modulePointer); return new ProductionModuleSourcePackagingElement(module.getProject(), modulePointer);
} }
@NotNull
@Override @Override
public PackagingElement<?> createTestModuleOutput(@NotNull String moduleName, @NotNull Project project) { public @NotNull PackagingElement<?> createTestModuleOutput(@NotNull String moduleName, @NotNull Project project) {
ModulePointer pointer = ModulePointerManager.getInstance(project).create(moduleName); ModulePointer pointer = ModulePointerManager.getInstance(project).create(moduleName);
return new TestModuleOutputPackagingElement(project, pointer); return new TestModuleOutputPackagingElement(project, pointer);
} }
@NotNull
@Override @Override
public PackagingElement<?> createTestModuleOutput(@NotNull Module module) { public @NotNull PackagingElement<?> createTestModuleOutput(@NotNull Module module) {
ModulePointer pointer = ModulePointerManager.getInstance(module.getProject()).create(module); ModulePointer pointer = ModulePointerManager.getInstance(module.getProject()).create(module);
return new TestModuleOutputPackagingElement(module.getProject(), pointer); return new TestModuleOutputPackagingElement(module.getProject(), pointer);
} }
@NotNull
@Override @Override
public List<PackagingElement<?>> createLibraryElements(@NotNull Library library) { public @NotNull List<PackagingElement<?>> createLibraryElements(@NotNull Library library) {
final LibraryTable table = library.getTable(); final LibraryTable table = library.getTable();
final String libraryName = library.getName(); final String libraryName = library.getName();
if (table != null) { if (table != null) {
@@ -241,9 +228,8 @@ public final class PackagingElementFactoryImpl extends PackagingElementFactory {
return elements; return elements;
} }
@NotNull
@Override @Override
public List<? extends PackagingElement<?>> createLibraryElements(@NotNull LibraryEntity libraryEntity, String moduleName) { public @NotNull List<? extends PackagingElement<?>> createLibraryElements(@NotNull LibraryEntity libraryEntity, String moduleName) {
final String libraryType = libraryEntity.getTableId().getLevel(); final String libraryType = libraryEntity.getTableId().getLevel();
final String libraryName = libraryEntity.getName(); final String libraryName = libraryEntity.getName();
if (PROJECT_LEVEL.equals(libraryType) || APPLICATION_LEVEL.equals(libraryType)) { if (PROJECT_LEVEL.equals(libraryType) || APPLICATION_LEVEL.equals(libraryType)) {
@@ -253,26 +239,22 @@ public final class PackagingElementFactoryImpl extends PackagingElementFactory {
return Collections.singletonList(createLibraryFiles(libraryName, libraryType, moduleName)); return Collections.singletonList(createLibraryFiles(libraryName, libraryType, moduleName));
} }
@NotNull
@Override @Override
public PackagingElement<?> createArtifactElement(@NotNull ArtifactPointer artifactPointer, @NotNull Project project) { public @NotNull PackagingElement<?> createArtifactElement(@NotNull ArtifactPointer artifactPointer, @NotNull Project project) {
return new ArtifactPackagingElement(project, artifactPointer); return new ArtifactPackagingElement(project, artifactPointer);
} }
@NotNull
@Override @Override
public PackagingElement<?> createLibraryFiles(@NotNull String libraryName, @NotNull String level, String moduleName) { public @NotNull PackagingElement<?> createLibraryFiles(@NotNull String libraryName, @NotNull String level, String moduleName) {
return new LibraryPackagingElement(level, libraryName, moduleName); return new LibraryPackagingElement(level, libraryName, moduleName);
} }
@Override @Override
@NotNull public @NotNull CompositePackagingElement<?> createArchive(@NotNull @NonNls String archiveFileName) {
public CompositePackagingElement<?> createArchive(@NotNull @NonNls String archiveFileName) {
return new ArchivePackagingElement(archiveFileName); return new ArchivePackagingElement(archiveFileName);
} }
@Nullable private static @Nullable PackagingElement<?> findArchiveOrDirectoryByName(@NotNull CompositePackagingElement<?> parent, @NotNull String name) {
private static PackagingElement<?> findArchiveOrDirectoryByName(@NotNull CompositePackagingElement<?> parent, @NotNull String name) {
for (PackagingElement<?> element : parent.getChildren()) { for (PackagingElement<?> element : parent.getChildren()) {
if (element instanceof ArchivePackagingElement && ((ArchivePackagingElement)element).getArchiveFileName().equals(name) || if (element instanceof ArchivePackagingElement && ((ArchivePackagingElement)element).getArchiveFileName().equals(name) ||
element instanceof DirectoryPackagingElement && ((DirectoryPackagingElement)element).getDirectoryName().equals(name)) { element instanceof DirectoryPackagingElement && ((DirectoryPackagingElement)element).getDirectoryName().equals(name)) {
@@ -282,8 +264,7 @@ public final class PackagingElementFactoryImpl extends PackagingElementFactory {
return null; return null;
} }
@NotNull public static @NotNull String suggestFileName(@NotNull CompositePackagingElement<?> parent, @NonNls @NotNull String prefix, @NonNls @NotNull String suffix) {
public static String suggestFileName(@NotNull CompositePackagingElement<?> parent, @NonNls @NotNull String prefix, @NonNls @NotNull String suffix) {
String name = prefix + suffix; String name = prefix + suffix;
int i = 2; int i = 2;
while (findArchiveOrDirectoryByName(parent, name) != null) { while (findArchiveOrDirectoryByName(parent, name) != null) {
@@ -292,39 +273,34 @@ public final class PackagingElementFactoryImpl extends PackagingElementFactory {
return name; return name;
} }
@NotNull
@Override @Override
public PackagingElement<?> createDirectoryCopyWithParentDirectories(@NotNull String filePath, @NotNull String relativeOutputPath) { public @NotNull PackagingElement<?> createDirectoryCopyWithParentDirectories(@NotNull String filePath, @NotNull String relativeOutputPath) {
return createParentDirectories(relativeOutputPath, new DirectoryCopyPackagingElement(filePath)); return createParentDirectories(relativeOutputPath, new DirectoryCopyPackagingElement(filePath));
} }
@Override @Override
@NotNull public @NotNull PackagingElement<?> createExtractedDirectoryWithParentDirectories(@NotNull String jarPath, @NotNull String pathInJar,
public PackagingElement<?> createExtractedDirectoryWithParentDirectories(@NotNull String jarPath, @NotNull String pathInJar, @NotNull String relativeOutputPath) {
@NotNull String relativeOutputPath) {
return createParentDirectories(relativeOutputPath, new ExtractedDirectoryPackagingElement(jarPath, pathInJar)); return createParentDirectories(relativeOutputPath, new ExtractedDirectoryPackagingElement(jarPath, pathInJar));
} }
@NotNull
@Override @Override
public PackagingElement<?> createExtractedDirectory(@NotNull VirtualFile jarEntry) { public @NotNull PackagingElement<?> createExtractedDirectory(@NotNull VirtualFile jarEntry) {
LOG.assertTrue(jarEntry.getFileSystem() instanceof JarFileSystem, "Expected file from JAR but file from " + jarEntry.getFileSystem() + " found"); LOG.assertTrue(jarEntry.getFileSystem() instanceof JarFileSystem, "Expected file from JAR but file from " + jarEntry.getFileSystem() + " found");
final String fullPath = jarEntry.getPath(); final String fullPath = jarEntry.getPath();
final int jarEnd = fullPath.indexOf(JarFileSystem.JAR_SEPARATOR); final int jarEnd = fullPath.indexOf(JarFileSystem.JAR_SEPARATOR);
return new ExtractedDirectoryPackagingElement(fullPath.substring(0, jarEnd), fullPath.substring(jarEnd + 1)); return new ExtractedDirectoryPackagingElement(fullPath.substring(0, jarEnd), fullPath.substring(jarEnd + 1));
} }
@NotNull
@Override @Override
public PackagingElement<?> createFileCopyWithParentDirectories(@NotNull String filePath, @NotNull String relativeOutputPath) { public @NotNull PackagingElement<?> createFileCopyWithParentDirectories(@NotNull String filePath, @NotNull String relativeOutputPath) {
return createFileCopyWithParentDirectories(filePath, relativeOutputPath, null); return createFileCopyWithParentDirectories(filePath, relativeOutputPath, null);
} }
@NotNull
@Override @Override
public PackagingElement<?> createFileCopyWithParentDirectories(@NotNull String filePath, public @NotNull PackagingElement<?> createFileCopyWithParentDirectories(@NotNull String filePath,
@NotNull String relativeOutputPath, @NotNull String relativeOutputPath,
@Nullable String outputFileName) { @Nullable String outputFileName) {
return createParentDirectories(relativeOutputPath, createFileCopy(filePath, outputFileName)); return createParentDirectories(relativeOutputPath, createFileCopy(filePath, outputFileName));
} }
@@ -333,15 +309,13 @@ public final class PackagingElementFactoryImpl extends PackagingElementFactory {
return new FileCopyPackagingElement(filePath, outputFileName); return new FileCopyPackagingElement(filePath, outputFileName);
} }
@NotNull
@Override @Override
public PackagingElement<?> createParentDirectories(@NotNull String relativeOutputPath, @NotNull PackagingElement<?> element) { public @NotNull PackagingElement<?> createParentDirectories(@NotNull String relativeOutputPath, @NotNull PackagingElement<?> element) {
return createParentDirectories(relativeOutputPath, Collections.singletonList(element)).get(0); return createParentDirectories(relativeOutputPath, Collections.singletonList(element)).get(0);
} }
@NotNull
@Override @Override
public List<? extends PackagingElement<?>> createParentDirectories(@NotNull String relativeOutputPath, @NotNull List<? extends PackagingElement<?>> elements) { public @NotNull List<? extends PackagingElement<?>> createParentDirectories(@NotNull String relativeOutputPath, @NotNull List<? extends PackagingElement<?>> elements) {
relativeOutputPath = StringUtil.trimStart(relativeOutputPath, "/"); relativeOutputPath = StringUtil.trimStart(relativeOutputPath, "/");
if (relativeOutputPath.length() == 0) { if (relativeOutputPath.length() == 0) {
return elements; return elements;
@@ -375,15 +349,13 @@ public final class PackagingElementFactoryImpl extends PackagingElementFactory {
} }
@Override @Override
@NotNull public @NotNull List<? extends ArtifactRootElement<?>> chooseAndCreate(@NotNull ArtifactEditorContext context, @NotNull Artifact artifact,
public List<? extends ArtifactRootElement<?>> chooseAndCreate(@NotNull ArtifactEditorContext context, @NotNull Artifact artifact, @NotNull CompositePackagingElement<?> parent) {
@NotNull CompositePackagingElement<?> parent) {
throw new UnsupportedOperationException("'create' not implemented in " + getClass().getName()); throw new UnsupportedOperationException("'create' not implemented in " + getClass().getName());
} }
@Override @Override
@NotNull public @NotNull ArtifactRootElement<?> createEmpty(@NotNull Project project) {
public ArtifactRootElement<?> createEmpty(@NotNull Project project) {
return new ArtifactRootElementImpl(); return new ArtifactRootElementImpl();
} }
} }

View File

@@ -1,11 +1,8 @@
// Copyright 2000-2020 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. // Copyright 2000-2024 JetBrains s.r.o. and contributors. Use of this source code is governed by the Apache 2.0 license.
package com.intellij.psi; package com.intellij.psi;
import com.intellij.lang.LanguageExtension; import com.intellij.lang.LanguageExtension;
/**
* @author Serega.Vasiliev
*/
public final class LanguageAnnotationSupport extends LanguageExtension<PsiAnnotationSupport> { public final class LanguageAnnotationSupport extends LanguageExtension<PsiAnnotationSupport> {
public static final LanguageAnnotationSupport INSTANCE = new LanguageAnnotationSupport(); public static final LanguageAnnotationSupport INSTANCE = new LanguageAnnotationSupport();

View File

@@ -29,5 +29,6 @@
<orderEntry type="library" name="jackson-dataformat-yaml" level="project" /> <orderEntry type="library" name="jackson-dataformat-yaml" level="project" />
<orderEntry type="library" name="caffeine" level="project" /> <orderEntry type="library" name="caffeine" level="project" />
<orderEntry type="library" name="StreamEx" level="project" /> <orderEntry type="library" name="StreamEx" level="project" />
<orderEntry type="library" name="kotlinx-collections-immutable" level="project" />
</component> </component>
</module> </module>

View File

@@ -52,7 +52,6 @@ internal fun <T> mergeSets(first: Set<T>?, second: Set<T>?): Set<T>? {
return merged.toImmutableSet() return merged.toImmutableSet()
} }
internal fun MergedJsonSchemaObjectView.booleanOr(memberReference: JsonSchemaObject.() -> Boolean): Boolean { internal fun MergedJsonSchemaObjectView.booleanOr(memberReference: JsonSchemaObject.() -> Boolean): Boolean {
val first = base.memberReference() val first = base.memberReference()
if (first) return true if (first) return true

View File

@@ -32,7 +32,7 @@
<orderEntry type="library" name="kotlinx-coroutines-core" level="project" /> <orderEntry type="library" name="kotlinx-coroutines-core" level="project" />
<orderEntry type="module" module-name="intellij.platform.util.xmlDom" /> <orderEntry type="module" module-name="intellij.platform.util.xmlDom" />
<orderEntry type="module" module-name="intellij.platform.diagnostic" /> <orderEntry type="module" module-name="intellij.platform.diagnostic" />
<orderEntry type="library" exported="" name="kotlinx-collections-immutable" level="project" /> <orderEntry type="library" name="kotlinx-collections-immutable" level="project" />
<orderEntry type="module" module-name="intellij.platform.util.coroutines" /> <orderEntry type="module" module-name="intellij.platform.util.coroutines" />
</component> </component>
</module> </module>

View File

@@ -1,4 +1,4 @@
// Copyright 2000-2023 JetBrains s.r.o. and contributors. Use of this source code is governed by the Apache 2.0 license. // Copyright 2000-2024 JetBrains s.r.o. and contributors. Use of this source code is governed by the Apache 2.0 license.
package com.intellij.lang; package com.intellij.lang;
import com.intellij.openapi.extensions.ExtensionPointName; import com.intellij.openapi.extensions.ExtensionPointName;
@@ -17,8 +17,8 @@ import java.util.*;
import static kotlinx.collections.immutable.ExtensionsKt.persistentListOf; import static kotlinx.collections.immutable.ExtensionsKt.persistentListOf;
public class LanguageExtension<T> extends KeyedExtensionCollector<T, Language> { public class LanguageExtension<T> extends KeyedExtensionCollector<T, Language> {
private final T myDefaultImplementation; private final T defaultImplementation;
private final /* non static!!! */ Key<T> myCacheKey; private final /* non static!!! */ Key<T> cacheKey;
private final /* non static!!! */ Key<PersistentList<T>> allCacheKey; private final /* non static!!! */ Key<PersistentList<T>> allCacheKey;
public LanguageExtension(final @NotNull ExtensionPointName<? extends KeyedLazyInstance<T>> epName) { public LanguageExtension(final @NotNull ExtensionPointName<? extends KeyedLazyInstance<T>> epName) {
@@ -35,8 +35,8 @@ public class LanguageExtension<T> extends KeyedExtensionCollector<T, Language> {
public LanguageExtension(@NonNls String epName, @Nullable T defaultImplementation) { public LanguageExtension(@NonNls String epName, @Nullable T defaultImplementation) {
super(epName); super(epName);
myDefaultImplementation = defaultImplementation; this.defaultImplementation = defaultImplementation;
myCacheKey = Key.create("EXTENSIONS_IN_LANGUAGE_" + epName); cacheKey = Key.create("EXTENSIONS_IN_LANGUAGE_" + epName);
allCacheKey = Key.create("ALL_EXTENSIONS_IN_LANGUAGE_" + epName); allCacheKey = Key.create("ALL_EXTENSIONS_IN_LANGUAGE_" + epName);
} }
@@ -71,7 +71,7 @@ public class LanguageExtension<T> extends KeyedExtensionCollector<T, Language> {
} }
private void clearCacheForLanguage(@NotNull Language language) { private void clearCacheForLanguage(@NotNull Language language) {
language.putUserData(myCacheKey, null); language.putUserData(cacheKey, null);
language.putUserData(allCacheKey, null); language.putUserData(allCacheKey, null);
super.invalidateCacheForExtension(language.getID()); super.invalidateCacheForExtension(language.getID());
} }
@@ -87,12 +87,12 @@ public class LanguageExtension<T> extends KeyedExtensionCollector<T, Language> {
} }
public T forLanguage(@NotNull Language l) { public T forLanguage(@NotNull Language l) {
T cached = l.getUserData(myCacheKey); T cached = l.getUserData(cacheKey);
if (cached != null) return cached; if (cached != null) return cached;
T result = findForLanguage(l); T result = findForLanguage(l);
if (result == null) return null; if (result == null) return null;
result = l.putUserDataIfAbsent(myCacheKey, result); result = l.putUserDataIfAbsent(cacheKey, result);
return result; return result;
} }
@@ -103,7 +103,7 @@ public class LanguageExtension<T> extends KeyedExtensionCollector<T, Language> {
return extensions.get(0); return extensions.get(0);
} }
} }
return myDefaultImplementation; return defaultImplementation;
} }
/** /**
@@ -163,7 +163,7 @@ public class LanguageExtension<T> extends KeyedExtensionCollector<T, Language> {
} }
protected T getDefaultImplementation() { protected T getDefaultImplementation() {
return myDefaultImplementation; return defaultImplementation;
} }
@Override @Override

View File

@@ -1,4 +1,4 @@
// Copyright 2000-2023 JetBrains s.r.o. and contributors. Use of this source code is governed by the Apache 2.0 license. // Copyright 2000-2024 JetBrains s.r.o. and contributors. Use of this source code is governed by the Apache 2.0 license.
package com.intellij.openapi.project package com.intellij.openapi.project
import com.intellij.openapi.Disposable import com.intellij.openapi.Disposable
@@ -15,13 +15,12 @@ import com.intellij.openapi.util.*
import com.intellij.util.ThrowableRunnable import com.intellij.util.ThrowableRunnable
import com.intellij.util.concurrency.annotations.RequiresBlockingContext import com.intellij.util.concurrency.annotations.RequiresBlockingContext
import com.intellij.util.messages.Topic import com.intellij.util.messages.Topic
import kotlinx.collections.immutable.persistentListOf
import kotlinx.collections.immutable.toImmutableList
import org.jetbrains.annotations.ApiStatus import org.jetbrains.annotations.ApiStatus
import org.jetbrains.annotations.ApiStatus.Experimental import org.jetbrains.annotations.ApiStatus.Experimental
import org.jetbrains.annotations.ApiStatus.Obsolete import org.jetbrains.annotations.ApiStatus.Obsolete
import org.jetbrains.annotations.Contract import org.jetbrains.annotations.Contract
import org.jetbrains.annotations.Unmodifiable import org.jetbrains.annotations.Unmodifiable
import java.util.*
import javax.swing.JComponent import javax.swing.JComponent
/** /**
@@ -195,7 +194,7 @@ abstract class DumbService {
} }
return result return result
} }
return if (collection is List<*>) collection as List<T> else collection.toImmutableList() return if (collection is List<*>) collection as List<T> else collection.toList()
} }
/** /**
@@ -435,7 +434,7 @@ abstract class DumbService {
val point = extensionPoint.point val point = extensionPoint.point
val size = point.size() val size = point.size()
if (size == 0) { if (size == 0) {
return persistentListOf() return Collections.emptyList()
} }
if (!getInstance(project).isDumb) { if (!getInstance(project).isDumb) {

View File

@@ -1,4 +1,4 @@
// Copyright 2000-2023 JetBrains s.r.o. and contributors. Use of this source code is governed by the Apache 2.0 license. // Copyright 2000-2024 JetBrains s.r.o. and contributors. Use of this source code is governed by the Apache 2.0 license.
package com.intellij.openapi.util; package com.intellij.openapi.util;
import com.intellij.util.KeyedLazyInstance; import com.intellij.util.KeyedLazyInstance;
@@ -23,7 +23,7 @@ public class ClassExtension<T> extends KeyedExtensionCollector<T, Class<?>> {
} }
@Override @Override
protected final @NotNull PersistentList<T> buildExtensions(@NotNull String key, @NotNull Class classKey) { protected final @NotNull List<T> buildExtensions(@NotNull String key, @NotNull Class classKey) {
Set<String> allSupers = new LinkedHashSet<>(); Set<String> allSupers = new LinkedHashSet<>();
collectSupers(classKey, allSupers); collectSupers(classKey, allSupers);
return buildExtensionsWithInheritance(allSupers); return buildExtensionsWithInheritance(allSupers);

View File

@@ -1,4 +1,4 @@
// Copyright 2000-2023 JetBrains s.r.o. and contributors. Use of this source code is governed by the Apache 2.0 license. // Copyright 2000-2024 JetBrains s.r.o. and contributors. Use of this source code is governed by the Apache 2.0 license.
package com.intellij.openapi.util; package com.intellij.openapi.util;
import com.intellij.diagnostic.PluginException; import com.intellij.diagnostic.PluginException;
@@ -18,6 +18,7 @@ import java.util.function.Predicate;
import static com.intellij.util.containers.UtilKt.with; import static com.intellij.util.containers.UtilKt.with;
import static com.intellij.util.containers.UtilKt.without; import static com.intellij.util.containers.UtilKt.without;
import static kotlinx.collections.immutable.ExtensionsKt.persistentListOf; import static kotlinx.collections.immutable.ExtensionsKt.persistentListOf;
import static kotlinx.collections.immutable.ExtensionsKt.toPersistentList;
public class KeyedExtensionCollector<T, KeyT> implements ModificationTracker { public class KeyedExtensionCollector<T, KeyT> implements ModificationTracker {
private static final Logger LOG = Logger.getInstance(KeyedExtensionCollector.class); private static final Logger LOG = Logger.getInstance(KeyedExtensionCollector.class);
@@ -210,10 +211,10 @@ public class KeyedExtensionCollector<T, KeyT> implements ModificationTracker {
} }
} }
protected final @NotNull PersistentList<T> buildExtensions(@NotNull Set<String> keys) { protected final @NotNull List<T> buildExtensions(@NotNull Set<String> keys) {
List<KeyedLazyInstance<T>> extensions = getExtensions(); List<KeyedLazyInstance<T>> extensions = getExtensions();
synchronized (lock) { synchronized (lock) {
PersistentList<T> explicit = buildExtensionsFromExplicitRegistration(keys::contains); List<T> explicit = buildExtensionsFromExplicitRegistration(keys::contains);
List<T> result = buildExtensionsFromExtensionPoint(bean -> { List<T> result = buildExtensionsFromExtensionPoint(bean -> {
String key; String key;
try { try {
@@ -226,11 +227,11 @@ public class KeyedExtensionCollector<T, KeyT> implements ModificationTracker {
return keys.contains(key); return keys.contains(key);
}, extensions); }, extensions);
return explicit.addAll(result); return toPersistentList(explicit).addAll(result);
} }
} }
protected final @NotNull PersistentList<T> buildExtensionsFromExplicitRegistration(@NotNull Predicate<? super String> isMyBean) { protected final @NotNull List<T> buildExtensionsFromExplicitRegistration(@NotNull Predicate<? super String> isMyBean) {
PersistentList<T> result = persistentListOf(); PersistentList<T> result = persistentListOf();
for (Map.Entry<String, PersistentList<T>> entry : explicitExtensions.entrySet()) { for (Map.Entry<String, PersistentList<T>> entry : explicitExtensions.entrySet()) {
String key = entry.getKey(); String key = entry.getKey();

View File

@@ -35,7 +35,6 @@
<orderEntry type="library" name="automaton" level="project" /> <orderEntry type="library" name="automaton" level="project" />
<orderEntry type="library" name="Guava" level="project" /> <orderEntry type="library" name="Guava" level="project" />
<orderEntry type="module" module-name="intellij.platform.util.diff" /> <orderEntry type="module" module-name="intellij.platform.util.diff" />
<orderEntry type="library" name="kotlinx-collections-immutable" level="project" />
<orderEntry type="module" module-name="intellij.platform.diagnostic" /> <orderEntry type="module" module-name="intellij.platform.diagnostic" />
<orderEntry type="module" module-name="intellij.platform.diagnostic.telemetry" /> <orderEntry type="module" module-name="intellij.platform.diagnostic.telemetry" />
<orderEntry type="library" name="opentelemetry" level="project" /> <orderEntry type="library" name="opentelemetry" level="project" />

View File

@@ -11,8 +11,6 @@ import com.intellij.openapi.extensions.ExtensionDescriptor
import com.intellij.openapi.extensions.PluginId import com.intellij.openapi.extensions.PluginId
import com.intellij.openapi.extensions.impl.ExtensionPointImpl import com.intellij.openapi.extensions.impl.ExtensionPointImpl
import com.intellij.util.Java11Shim import com.intellij.util.Java11Shim
import kotlinx.collections.immutable.persistentListOf
import kotlinx.collections.immutable.toPersistentList
import org.jetbrains.annotations.ApiStatus import org.jetbrains.annotations.ApiStatus
import org.jetbrains.annotations.Nls import org.jetbrains.annotations.Nls
import org.jetbrains.annotations.NonNls import org.jetbrains.annotations.NonNls
@@ -77,7 +75,7 @@ class IdeaPluginDescriptorImpl(raw: RawPluginDescriptor,
// https://youtrack.jetbrains.com/issue/IDEA-206274 // https://youtrack.jetbrains.com/issue/IDEA-206274
val list = raw.depends val list = raw.depends
if (list.isNullOrEmpty()) { if (list.isNullOrEmpty()) {
pluginDependencies = persistentListOf() pluginDependencies = Java11Shim.INSTANCE.listOf()
} }
else { else {
val iterator = list.iterator() val iterator = list.iterator()
@@ -93,7 +91,7 @@ class IdeaPluginDescriptorImpl(raw: RawPluginDescriptor,
} }
} }
} }
pluginDependencies = list.toPersistentList() pluginDependencies = list
} }
} }

View File

@@ -1,8 +1,8 @@
// Copyright 2000-2023 JetBrains s.r.o. and contributors. Use of this source code is governed by the Apache 2.0 license. // Copyright 2000-2024 JetBrains s.r.o. and contributors. Use of this source code is governed by the Apache 2.0 license.
package com.intellij.ide.plugins package com.intellij.ide.plugins
import com.intellij.openapi.extensions.PluginId import com.intellij.openapi.extensions.PluginId
import kotlinx.collections.immutable.persistentListOf import com.intellij.util.Java11Shim
import org.jetbrains.annotations.ApiStatus import org.jetbrains.annotations.ApiStatus
import java.util.* import java.util.*
@@ -26,7 +26,7 @@ class ModuleDependenciesDescriptor(@JvmField val modules: List<ModuleReference>,
@ApiStatus.Internal @ApiStatus.Internal
class PluginContentDescriptor(@JvmField val modules: List<ModuleItem>) { class PluginContentDescriptor(@JvmField val modules: List<ModuleItem>) {
companion object { companion object {
@JvmField val EMPTY: PluginContentDescriptor = PluginContentDescriptor(persistentListOf()) @JvmField val EMPTY: PluginContentDescriptor = PluginContentDescriptor(Java11Shim.INSTANCE.listOf())
} }
@ApiStatus.Internal @ApiStatus.Internal

View File

@@ -1,11 +1,10 @@
// Copyright 2000-2023 JetBrains s.r.o. and contributors. Use of this source code is governed by the Apache 2.0 license. // Copyright 2000-2024 JetBrains s.r.o. and contributors. Use of this source code is governed by the Apache 2.0 license.
@file:Suppress("ReplacePutWithAssignment", "ReplaceGetOrSet", "ReplaceNegatedIsEmptyWithIsNotEmpty") @file:Suppress("ReplacePutWithAssignment", "ReplaceGetOrSet", "ReplaceNegatedIsEmptyWithIsNotEmpty")
package com.intellij.ide.plugins package com.intellij.ide.plugins
import com.intellij.util.graph.DFSTBuilder import com.intellij.util.graph.DFSTBuilder
import com.intellij.util.graph.Graph import com.intellij.util.graph.Graph
import kotlinx.collections.immutable.toPersistentList
import org.jetbrains.annotations.ApiStatus import org.jetbrains.annotations.ApiStatus
import java.util.* import java.util.*
@@ -90,7 +89,7 @@ internal fun createModuleGraph(plugins: Collection<IdeaPluginDescriptorImpl>): M
} }
if (!result.isEmpty()) { if (!result.isEmpty()) {
directDependencies.put(module, result.toPersistentList()) directDependencies.put(module, result.toList())
result.clear() result.clear()
} }
} }

View File

@@ -27,9 +27,6 @@ import com.intellij.util.Java11Shim
import com.intellij.util.PlatformUtils import com.intellij.util.PlatformUtils
import com.intellij.util.lang.UrlClassLoader import com.intellij.util.lang.UrlClassLoader
import com.intellij.util.lang.ZipFilePool import com.intellij.util.lang.ZipFilePool
import kotlinx.collections.immutable.persistentSetOf
import kotlinx.collections.immutable.toPersistentMap
import kotlinx.collections.immutable.toPersistentSet
import kotlinx.coroutines.CompletableDeferred import kotlinx.coroutines.CompletableDeferred
import kotlinx.coroutines.CoroutineScope import kotlinx.coroutines.CoroutineScope
import kotlinx.coroutines.Deferred import kotlinx.coroutines.Deferred
@@ -112,7 +109,7 @@ object PluginManagerCore {
* Bundled plugins that were updated. * Bundled plugins that were updated.
* When we update a bundled plugin, it becomes non-bundled, so it is more challenging for analytics to use that data. * When we update a bundled plugin, it becomes non-bundled, so it is more challenging for analytics to use that data.
*/ */
private var shadowedBundledPlugins: Set<PluginId> = persistentSetOf() private var shadowedBundledPlugins: Set<PluginId> = Collections.emptySet()
private var isRunningFromSources: Boolean? = null private var isRunningFromSources: Boolean? = null
@@ -292,7 +289,7 @@ object PluginManagerCore {
future.cancel(CancellationException("invalidatePlugins")) future.cancel(CancellationException("invalidatePlugins"))
} }
invalidate() invalidate()
shadowedBundledPlugins = persistentSetOf() shadowedBundledPlugins = Collections.emptySet()
} }
@ReviseWhenPortedToJDK(value = "10", description = "Collectors.toUnmodifiableList()") @ReviseWhenPortedToJDK(value = "10", description = "Collectors.toUnmodifiableList()")
@@ -625,7 +622,7 @@ object PluginManagerCore {
} }
val actions = prepareActions(pluginNamesToDisable = pluginsToDisable.values, pluginNamesToEnable = pluginsToEnable.values) val actions = prepareActions(pluginNamesToDisable = pluginsToDisable.values, pluginNamesToEnable = pluginsToEnable.values)
pluginLoadingErrors = pluginErrorsById.toPersistentMap() pluginLoadingErrors = pluginErrorsById
val errorList = preparePluginErrors(globalErrors) val errorList = preparePluginErrors(globalErrors)
if (!errorList.isEmpty()) { if (!errorList.isEmpty()) {
@@ -829,7 +826,7 @@ object PluginManagerCore {
parentActivity = tracerShim.getTraceActivity()) parentActivity = tracerShim.getTraceActivity())
pluginsToDisable = Java11Shim.INSTANCE.copyOf(initResult.pluginIdsToDisable) pluginsToDisable = Java11Shim.INSTANCE.copyOf(initResult.pluginIdsToDisable)
pluginsToEnable = Java11Shim.INSTANCE.copyOf(initResult.pluginIdsToEnable) pluginsToEnable = Java11Shim.INSTANCE.copyOf(initResult.pluginIdsToEnable)
shadowedBundledPlugins = loadingResult.shadowedBundledIds.toPersistentSet() shadowedBundledPlugins = loadingResult.shadowedBundledIds
//activity.setDescription("plugin count: ${initResult.pluginSet.enabledPlugins.size}") //activity.setDescription("plugin count: ${initResult.pluginSet.enabledPlugins.size}")
nullablePluginSet = initResult.pluginSet nullablePluginSet = initResult.pluginSet
initResult.pluginSet initResult.pluginSet
@@ -981,7 +978,7 @@ private fun message(key: @PropertyKey(resourceBundle = CoreBundle.BUNDLE) String
Supplier { CoreBundle.message(key!!, *params) } Supplier { CoreBundle.message(key!!, *params) }
@Synchronized @Synchronized
@ApiStatus.Internal @Internal
fun tryReadPluginIdsFromFile(path: Path, log: Logger): Set<PluginId> { fun tryReadPluginIdsFromFile(path: Path, log: Logger): Set<PluginId> {
try { try {
return readPluginIdsFromFile(path) return readPluginIdsFromFile(path)

View File

@@ -1,4 +1,4 @@
// Copyright 2000-2023 JetBrains s.r.o. and contributors. Use of this source code is governed by the Apache 2.0 license. // Copyright 2000-2024 JetBrains s.r.o. and contributors. Use of this source code is governed by the Apache 2.0 license.
@file:Suppress("ReplaceGetOrSet", "ReplacePutWithAssignment", "ReplaceNegatedIsEmptyWithIsNotEmpty") @file:Suppress("ReplaceGetOrSet", "ReplacePutWithAssignment", "ReplaceNegatedIsEmptyWithIsNotEmpty")
package com.intellij.ide.plugins package com.intellij.ide.plugins
@@ -7,9 +7,6 @@ import com.intellij.core.CoreBundle
import com.intellij.openapi.extensions.PluginId import com.intellij.openapi.extensions.PluginId
import com.intellij.util.Java11Shim import com.intellij.util.Java11Shim
import it.unimi.dsi.fastutil.objects.Object2IntOpenHashMap import it.unimi.dsi.fastutil.objects.Object2IntOpenHashMap
import kotlinx.collections.immutable.mutate
import kotlinx.collections.immutable.persistentListOf
import kotlinx.collections.immutable.persistentSetOf
import org.jetbrains.annotations.ApiStatus import org.jetbrains.annotations.ApiStatus
import org.jetbrains.annotations.Nls import org.jetbrains.annotations.Nls
import org.jetbrains.annotations.PropertyKey import org.jetbrains.annotations.PropertyKey
@@ -132,8 +129,8 @@ class PluginSetBuilder(@JvmField val unsortedPlugins: Set<IdeaPluginDescriptorIm
internal fun createPluginSet(incompletePlugins: Collection<IdeaPluginDescriptorImpl>): PluginSet { internal fun createPluginSet(incompletePlugins: Collection<IdeaPluginDescriptorImpl>): PluginSet {
val sortedPlugins = getSortedPlugins() val sortedPlugins = getSortedPlugins()
// ordered - do not use persistentHashSetOf // must be ordered
val allPlugins = persistentSetOf<IdeaPluginDescriptorImpl>().mutate { result -> val allPlugins = LinkedHashSet<IdeaPluginDescriptorImpl>().also { result ->
result.addAll(sortedPlugins) result.addAll(sortedPlugins)
result.addAll(incompletePlugins) result.addAll(incompletePlugins)
} }
@@ -142,12 +139,12 @@ class PluginSetBuilder(@JvmField val unsortedPlugins: Set<IdeaPluginDescriptorIm
return PluginSet( return PluginSet(
moduleGraph = moduleGraph, moduleGraph = moduleGraph,
allPlugins = allPlugins, allPlugins = allPlugins,
enabledPlugins = persistentListOf<IdeaPluginDescriptorImpl>().mutate { result -> enabledPlugins = ArrayList<IdeaPluginDescriptorImpl>().also { result ->
sortedPlugins.filterTo(result) { it.isEnabled } sortedPlugins.filterTo(result) { it.isEnabled }
}, },
enabledModuleMap = java11Shim.copyOf(enabledModuleV2Ids), enabledModuleMap = java11Shim.copyOf(enabledModuleV2Ids),
enabledPluginAndV1ModuleMap = java11Shim.copyOf(enabledPluginIds), enabledPluginAndV1ModuleMap = java11Shim.copyOf(enabledPluginIds),
enabledModules = persistentListOf<IdeaPluginDescriptorImpl>().mutate { result -> enabledModules = ArrayList<IdeaPluginDescriptorImpl>().also { result ->
for (module in moduleGraph.nodes) { for (module in moduleGraph.nodes) {
if (if (module.moduleName == null) module.isEnabled else enabledModuleV2Ids.containsKey(module.moduleName)) { if (if (module.moduleName == null) module.isEnabled else enabledModuleV2Ids.containsKey(module.moduleName)) {
result.add(module) result.add(module)

View File

@@ -12,13 +12,12 @@ import com.intellij.openapi.extensions.ExtensionDescriptor
import com.intellij.openapi.extensions.ExtensionPointDescriptor import com.intellij.openapi.extensions.ExtensionPointDescriptor
import com.intellij.openapi.extensions.LoadingOrder import com.intellij.openapi.extensions.LoadingOrder
import com.intellij.openapi.extensions.PluginId import com.intellij.openapi.extensions.PluginId
import com.intellij.util.Java11Shim
import com.intellij.util.messages.ListenerDescriptor import com.intellij.util.messages.ListenerDescriptor
import com.intellij.util.xml.dom.NoOpXmlInterner import com.intellij.util.xml.dom.NoOpXmlInterner
import com.intellij.util.xml.dom.XmlInterner import com.intellij.util.xml.dom.XmlInterner
import com.intellij.util.xml.dom.createNonCoalescingXmlStreamReader import com.intellij.util.xml.dom.createNonCoalescingXmlStreamReader
import com.intellij.util.xml.dom.readXmlAsModel import com.intellij.util.xml.dom.readXmlAsModel
import kotlinx.collections.immutable.persistentHashSetOf
import kotlinx.collections.immutable.persistentListOf
import org.codehaus.stax2.XMLStreamReader2 import org.codehaus.stax2.XMLStreamReader2
import org.codehaus.stax2.typed.TypedXMLStreamException import org.codehaus.stax2.typed.TypedXMLStreamException
import org.jetbrains.annotations.ApiStatus import org.jetbrains.annotations.ApiStatus
@@ -171,17 +170,17 @@ private fun readRootAttributes(reader: XMLStreamReader2, descriptor: RawPluginDe
/** /**
* Keep in sync with KotlinPluginUtil.KNOWN_KOTLIN_PLUGIN_IDS * Keep in sync with KotlinPluginUtil.KNOWN_KOTLIN_PLUGIN_IDS
*/ */
private val KNOWN_KOTLIN_PLUGIN_IDS = persistentHashSetOf( private val KNOWN_KOTLIN_PLUGIN_IDS = Java11Shim.INSTANCE.copyOf(listOf(
"org.jetbrains.kotlin", "org.jetbrains.kotlin",
"com.intellij.appcode.kmm", "com.intellij.appcode.kmm",
"org.jetbrains.kotlin.native.appcode" "org.jetbrains.kotlin.native.appcode"
) ))
fun isKotlinPlugin(pluginId: PluginId): Boolean { fun isKotlinPlugin(pluginId: PluginId): Boolean {
return pluginId.idString in KNOWN_KOTLIN_PLUGIN_IDS return pluginId.idString in KNOWN_KOTLIN_PLUGIN_IDS
} }
private val K2_ALLOWED_PLUGIN_IDS = KNOWN_KOTLIN_PLUGIN_IDS.addAll(persistentHashSetOf( private val K2_ALLOWED_PLUGIN_IDS = Java11Shim.INSTANCE.copyOf(KNOWN_KOTLIN_PLUGIN_IDS + listOf(
"fleet.backend.mercury", "fleet.backend.mercury",
"fleet.backend.mercury.macos", "fleet.backend.mercury.macos",
"fleet.backend.mercury.kotlin.macos", "fleet.backend.mercury.kotlin.macos",
@@ -779,8 +778,8 @@ private fun readContent(reader: XMLStreamReader2, descriptor: RawPluginDescripto
} }
private fun readDependencies(reader: XMLStreamReader2, descriptor: RawPluginDescriptor, readContext: ReadModuleContext) { private fun readDependencies(reader: XMLStreamReader2, descriptor: RawPluginDescriptor, readContext: ReadModuleContext) {
var modules = persistentListOf<ModuleDependenciesDescriptor.ModuleReference>() val modules = ArrayList<ModuleDependenciesDescriptor.ModuleReference>()
var plugins = persistentListOf<ModuleDependenciesDescriptor.PluginReference>() val plugins = ArrayList<ModuleDependenciesDescriptor.PluginReference>()
reader.consumeChildElements { elementName -> reader.consumeChildElements { elementName ->
when (elementName) { when (elementName) {
"module" -> { "module" -> {
@@ -791,7 +790,7 @@ private fun readDependencies(reader: XMLStreamReader2, descriptor: RawPluginDesc
} }
} }
modules = modules.add(ModuleDependenciesDescriptor.ModuleReference(name!!)) modules.add(ModuleDependenciesDescriptor.ModuleReference(name!!))
} }
"plugin" -> { "plugin" -> {
var id: String? = null var id: String? = null
@@ -801,12 +800,13 @@ private fun readDependencies(reader: XMLStreamReader2, descriptor: RawPluginDesc
} }
} }
plugins = plugins.add(ModuleDependenciesDescriptor.PluginReference(PluginId.getId(id!!))) plugins.add(ModuleDependenciesDescriptor.PluginReference(PluginId.getId(id!!)))
} }
else -> throw RuntimeException("Unknown content item type: $elementName") else -> throw RuntimeException("Unknown content item type: $elementName")
} }
reader.skipElement() reader.skipElement()
} }
descriptor.dependencies = ModuleDependenciesDescriptor(modules, plugins) descriptor.dependencies = ModuleDependenciesDescriptor(modules, plugins)
assert(reader.isEndElement) assert(reader.isEndElement)
} }

View File

@@ -1,4 +1,4 @@
// Copyright 2000-2023 JetBrains s.r.o. and contributors. Use of this source code is governed by the Apache 2.0 license. // Copyright 2000-2024 JetBrains s.r.o. and contributors. Use of this source code is governed by the Apache 2.0 license.
@file:Suppress("ReplacePutWithAssignment") @file:Suppress("ReplacePutWithAssignment")
package com.intellij.ide.plugins package com.intellij.ide.plugins
@@ -6,8 +6,6 @@ package com.intellij.ide.plugins
import com.intellij.openapi.application.PathManager import com.intellij.openapi.application.PathManager
import com.intellij.openapi.diagnostic.Logger import com.intellij.openapi.diagnostic.Logger
import com.intellij.openapi.extensions.PluginId import com.intellij.openapi.extensions.PluginId
import kotlinx.collections.immutable.mutate
import kotlinx.collections.immutable.persistentHashSetOf
import org.jetbrains.annotations.ApiStatus.Internal import org.jetbrains.annotations.ApiStatus.Internal
import java.io.BufferedInputStream import java.io.BufferedInputStream
import java.io.BufferedOutputStream import java.io.BufferedOutputStream
@@ -111,7 +109,7 @@ private fun tryReadBrokenPluginsFile(brokenPluginsStorage: Path): Map<PluginId,
val result = HashMap<PluginId, Set<String>>(count) val result = HashMap<PluginId, Set<String>>(count)
for (i in 0 until count) { for (i in 0 until count) {
val pluginId = PluginId.getId(stream.readUTF()) val pluginId = PluginId.getId(stream.readUTF())
result.put(pluginId, persistentHashSetOf<String>().mutate { r -> result.put(pluginId, HashSet<String>().also { r ->
repeat(stream.readUnsignedShort()) { repeat(stream.readUnsignedShort()) {
r.add(stream.readUTF()) r.add(stream.readUTF())
} }

View File

@@ -1,4 +1,4 @@
// Copyright 2000-2023 JetBrains s.r.o. and contributors. Use of this source code is governed by the Apache 2.0 license. // Copyright 2000-2024 JetBrains s.r.o. and contributors. Use of this source code is governed by the Apache 2.0 license.
package com.intellij.openapi.fileTypes; package com.intellij.openapi.fileTypes;
import com.intellij.openapi.editor.colors.EditorColorsScheme; import com.intellij.openapi.editor.colors.EditorColorsScheme;
@@ -13,8 +13,6 @@ import org.jetbrains.annotations.Nullable;
import java.util.List; import java.util.List;
import static kotlinx.collections.immutable.ExtensionsKt.persistentListOf;
public final class FileTypeEditorHighlighterProviders extends FileTypeExtension<EditorHighlighterProvider> { public final class FileTypeEditorHighlighterProviders extends FileTypeExtension<EditorHighlighterProvider> {
public static final ExtensionPointName<KeyedLazyInstance<EditorHighlighterProvider>> EP_NAME = ExtensionPointName.create("com.intellij.editorHighlighterProvider"); public static final ExtensionPointName<KeyedLazyInstance<EditorHighlighterProvider>> EP_NAME = ExtensionPointName.create("com.intellij.editorHighlighterProvider");
public static final FileTypeEditorHighlighterProviders INSTANCE = new FileTypeEditorHighlighterProviders(); public static final FileTypeEditorHighlighterProviders INSTANCE = new FileTypeEditorHighlighterProviders();
@@ -40,7 +38,7 @@ public final class FileTypeEditorHighlighterProviders extends FileTypeExtension<
SyntaxHighlighterFactory.getSyntaxHighlighter(fileType, project, virtualFile), colors); SyntaxHighlighterFactory.getSyntaxHighlighter(fileType, project, virtualFile), colors);
} }
}; };
return persistentListOf(defaultProvider); return List.of(defaultProvider);
} }
return fromEP; return fromEP;
} }

View File

@@ -1,4 +1,4 @@
// Copyright 2000-2023 JetBrains s.r.o. and contributors. Use of this source code is governed by the Apache 2.0 license. // Copyright 2000-2024 JetBrains s.r.o. and contributors. Use of this source code is governed by the Apache 2.0 license.
package com.intellij.openapi.fileTypes; package com.intellij.openapi.fileTypes;
import com.intellij.lang.Language; import com.intellij.lang.Language;
@@ -12,8 +12,6 @@ import org.jetbrains.annotations.NotNull;
import java.util.List; import java.util.List;
import static kotlinx.collections.immutable.ExtensionsKt.persistentListOf;
public final class SyntaxHighlighterLanguageFactory extends LanguageExtension<SyntaxHighlighterFactory> { public final class SyntaxHighlighterLanguageFactory extends LanguageExtension<SyntaxHighlighterFactory> {
public static final ExtensionPointName<KeyedLazyInstance<SyntaxHighlighterFactory>> EP_NAME = new ExtensionPointName<>("com.intellij.lang.syntaxHighlighterFactory"); public static final ExtensionPointName<KeyedLazyInstance<SyntaxHighlighterFactory>> EP_NAME = new ExtensionPointName<>("com.intellij.lang.syntaxHighlighterFactory");
@@ -33,7 +31,7 @@ public final class SyntaxHighlighterLanguageFactory extends LanguageExtension<Sy
SyntaxHighlighter highlighter = LanguageSyntaxHighlighters.INSTANCE.forLanguage(key); SyntaxHighlighter highlighter = LanguageSyntaxHighlighters.INSTANCE.forLanguage(key);
if (highlighter != null) { if (highlighter != null) {
checkAddEPListener(); checkAddEPListener();
return persistentListOf(new SingleLazyInstanceSyntaxHighlighterFactory() { return List.of(new SingleLazyInstanceSyntaxHighlighterFactory() {
@Override @Override
protected @NotNull SyntaxHighlighter createHighlighter() { protected @NotNull SyntaxHighlighter createHighlighter() {
return highlighter; return highlighter;

View File

@@ -1,4 +1,4 @@
// Copyright 2000-2021 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. // Copyright 2000-2024 JetBrains s.r.o. and contributors. Use of this source code is governed by the Apache 2.0 license.
package com.intellij.lang.findUsages; package com.intellij.lang.findUsages;
@@ -13,7 +13,6 @@ import java.util.Collections;
import java.util.List; import java.util.List;
import java.util.function.Function; import java.util.function.Function;
public class LanguageFindUsages extends LanguageExtension<FindUsagesProvider> { public class LanguageFindUsages extends LanguageExtension<FindUsagesProvider> {
public static final LanguageFindUsages INSTANCE = new LanguageFindUsages() { public static final LanguageFindUsages INSTANCE = new LanguageFindUsages() {
@NotNull @NotNull

View File

@@ -98,5 +98,6 @@
<orderEntry type="module" module-name="intellij.platform.util.coroutines" /> <orderEntry type="module" module-name="intellij.platform.util.coroutines" />
<orderEntry type="module" module-name="intellij.platform.analysis" /> <orderEntry type="module" module-name="intellij.platform.analysis" />
<orderEntry type="module" module-name="intellij.platform.util.xmlDom" /> <orderEntry type="module" module-name="intellij.platform.util.xmlDom" />
<orderEntry type="library" name="kotlinx-collections-immutable" level="project" />
</component> </component>
</module> </module>

View File

@@ -144,5 +144,6 @@
<orderEntry type="library" name="lz4-java" level="project" /> <orderEntry type="library" name="lz4-java" level="project" />
<orderEntry type="module" module-name="intellij.platform.ml" /> <orderEntry type="module" module-name="intellij.platform.ml" />
<orderEntry type="library" name="commons-compress" level="project" /> <orderEntry type="library" name="commons-compress" level="project" />
<orderEntry type="library" name="kotlinx-collections-immutable" level="project" />
</component> </component>
</module> </module>

View File

@@ -128,7 +128,7 @@ internal class IdeaFreezeReporter : PerformanceListener {
val edtStack = dump.edtStackTrace val edtStack = dump.edtStackTrace
if (edtStack != null) { if (edtStack != null) {
stacktraceCommonPart = if (stacktraceCommonPart == null) { stacktraceCommonPart = if (stacktraceCommonPart == null) {
@Suppress("ReplaceJavaStaticMethodWithKotlinAnalog", "RemoveRedundantQualifierName") @Suppress("ReplaceJavaStaticMethodWithKotlinAnalog")
java.util.List.of(*edtStack) java.util.List.of(*edtStack)
} }
else { else {
@@ -191,7 +191,7 @@ internal class IdeaFreezeReporter : PerformanceListener {
reportDir: Path?, reportDir: Path?,
performanceWatcher: PerformanceWatcher, performanceWatcher: PerformanceWatcher,
finished: Boolean): IdeaLoggingEvent? { finished: Boolean): IdeaLoggingEvent? {
var infos: List<Array<ThreadInfo>> = dumpTask.threadInfos var infos = dumpTask.threadInfos.toList()
val dumpInterval = (if (infos.isEmpty()) performanceWatcher.dumpInterval else dumpTask.dumpInterval).toLong() val dumpInterval = (if (infos.isEmpty()) performanceWatcher.dumpInterval else dumpTask.dumpInterval).toLong()
if (infos.isEmpty()) { if (infos.isEmpty()) {
infos = currentDumps.map { it.threadInfos } infos = currentDumps.map { it.threadInfos }
@@ -314,7 +314,7 @@ private class CallTreeNode(private val stackTraceElement: StackTraceElement?,
fun findDominantCommonStack(threshold: Long): CallTreeNode? { fun findDominantCommonStack(threshold: Long): CallTreeNode? {
var node: CallTreeNode? = getMostHitChild() ?: return null var node: CallTreeNode? = getMostHitChild() ?: return null
while (node != null && !node.children.isNullOrEmpty()) { while (node != null && !node.children.isEmpty()) {
val mostHitChild = node.getMostHitChild() val mostHitChild = node.getMostHitChild()
if (mostHitChild == null || mostHitChild.time <= threshold) break if (mostHitChild == null || mostHitChild.time <= threshold) break
node = mostHitChild node = mostHitChild

View File

@@ -1,4 +1,4 @@
// Copyright 2000-2023 JetBrains s.r.o. and contributors. Use of this source code is governed by the Apache 2.0 license. // Copyright 2000-2024 JetBrains s.r.o. and contributors. Use of this source code is governed by the Apache 2.0 license.
@file:Suppress("ReplaceGetOrSet", "JAVA_MODULE_DOES_NOT_EXPORT_PACKAGE") @file:Suppress("ReplaceGetOrSet", "JAVA_MODULE_DOES_NOT_EXPORT_PACKAGE")
package com.intellij.diagnostic package com.intellij.diagnostic
@@ -451,7 +451,7 @@ private fun postProcessReportFolder(durationMs: Long, task: SamplingTask, dir: P
private fun getFreezePlaceSuffix(task: SamplingTask): String { private fun getFreezePlaceSuffix(task: SamplingTask): String {
var stacktraceCommonPart: List<StackTraceElement>? = null var stacktraceCommonPart: List<StackTraceElement>? = null
for (info in task.threadInfos) { for (info in task.threadInfos.asIterable()) {
val edt = info.firstOrNull(ThreadDumper::isEDT) ?: continue val edt = info.firstOrNull(ThreadDumper::isEDT) ?: continue
val edtStack = edt.stackTrace ?: continue val edtStack = edt.stackTrace ?: continue
stacktraceCommonPart = if (stacktraceCommonPart == null) { stacktraceCommonPart = if (stacktraceCommonPart == null) {
@@ -466,7 +466,7 @@ private fun getFreezePlaceSuffix(task: SamplingTask): String {
return "" return ""
} }
val element = stacktraceCommonPart[0] val element = stacktraceCommonPart.first()
return "-${sanitizeFileName(StringUtilRt.getShortName(element.className))}.${sanitizeFileName(element.methodName)}" return "-${sanitizeFileName(StringUtilRt.getShortName(element.className))}.${sanitizeFileName(element.methodName)}"
} }

View File

@@ -1,9 +1,8 @@
// Copyright 2000-2023 JetBrains s.r.o. and contributors. Use of this source code is governed by the Apache 2.0 license. // Copyright 2000-2024 JetBrains s.r.o. and contributors. Use of this source code is governed by the Apache 2.0 license.
package com.intellij.diagnostic package com.intellij.diagnostic
import com.intellij.util.containers.UList
import com.sun.management.OperatingSystemMXBean import com.sun.management.OperatingSystemMXBean
import kotlinx.collections.immutable.PersistentList
import kotlinx.collections.immutable.persistentListOf
import kotlinx.coroutines.* import kotlinx.coroutines.*
import java.lang.management.ManagementFactory import java.lang.management.ManagementFactory
import java.lang.management.ThreadInfo import java.lang.management.ThreadInfo
@@ -14,7 +13,7 @@ import kotlin.time.Duration.Companion.milliseconds
internal open class SamplingTask(@JvmField internal val dumpInterval: Int, maxDurationMs: Int, coroutineScope: CoroutineScope) { internal open class SamplingTask(@JvmField internal val dumpInterval: Int, maxDurationMs: Int, coroutineScope: CoroutineScope) {
private val maxDumps: Int = maxDurationMs / dumpInterval private val maxDumps: Int = maxDurationMs / dumpInterval
var threadInfos: PersistentList<Array<ThreadInfo>> = persistentListOf() var threadInfos: UList<Array<ThreadInfo>> = UList()
private set private set
private val job: Job? private val job: Job?

View File

@@ -1,4 +1,4 @@
// Copyright 2000-2023 JetBrains s.r.o. and contributors. Use of this source code is governed by the Apache 2.0 license. // Copyright 2000-2024 JetBrains s.r.o. and contributors. Use of this source code is governed by the Apache 2.0 license.
package com.intellij.openapi.project package com.intellij.openapi.project
import com.intellij.openapi.Disposable import com.intellij.openapi.Disposable
@@ -48,11 +48,11 @@ class UnindexedFilesScannerExecutor(project: Project)
thisLogger().debug(Throwable("submit task, thread=${Thread.currentThread()}")) thisLogger().debug(Throwable("submit task, thread=${Thread.currentThread()}"))
// Two tasks with limited checks should be just run one after another. // Two tasks with limited checks should be just run one after another.
// A case of a full check followed by a limited change cancelling first one and making a full check anew results // A case of a full check followed by a limited change cancelling the first one and making a full check anew results
// in endless restart of full checks on Windows with empty Maven cache. // in endless restart of full checks on Windows with empty Maven cache.
// So only in case the second one is a full check should the first one be cancelled. // So only in case the second one is a full check should the first one be cancelled.
if (task.isFullIndexUpdate()) { if (task.isFullIndexUpdate()) {
// we don't want to execute any of the existing tasks - the only task we want to execute will be submitted few lines below // we don't want to execute any of the existing tasks - the only task we want to execute will be submitted the few lines below
cancelAllTasks() cancelAllTasks()
cancelRunningScannerTaskInDumbQueue() cancelRunningScannerTaskInDumbQueue()
} }
@@ -90,7 +90,7 @@ class UnindexedFilesScannerExecutor(project: Project)
} }
fun cancelAllTasksAndWait() { fun cancelAllTasksAndWait() {
cancelAllTasks() // this also cancels running task even if they paused by ProgressSuspender cancelAllTasks() // this also cancels a running task even if they paused by ProgressSuspender
while (isRunning.value && !project.isDisposed) { while (isRunning.value && !project.isDisposed) {
PingProgress.interactWithEdtProgress() PingProgress.interactWithEdtProgress()
LockSupport.parkNanos(50_000_000) LockSupport.parkNanos(50_000_000)

View File

@@ -1,4 +1,4 @@
// Copyright 2000-2023 JetBrains s.r.o. and contributors. Use of this source code is governed by the Apache 2.0 license. // Copyright 2000-2024 JetBrains s.r.o. and contributors. Use of this source code is governed by the Apache 2.0 license.
package com.intellij.platform.ide.bootstrap package com.intellij.platform.ide.bootstrap
import com.intellij.concurrency.ConcurrentCollectionFactory import com.intellij.concurrency.ConcurrentCollectionFactory
@@ -45,8 +45,7 @@ class Java11ShimImpl : Java11Shim() {
9 -> java.util.List.of(array[0], array[1], array[2], array[3], array[4], array[5], array[6], array[7], array[8]) 9 -> java.util.List.of(array[0], array[1], array[2], array[3], array[4], array[5], array[6], array[7], array[8])
10 -> java.util.List.of(array[0], array[1], array[2], array[3], array[4], array[5], array[6], array[7], array[8], array[9]) 10 -> java.util.List.of(array[0], array[1], array[2], array[3], array[4], array[5], array[6], array[7], array[8], array[9])
11 -> java.util.List.of(array[0], array[1], array[2], array[3], array[4], array[5], array[6], array[7], array[8], array[9], array[10]) 11 -> java.util.List.of(array[0], array[1], array[2], array[3], array[4], array[5], array[6], array[7], array[8], array[9], array[10])
12 -> java.util.List.of(array[0], array[1], array[2], array[3], array[4], array[5], array[6], array[7], array[8], array[9], array[10], 12 -> java.util.List.of(array[0], array[1], array[2], array[3], array[4], array[5], array[6], array[7], array[8], array[9], array[10], array[11])
array[11])
else -> { else -> {
if (array.size == size) { if (array.size == size) {
java.util.List.of(*array) java.util.List.of(*array)

View File

@@ -35,12 +35,11 @@ import com.intellij.platform.instanceContainer.internal.*
import com.intellij.platform.util.coroutines.namedChildScope import com.intellij.platform.util.coroutines.namedChildScope
import com.intellij.util.concurrency.ThreadingAssertions import com.intellij.util.concurrency.ThreadingAssertions
import com.intellij.util.concurrency.annotations.RequiresBlockingContext import com.intellij.util.concurrency.annotations.RequiresBlockingContext
import com.intellij.util.containers.UList
import com.intellij.util.messages.* import com.intellij.util.messages.*
import com.intellij.util.messages.impl.MessageBusEx import com.intellij.util.messages.impl.MessageBusEx
import com.intellij.util.messages.impl.MessageBusImpl import com.intellij.util.messages.impl.MessageBusImpl
import com.intellij.util.runSuppressing import com.intellij.util.runSuppressing
import kotlinx.collections.immutable.PersistentList
import kotlinx.collections.immutable.persistentListOf
import kotlinx.coroutines.* import kotlinx.coroutines.*
import org.jetbrains.annotations.ApiStatus.Internal import org.jetbrains.annotations.ApiStatus.Internal
import org.jetbrains.annotations.TestOnly import org.jetbrains.annotations.TestOnly
@@ -1408,7 +1407,7 @@ abstract class ComponentManagerImpl(
private class PluginServicesStore { private class PluginServicesStore {
private val regularServices = ConcurrentHashMap<IdeaPluginDescriptor, UnregisterHandle>() private val regularServices = ConcurrentHashMap<IdeaPluginDescriptor, UnregisterHandle>()
private val dynamicServices = ConcurrentHashMap<IdeaPluginDescriptor, PersistentList<InstanceHolder>>() private val dynamicServices = ConcurrentHashMap<IdeaPluginDescriptor, UList<InstanceHolder>>()
fun putServicesUnregisterHandle(descriptor: IdeaPluginDescriptor, handle: UnregisterHandle) { fun putServicesUnregisterHandle(descriptor: IdeaPluginDescriptor, handle: UnregisterHandle) {
val prev = regularServices.put(descriptor, handle) val prev = regularServices.put(descriptor, handle)
@@ -1421,12 +1420,12 @@ private class PluginServicesStore {
fun addDynamicService(descriptor: IdeaPluginDescriptor, holder: InstanceHolder) { fun addDynamicService(descriptor: IdeaPluginDescriptor, holder: InstanceHolder) {
dynamicServices.compute(descriptor) { _, instances -> dynamicServices.compute(descriptor) { _, instances ->
(instances ?: persistentListOf()).add(holder) (instances ?: UList()).add(holder)
} }
} }
fun removeDynamicServices(descriptor: IdeaPluginDescriptor): List<InstanceHolder> { fun removeDynamicServices(descriptor: IdeaPluginDescriptor): List<InstanceHolder> {
return dynamicServices.remove(descriptor) ?: java.util.List.of() return dynamicServices.remove(descriptor)?.toList() ?: java.util.List.of()
} }
} }

View File

@@ -1,9 +1,11 @@
// Copyright 2000-2023 JetBrains s.r.o. and contributors. Use of this source code is governed by the Apache 2.0 license. // Copyright 2000-2024 JetBrains s.r.o. and contributors. Use of this source code is governed by the Apache 2.0 license.
@file:Suppress("ReplacePutWithAssignment") @file:Suppress("ReplacePutWithAssignment")
package com.intellij.util.containers package com.intellij.util.containers
import com.intellij.openapi.diagnostic.Logger import com.intellij.openapi.diagnostic.Logger
import com.intellij.util.ArrayUtil
import com.intellij.util.ArrayUtilRt
import com.intellij.util.Java11Shim import com.intellij.util.Java11Shim
import com.intellij.util.SmartList import com.intellij.util.SmartList
import com.intellij.util.lang.CompoundRuntimeException import com.intellij.util.lang.CompoundRuntimeException
@@ -14,6 +16,28 @@ import java.util.stream.Stream
import kotlin.collections.ArrayDeque import kotlin.collections.ArrayDeque
import kotlin.collections.isNullOrEmpty import kotlin.collections.isNullOrEmpty
@Internal
@Experimental
@JvmInline
value class UList<T>(private val array: Array<Any?> = ArrayUtilRt.EMPTY_OBJECT_ARRAY) {
val size: Int
get() = array.size
fun add(item: T): UList<T> {
return UList(ArrayUtil.append(/* src = */ array, /* element = */ item, /* factory = */ ArrayUtil.OBJECT_ARRAY_FACTORY))
}
fun remove(item: T): UList<T> {
return UList(ArrayUtil.remove(/* src = */ array, /* element = */ item, /* factory = */ ArrayUtil.OBJECT_ARRAY_FACTORY))
}
@Suppress("UNCHECKED_CAST")
fun toList(): List<T> = Java11Shim.INSTANCE.listOf(array, array.size) as List<T>
@Suppress("UNCHECKED_CAST")
fun asIterable(): Iterable<T> = array.asIterable() as Iterable<T>
}
fun <K, V> MutableMap<K, MutableList<V>>.remove(key: K, value: V) { fun <K, V> MutableMap<K, MutableList<V>>.remove(key: K, value: V) {
val list = get(key) val list = get(key)
if (list != null && list.remove(value) && list.isEmpty()) { if (list != null && list.remove(value) && list.isEmpty()) {

View File

@@ -1,17 +1,15 @@
// Copyright 2000-2023 JetBrains s.r.o. and contributors. Use of this source code is governed by the Apache 2.0 license. // Copyright 2000-2024 JetBrains s.r.o. and contributors. Use of this source code is governed by the Apache 2.0 license.
package com.intellij.openapi.vcs.impl package com.intellij.openapi.vcs.impl
import com.intellij.openapi.vcs.AbstractVcs import com.intellij.openapi.vcs.AbstractVcs
import com.intellij.openapi.vcs.checkin.BaseCheckinHandlerFactory import com.intellij.openapi.vcs.checkin.BaseCheckinHandlerFactory
import com.intellij.openapi.vcs.checkin.CheckinHandlerFactory import com.intellij.openapi.vcs.checkin.CheckinHandlerFactory
import com.intellij.openapi.vcs.checkin.VcsCheckinHandlerFactory import com.intellij.openapi.vcs.checkin.VcsCheckinHandlerFactory
import kotlinx.collections.immutable.mutate
import kotlinx.collections.immutable.persistentListOf
class CheckinHandlersManagerImpl : CheckinHandlersManager() { class CheckinHandlersManagerImpl : CheckinHandlersManager() {
override fun getRegisteredCheckinHandlerFactories(vcses: Array<AbstractVcs>): List<BaseCheckinHandlerFactory> { override fun getRegisteredCheckinHandlerFactories(vcses: Array<AbstractVcs>): List<BaseCheckinHandlerFactory> {
val vcsesKeys = vcses.mapTo(HashSet()) { it.keyInstanceMethod } val vcsesKeys = vcses.mapTo(HashSet()) { it.keyInstanceMethod }
return persistentListOf<BaseCheckinHandlerFactory>().mutate { builder -> return ArrayList<BaseCheckinHandlerFactory>().also { builder ->
VcsCheckinHandlerFactory.EP_NAME.extensionList.filterTo(builder) { it.key in vcsesKeys } VcsCheckinHandlerFactory.EP_NAME.extensionList.filterTo(builder) { it.key in vcsesKeys }
builder.addAll(CheckinHandlerFactory.EP_NAME.extensionList) builder.addAll(CheckinHandlerFactory.EP_NAME.extensionList)
} }

View File

@@ -27,6 +27,7 @@
<orderEntry type="module" module-name="intellij.platform.backend.workspace" scope="TEST" /> <orderEntry type="module" module-name="intellij.platform.backend.workspace" scope="TEST" />
<orderEntry type="module" module-name="intellij.tools.ide.metrics.benchmark" scope="TEST" /> <orderEntry type="module" module-name="intellij.tools.ide.metrics.benchmark" scope="TEST" />
<orderEntry type="module" module-name="intellij.platform.util.coroutines" scope="TEST" /> <orderEntry type="module" module-name="intellij.platform.util.coroutines" scope="TEST" />
<orderEntry type="library" name="kotlinx-collections-immutable" level="project" />
</component> </component>
<component name="TestModuleProperties" production-module="intellij.platform.workspace.jps" /> <component name="TestModuleProperties" production-module="intellij.platform.workspace.jps" />
</module> </module>

View File

@@ -17,6 +17,7 @@
<orderEntry type="library" name="kotlin-test" level="project" /> <orderEntry type="library" name="kotlin-test" level="project" />
<orderEntry type="library" name="Kryo5" level="project" /> <orderEntry type="library" name="Kryo5" level="project" />
<orderEntry type="module" module-name="intellij.platform.testFramework.junit5" scope="TEST" /> <orderEntry type="module" module-name="intellij.platform.testFramework.junit5" scope="TEST" />
<orderEntry type="library" name="kotlinx-collections-immutable" level="project" />
</component> </component>
<component name="TestModuleProperties" production-module="intellij.platform.workspace.storage" /> <component name="TestModuleProperties" production-module="intellij.platform.workspace.storage" />
</module> </module>

View File

@@ -1,4 +1,4 @@
// Copyright 2000-2023 JetBrains s.r.o. and contributors. Use of this source code is governed by the Apache 2.0 license. // Copyright 2000-2024 JetBrains s.r.o. and contributors. Use of this source code is governed by the Apache 2.0 license.
package org.jetbrains.idea.maven.indices package org.jetbrains.idea.maven.indices
import com.intellij.openapi.application.ApplicationManager import com.intellij.openapi.application.ApplicationManager
@@ -18,7 +18,6 @@ import com.intellij.platform.ide.progress.withBackgroundProgress
import com.intellij.util.PathUtilRt import com.intellij.util.PathUtilRt
import com.intellij.util.messages.Topic import com.intellij.util.messages.Topic
import com.intellij.util.xmlb.annotations.OptionTag import com.intellij.util.xmlb.annotations.OptionTag
import kotlinx.collections.immutable.toImmutableList
import kotlinx.coroutines.* import kotlinx.coroutines.*
import kotlinx.coroutines.sync.Mutex import kotlinx.coroutines.sync.Mutex
import kotlinx.coroutines.sync.withLock import kotlinx.coroutines.sync.withLock
@@ -307,7 +306,7 @@ class MavenSystemIndicesManager(val cs: CoroutineScope) : PersistentStateCompone
@TestOnly @TestOnly
fun getAllGavIndices(): List<MavenGAVIndex> { fun getAllGavIndices(): List<MavenGAVIndex> {
return inMemoryIndices.values.toImmutableList() return java.util.List.copyOf(inMemoryIndices.values)
} }
fun updateIndexContent(repositoryInfo: MavenRepositoryInfo, project: Project) { fun updateIndexContent(repositoryInfo: MavenRepositoryInfo, project: Project) {