diff --git a/platform/core-impl/src/com/intellij/ide/plugins/IdeaPluginDescriptorImpl.kt b/platform/core-impl/src/com/intellij/ide/plugins/IdeaPluginDescriptorImpl.kt index 043c96313dba..2436663be77d 100644 --- a/platform/core-impl/src/com/intellij/ide/plugins/IdeaPluginDescriptorImpl.kt +++ b/platform/core-impl/src/com/intellij/ide/plugins/IdeaPluginDescriptorImpl.kt @@ -1,5 +1,5 @@ // Copyright 2000-2021 JetBrains s.r.o. and contributors. Use of this source code is governed by the Apache 2.0 license that can be found in the LICENSE file. -@file:Suppress("ReplaceGetOrSet") +@file:Suppress("ReplaceGetOrSet", "ReplaceNegatedIsEmptyWithIsNotEmpty") package com.intellij.ide.plugins import com.intellij.AbstractBundle @@ -94,7 +94,7 @@ class IdeaPluginDescriptorImpl(raw: RawPluginDescriptor, @JvmField val projectContainerDescriptor = raw.projectContainerDescriptor @JvmField val moduleContainerDescriptor = raw.moduleContainerDescriptor - @JvmField val content = raw.content + @JvmField val content: PluginContentDescriptor = raw.contentModules?.let { PluginContentDescriptor(it) } ?: PluginContentDescriptor.EMPTY @JvmField val dependencies = raw.dependencies @JvmField val modules: List = raw.modules ?: Collections.emptyList() diff --git a/platform/core-impl/src/com/intellij/ide/plugins/RawPluginDescriptor.kt b/platform/core-impl/src/com/intellij/ide/plugins/RawPluginDescriptor.kt index e98d72c1a16b..0685c77c412d 100644 --- a/platform/core-impl/src/com/intellij/ide/plugins/RawPluginDescriptor.kt +++ b/platform/core-impl/src/com/intellij/ide/plugins/RawPluginDescriptor.kt @@ -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-2021 JetBrains s.r.o. and contributors. Use of this source code is governed by the Apache 2.0 license that can be found in the LICENSE file. package com.intellij.ide.plugins import com.intellij.openapi.extensions.ExtensionDescriptor @@ -52,7 +52,7 @@ class RawPluginDescriptor { @JvmField var epNameToExtensions: MutableMap>? = null - @JvmField internal var content = PluginContentDescriptor.EMPTY + @JvmField internal var contentModules: MutableList? = null @JvmField internal var dependencies = ModuleDependenciesDescriptor.EMPTY class ActionDescriptor( diff --git a/platform/core-impl/src/com/intellij/ide/plugins/XmlReader.kt b/platform/core-impl/src/com/intellij/ide/plugins/XmlReader.kt index db45489c2b41..2ad3904ee97f 100644 --- a/platform/core-impl/src/com/intellij/ide/plugins/XmlReader.kt +++ b/platform/core-impl/src/com/intellij/ide/plugins/XmlReader.kt @@ -1,6 +1,6 @@ // Copyright 2000-2021 JetBrains s.r.o. and contributors. Use of this source code is governed by the Apache 2.0 license that can be found in the LICENSE file. @file:JvmName("XmlReader") -@file:Suppress("ReplaceNegatedIsEmptyWithIsNotEmpty") +@file:Suppress("ReplaceNegatedIsEmptyWithIsNotEmpty", "ReplacePutWithAssignment", "ReplaceGetOrSet") package com.intellij.ide.plugins import com.intellij.openapi.components.ComponentConfig @@ -14,7 +14,6 @@ import com.intellij.openapi.util.createNonCoalescingXmlStreamReader import com.intellij.platform.util.plugins.DataLoader import com.intellij.util.NoOpXmlInterner import com.intellij.util.XmlInterner -import com.intellij.util.lang.Java11Shim import com.intellij.util.lang.ZipFilePool import com.intellij.util.messages.ListenerDescriptor import com.intellij.util.readXmlAsModel @@ -667,7 +666,12 @@ private fun readComponents(reader: XMLStreamReader2, containerDescriptor: Contai private fun readContent(reader: XMLStreamReader2, descriptor: RawPluginDescriptor, readContext: ReadModuleContext) { - val items = ArrayList() + var items = descriptor.contentModules + if (items == null) { + items = ArrayList() + descriptor.contentModules = items + } + reader.consumeChildElements { elementName -> when (elementName) { "module" -> { @@ -694,7 +698,6 @@ private fun readContent(reader: XMLStreamReader2, } reader.skipElement() } - descriptor.content = PluginContentDescriptor(Java11Shim.INSTANCE.copyOfCollection(items)) assert(reader.isEndElement) }