[devkit] don't allow 'loading' attribute in 'module' tag in 'dependencies' tag (IJPL-179126)

It was never supposed to be used, but it was shown in completion because DependencyDescriptor reused ModuleDescriptor interface from ContentDescriptor.


(cherry picked from commit ea13f263a6a197832c994d7e88e093d48ce2448c)

IJ-CR-156218

GitOrigin-RevId: 4db251089fd421e0d4dff7d59ebb9ac2efd4d017
This commit is contained in:
Nikolay Chashnikov
2025-02-26 16:11:09 +01:00
committed by intellij-monorepo-bot
parent 127f364c0b
commit c995da7fee
5 changed files with 19 additions and 4 deletions

View File

@@ -5,6 +5,7 @@ import com.intellij.ide.presentation.Presentation;
import com.intellij.util.xml.*; import com.intellij.util.xml.*;
import org.jetbrains.annotations.NotNull; import org.jetbrains.annotations.NotNull;
import org.jetbrains.idea.devkit.dom.impl.IdeaPluginConverter; import org.jetbrains.idea.devkit.dom.impl.IdeaPluginConverter;
import org.jetbrains.idea.devkit.dom.impl.ModuleDescriptorNameConverter;
import java.util.List; import java.util.List;
@@ -14,10 +15,10 @@ public interface DependencyDescriptor extends DomElement {
@NotNull @NotNull
@Stubbed @Stubbed
@SubTagList("module") @SubTagList("module")
List<ContentDescriptor.ModuleDescriptor> getModuleEntry(); List<ModuleDescriptor> getModuleEntry();
@SubTagList("module") @SubTagList("module")
ContentDescriptor.ModuleDescriptor addModuleEntry(); ModuleDescriptor addModuleEntry();
@NotNull @NotNull
@Stubbed @Stubbed
@@ -37,4 +38,14 @@ public interface DependencyDescriptor extends DomElement {
@NameValue(referencable = false) @NameValue(referencable = false)
GenericAttributeValue<IdeaPlugin> getId(); GenericAttributeValue<IdeaPlugin> getId();
} }
@Presentation(icon = "AllIcons.Nodes.Module")
interface ModuleDescriptor extends DomElement {
@NotNull
@Required
@Stubbed
@NameValue(referencable = false)
@Convert(ModuleDescriptorNameConverter.class)
GenericAttributeValue<IdeaPlugin> getName();
}
} }

View File

@@ -77,7 +77,7 @@ public final class PluginIdDependenciesIndex extends PluginXmlIndexBase<String,
for (DependencyDescriptor.PluginDescriptor pluginDescriptor : dependencyDescriptor.getPlugin()) { for (DependencyDescriptor.PluginDescriptor pluginDescriptor : dependencyDescriptor.getPlugin()) {
ContainerUtil.addIfNotNull(ids, pluginDescriptor.getId().getStringValue()); ContainerUtil.addIfNotNull(ids, pluginDescriptor.getId().getStringValue());
} }
for (ContentDescriptor.ModuleDescriptor moduleDescriptor : dependencyDescriptor.getModuleEntry()) { for (DependencyDescriptor.ModuleDescriptor moduleDescriptor : dependencyDescriptor.getModuleEntry()) {
ContainerUtil.addIfNotNull(ids, moduleDescriptor.getName().getStringValue()); ContainerUtil.addIfNotNull(ids, moduleDescriptor.getName().getStringValue());
} }

View File

@@ -7,8 +7,9 @@
<module name="anotherModule"/> <module name="anotherModule"/>
<module name="anotherModule/secondary-descriptor"/> <module name="anotherModule/secondary-descriptor"/>
<module name="<error descr="Cannot resolve module descriptor 'invalid.module.xml' in source roots of module 'invalid.module'">invalid.module</error>"/> <module name="<error descr="Cannot resolve module descriptor 'invalid.module.xml' in source roots of module 'invalid.module'">invalid.module</error>"/>
<module name="anotherModule/secondary-descriptor2" <error descr="Attribute loading is not allowed here">loading</error>="required"/>
<plugin id="anotherModule.plugin.id"/> <plugin id="anotherModule.plugin.id"/>
<plugin id="<error descr="Cannot resolve plugin 'invalid.plugin.id' in dependencies (Reference: Plugin Dependencies)">invalid.plugin.id</error>"/> <plugin id="<error descr="Cannot resolve plugin 'invalid.plugin.id' in dependencies (Reference: Plugin Dependencies)">invalid.plugin.id</error>"/>
</dependencies> </dependencies>