From 69e7be4c19358e595dd75706a1bbe68fcbec0546 Mon Sep 17 00:00:00 2001 From: "Andrei.Kuznetsov" Date: Wed, 9 Jul 2025 11:39:18 +0200 Subject: [PATCH] IJPL-196089 Changes in `ModuleCustomImlDataEntity` should not implicitly trigger indexing Custom module options were deprecated a long time ago. If a plugin uses custom options which participate in indexing, then these options should be supplied via `com.intellij.filePropertyPusher` extensions GitOrigin-RevId: 39abd45f8acfb101ae9442323f7e906a21b15ffe --- ...omImlDataFilesIndexableEntityProvider.java | 77 ------------------- .../META-INF/ProjectModelLangExtensions.xml | 1 - 2 files changed, 78 deletions(-) delete mode 100644 platform/lang-impl/src/com/intellij/util/indexing/roots/ModuleCustomImlDataFilesIndexableEntityProvider.java diff --git a/platform/lang-impl/src/com/intellij/util/indexing/roots/ModuleCustomImlDataFilesIndexableEntityProvider.java b/platform/lang-impl/src/com/intellij/util/indexing/roots/ModuleCustomImlDataFilesIndexableEntityProvider.java deleted file mode 100644 index 97f25e4bca9a..000000000000 --- a/platform/lang-impl/src/com/intellij/util/indexing/roots/ModuleCustomImlDataFilesIndexableEntityProvider.java +++ /dev/null @@ -1,77 +0,0 @@ -// Copyright 2000-2023 JetBrains s.r.o. and contributors. Use of this source code is governed by the Apache 2.0 license. -package com.intellij.util.indexing.roots; - -import com.intellij.openapi.project.Project; -import com.intellij.platform.workspace.jps.entities.ModuleCustomImlDataEntity; -import com.intellij.platform.workspace.jps.entities.ModuleEntity; -import com.intellij.platform.workspace.jps.entities.ModuleExtensions; -import com.intellij.platform.workspace.storage.WorkspaceEntity; -import com.intellij.util.indexing.roots.builders.IndexableIteratorBuilders; -import org.jetbrains.annotations.ApiStatus; -import org.jetbrains.annotations.NotNull; -import org.jetbrains.annotations.Nullable; - -import java.util.*; - -@ApiStatus.Internal -public final class ModuleCustomImlDataFilesIndexableEntityProvider implements IndexableEntityProvider.Enforced { - - @Override - public @NotNull Class getEntityClass() { - return ModuleCustomImlDataEntity.class; - } - - @Override - public @NotNull Collection> getDependencies() { - return Collections.singletonList(DependencyOnParent.create( - ModuleEntity.class, ModuleCustomImlDataFilesIndexableEntityProvider::getReplacedParentEntityIteratorBuilder)); - } - - @Override - public @NotNull Collection getAddedEntityIteratorBuilders(@NotNull ModuleCustomImlDataEntity entity, - @NotNull Project project) { - return IndexableIteratorBuilders.INSTANCE.forModuleContent(entity.getModule().getSymbolicId()); - } - - @Override - public @NotNull Collection getRemovedEntityIteratorBuilders(@NotNull ModuleCustomImlDataEntity entity, - @NotNull Project project) { - return getAddedEntityIteratorBuilders(entity, project); - } - - @Override - public @NotNull Collection getReplacedEntityIteratorBuilders(@NotNull ModuleCustomImlDataEntity oldEntity, - @NotNull ModuleCustomImlDataEntity newEntity, - @NotNull Project project) { - if (shouldBeRescanned(oldEntity, newEntity)) { - return IndexableIteratorBuilders.INSTANCE.forModuleContent(newEntity.getModule().getSymbolicId()); - } - return Collections.emptyList(); - } - - private static boolean shouldBeRescanned(@Nullable ModuleCustomImlDataEntity oldData, @Nullable ModuleCustomImlDataEntity newData) { - if ((oldData == null) != (newData == null)) { - return true; - } - if (newData != null) { - if (!Objects.equals(newData.getRootManagerTagCustomData(), oldData.getRootManagerTagCustomData())) { - return true; - } - if (!Objects.equals(newData.getCustomModuleOptions(), oldData.getCustomModuleOptions())) { - return true; - } - } - return false; - } - - private static @NotNull Collection getReplacedParentEntityIteratorBuilder(@NotNull ModuleEntity oldEntity, - @NotNull ModuleEntity newEntity) { - if (shouldBeRescanned(ModuleExtensions.getCustomImlData(oldEntity), ModuleExtensions.getCustomImlData(newEntity))) { - List result = new ArrayList<>(); - result.addAll(IndexableIteratorBuilders.INSTANCE.forModuleContent(oldEntity.getSymbolicId())); - result.addAll(IndexableIteratorBuilders.INSTANCE.forModuleContent(newEntity.getSymbolicId())); - return result; - } - return Collections.emptyList(); - } -} diff --git a/platform/platform-resources/src/META-INF/ProjectModelLangExtensions.xml b/platform/platform-resources/src/META-INF/ProjectModelLangExtensions.xml index e932a75226ef..fd30f1d5718e 100644 --- a/platform/platform-resources/src/META-INF/ProjectModelLangExtensions.xml +++ b/platform/platform-resources/src/META-INF/ProjectModelLangExtensions.xml @@ -105,7 +105,6 @@ -