From bd5b2fc3f1da06a3786baa50f0f1fa67c1a943d0 Mon Sep 17 00:00:00 2001 From: Yuriy Artamonov Date: Thu, 5 Dec 2024 12:53:06 +0100 Subject: [PATCH] [devkit] IJPL-163797 Highlight implementation-detail plugins as deprecated in plugin.xml GitOrigin-RevId: 5cb732c2f0d802e9b85840474b5d70ad16acae15 --- .../resources/messages/DevKitBundle.properties | 15 ++++++++------- .../devkit/devkit-core/src/dom/IdeaPlugin.java | 9 +++++++-- .../src/inspections/PluginXmlDomInspection.java | 17 +++++++++++------ .../ListenersNoPluginIdStandalone.xml | 4 ++-- .../ListenersUnresolvedTargetPlatform.xml | 4 ++-- .../testData/codeInsight/ValuesMaxLengths.xml | 4 ++-- .../codeInsight/ValuesRequiredOrInvalid.xml | 4 ++-- .../deprecatedImplementationDetail.xml | 6 ++++++ .../testData/codeInsight/pluginAttributes.xml | 2 +- .../lightServiceMustBeFinal/AbstractClass.java | 2 +- .../lightServiceMustBeFinal/Interface.java | 2 +- .../codeInsight/PluginXmlFunctionalTest.java | 4 ++++ .../lightServiceMustBeFinal/AbstractClass.kt | 2 +- .../lightServiceMustBeFinal/Interface.kt | 2 +- 14 files changed, 49 insertions(+), 28 deletions(-) create mode 100644 plugins/devkit/devkit-java-tests/testData/codeInsight/deprecatedImplementationDetail.xml diff --git a/plugins/devkit/devkit-core/resources/messages/DevKitBundle.properties b/plugins/devkit/devkit-core/resources/messages/DevKitBundle.properties index 96d47a527bac..a417366607c1 100644 --- a/plugins/devkit/devkit-core/resources/messages/DevKitBundle.properties +++ b/plugins/devkit/devkit-core/resources/messages/DevKitBundle.properties @@ -205,7 +205,8 @@ inspections.plugin.xml.do.not.use.template.text=Do not use template text ''{0}'' inspections.plugin.xml.must.not.contain.template.text=Must not contain template text ''{0}'' inspections.plugin.xml.value.exceeds.max.length=Value exceeds maximum length {0} inspections.plugin.xml.value.must.have.minimum.length=Value must have minimum length of {0} -inspections.plugin.xml.value.must.be.https.or.http.link.to.website=Must be valid link to website using https:// or http:// scheme +# suppress inspection "HttpUrlsUsage" +inspections.plugin.xml.value.must.be.https.or.http.link.to.website=Must be a valid link to the website using https:// or http:// scheme inspections.plugin.xml.product.descriptor.invalid.date=Date must be a YYYYMMDD integer, or a placeholder (e.g. __DATE__) inspections.plugin.xml.product.descriptor.invalid.version=Version must be an integer, or a placeholder (e.g. __VERSION__) inspections.plugin.xml.no.plugin.icon.svg.file=Plugin should provide ''{0}'' (Documentation) @@ -217,9 +218,9 @@ inspections.plugin.xml.ComponentModuleRegistrationChecker.fix.move.registration. inspections.plugin.xml.ComponentModuleRegistrationChecker.fix.move.registration.family.name=Move registration to correct module inspections.plugin.xml.fix.extension.point.add.with.tag=Add tag inspections.plugin.xml.listener.does.not.inherit=''{0}'' does not inherit from ''{1}'' -inspections.plugin.xml.since.build.could.not.locate.main.descriptor=Could not locate main plugin.xml file to determine required 'since-build' +inspections.plugin.xml.since.build.could.not.locate.main.descriptor=Could not locate the main plugin.xml file to determine required 'since-build' inspections.plugin.xml.since.build.must.be.specified=Must specify 'since-build' -inspections.plugin.xml.since.build.could.not.determine.platform.version=Could not determine target platform version, please check project setup +inspections.plugin.xml.since.build.could.not.determine.platform.version=Could not determine a target platform version, please check project setup inspections.plugin.xml.since.build.listeners.os.attribute=Attribute ''os'' available in platform version {0} or later only, but specified ''since-build'' platform is ''{1}'' inspections.plugin.xml.since.build.listeners.not.available=Feature available in platform version {0} or later only, but specified ''since-build'' platform is ''{1}'' inspections.plugin.xml.action.group.id.required='id' should be specified @@ -233,6 +234,7 @@ inspections.plugin.xml.vendor.specify.jetbrains=Specify JetBrains as vendor inspections.plugin.xml.change.until.build.name=Change ''until-build'' to ''{0}'' inspections.plugin.xml.change.until.build.family.name=Correct 'until-build' attribute inspections.plugin.xml.deprecated=Deprecated +inspections.plugin.xml.deprecated.implementation.detail=Implementation plugins are no longer supported: use either a regular plugin or implement a product module inspections.plugin.xml.add.version.tag=Add inspections.plugin.xml.add.vendor.tag=Add inspections.plugin.xml.module.descriptor.at.least.one.dependency=At least one entry must be defined @@ -289,7 +291,6 @@ inspections.psi.element.concat.psi.type=Suspicious conversion of PsiType to stri inspections.psi.element.concat.add.get.text.family.name=Call text representation retrieval method inspections.psi.element.concat.add.get.text.name=Use ''{0}'' call - inspections.plugin.xml.dynamic.plugin.component.usage=Non-dynamic plugin due to using components. inspections.plugin.xml.dynamic.plugin.component.usage.docs.link.title=Migration Guide inspections.plugin.xml.dynamic.plugin.option.highlight.usages.ep=Highlight usage of non-dynamic extension points @@ -297,7 +298,6 @@ inspections.plugin.xml.dynamic.plugin.extension.point=Non-dynamic extension poin inspections.plugin.xml.dynamic.plugin.explicit.non.dynamic.extension.point=Explicit non-dynamic extension point ''{0}'' inspections.plugin.xml.dynamic.plugin.id.required.for.group='id' must be specified for inspections.plugin.xml.dynamic.plugin.usage.of.non.dynamic.extension.point=Usage of non-dynamic extension point ''{0}'' -inspections.plugin.xml.dynamic.plugin.analyze.extension.point={0} for ''{1}'' inspections.stateful.extension.point.leak.psi.element=Potential memory leak: don't hold PsiElement, use SmartPsiElementPointer instead inspections.stateful.extension.point.leak.psi.element.quick.fix=See also LocalQuickFixOnPsiElement. @@ -600,7 +600,7 @@ inspection.light.service.must.be.concrete.class.message=\ Light service must be a concrete class and cannot be abstract or an interface.\n\ The IntelliJ Platform relies on the concrete implementation class to create and \ manage the service instance. Without a concrete implementation, the platform \ - would not be able to create an instance of the service, and the service would \ + would not be able to create an instance of the service. The service would \ not be available for use by the plugin.\n\ To solve this problem, you should define a concrete implementation class for the \ service and annotate it with '@Service'. @@ -679,6 +679,7 @@ inspections.meta.information.unknown.inspection.id=Unknown inspection id ''{0}'' inspections.meta.information.json.schema.display.name=IntelliJ Inspections Metainformation inlay.threading.name=IJ Platform threading +# suppress inspection "GrazieInspection" inlay.threading.description=IntelliJ Platform threading and read/write lock related annotations, e.g., @RequiresEdt, @RequiresReadLock.

Experimental, enabled in IDEA project only. inspections.static.initialization.in.extensions.name=Static initialization in extension point implementations @@ -709,7 +710,7 @@ inspections.jcomponent.data.provider.display.name=JComponent must use UiDataProv inspections.jcomponent.data.provider.use.uidataprovider.instead.of.dataprovider=Use UiDataProvider instead of DataProvider inspection.can.be.dumb.aware.name=Can be DumbAware -inspection.can.be.dumb.aware.settings.ignore.classes.title=Ignore class list: +inspection.can.be.dumb.aware.settings.ignore.classes.title=Ignore classes list: inspection.can.be.dumb.aware.settings.ignore.classes.dialog.title=Specify Class to Ignore inspection.can.be.dumb.aware.message=Can be made DumbAware if it does not access indexes inspection.can.be.dumb.aware.quickfix.add.to.ignore=Ignore ''{0}'' diff --git a/plugins/devkit/devkit-core/src/dom/IdeaPlugin.java b/plugins/devkit/devkit-core/src/dom/IdeaPlugin.java index ff3e4d42273d..f17731936865 100644 --- a/plugins/devkit/devkit-core/src/dom/IdeaPlugin.java +++ b/plugins/devkit/devkit-core/src/dom/IdeaPlugin.java @@ -6,7 +6,6 @@ import com.intellij.ide.presentation.Presentation; import com.intellij.openapi.util.NlsSafe; import com.intellij.psi.PsiPackage; import com.intellij.util.xml.*; -import org.jetbrains.annotations.ApiStatus; import org.jetbrains.annotations.NonNls; import org.jetbrains.annotations.NotNull; import org.jetbrains.annotations.Nullable; @@ -67,7 +66,12 @@ public interface IdeaPlugin extends DomElement { @NotNull GenericAttributeValue getAllowBundledUpdate(); + /** + * @deprecated Will be dropped without a replacement: use either a regular plugin or implement a product module. + */ + @SuppressWarnings("DeprecatedIsStillUsed") @Stubbed + @Deprecated @NotNull GenericAttributeValue getImplementationDetail(); @NotNull GenericAttributeValue getRequireRestart(); @@ -157,8 +161,9 @@ public interface IdeaPlugin extends DomElement { @NotNull List getProjectListeners(); /** - * @deprecated the corresponding tag in plugin.xml is not supported anymore, this method is used to highlight occurrences of such tag + * @deprecated the corresponding tag in plugin.xml is not supported anymore, this method is used to highlight occurrences of such a tag */ + @SuppressWarnings("SpellCheckingInspection") @Deprecated @NotNull List getHelpsets(); } diff --git a/plugins/devkit/devkit-core/src/inspections/PluginXmlDomInspection.java b/plugins/devkit/devkit-core/src/inspections/PluginXmlDomInspection.java index 992dfd61747c..95655424c226 100644 --- a/plugins/devkit/devkit-core/src/inspections/PluginXmlDomInspection.java +++ b/plugins/devkit/devkit-core/src/inspections/PluginXmlDomInspection.java @@ -327,8 +327,14 @@ public final class PluginXmlDomInspection extends DevKitPluginXmlInspectionBase //noinspection deprecation if (DomUtil.hasXml(ideaPlugin.getUseIdeaClassloader())) { //noinspection deprecation - highlightDeprecated(ideaPlugin.getUseIdeaClassloader(), DevKitBundle.message("inspections.plugin.xml.deprecated"), holder, true, - true); + highlightDeprecated(ideaPlugin.getUseIdeaClassloader(), DevKitBundle.message("inspections.plugin.xml.deprecated"), holder, true, true); + } + + //noinspection deprecation + if (DomUtil.hasXml(ideaPlugin.getImplementationDetail())) { + //noinspection deprecation + highlightDeprecated(ideaPlugin.getImplementationDetail(), DevKitBundle.message("inspections.plugin.xml.deprecated.implementation.detail"), + holder, true, true); } checkMaxLength(ideaPlugin.getUrl(), 255, holder); @@ -545,7 +551,7 @@ public final class PluginXmlDomInspection extends DevKitPluginXmlInspectionBase } @NonNls String name = nameAttrValue.getValue(); - // skip some known offenders in IJ project + // skip some known offenders in the IJ project if (name != null && (StringUtil.startsWith(name, "Pythonid.") || StringUtil.startsWith(name, "DevKit.") || @@ -569,9 +575,9 @@ public final class PluginXmlDomInspection extends DevKitPluginXmlInspectionBase } String epName = fragments.get(fragments.size() - 1); - List butlast = fragments.subList(0, fragments.size() - 1); + List butLast = fragments.subList(0, fragments.size() - 1); List words = StringUtil.getWordsIn(epName); - return !ContainerUtil.exists(words, w -> ContainerUtil.exists(butlast, f -> StringUtil.equalsIgnoreCase(w, f))); + return !ContainerUtil.exists(words, w -> ContainerUtil.exists(butLast, f -> StringUtil.equalsIgnoreCase(w, f))); } private static void annotateExtensions(Extensions extensions, DomElementAnnotationHolder holder) { @@ -617,7 +623,6 @@ public final class PluginXmlDomInspection extends DevKitPluginXmlInspectionBase return; } - final IdeaPlugin ideaPlugin = extensionPoint.getParentOfType(IdeaPlugin.class, true); assert ideaPlugin != null; String dependencyId = ideaPlugin.getPluginId(); diff --git a/plugins/devkit/devkit-java-tests/testData/codeInsight/ListenersNoPluginIdStandalone.xml b/plugins/devkit/devkit-java-tests/testData/codeInsight/ListenersNoPluginIdStandalone.xml index 33e61bdbbd72..a2542f8e4bf8 100644 --- a/plugins/devkit/devkit-java-tests/testData/codeInsight/ListenersNoPluginIdStandalone.xml +++ b/plugins/devkit/devkit-java-tests/testData/codeInsight/ListenersNoPluginIdStandalone.xml @@ -1,11 +1,11 @@ - + - + diff --git a/plugins/devkit/devkit-java-tests/testData/codeInsight/ListenersUnresolvedTargetPlatform.xml b/plugins/devkit/devkit-java-tests/testData/codeInsight/ListenersUnresolvedTargetPlatform.xml index 3106d3356d55..79a844f9594c 100644 --- a/plugins/devkit/devkit-java-tests/testData/codeInsight/ListenersUnresolvedTargetPlatform.xml +++ b/plugins/devkit/devkit-java-tests/testData/codeInsight/ListenersUnresolvedTargetPlatform.xml @@ -3,12 +3,12 @@ JetBrains 1.0 - + - + \ No newline at end of file diff --git a/plugins/devkit/devkit-java-tests/testData/codeInsight/ValuesMaxLengths.xml b/plugins/devkit/devkit-java-tests/testData/codeInsight/ValuesMaxLengths.xml index c7304295e131..ebdd0b6140ff 100644 --- a/plugins/devkit/devkit-java-tests/testData/codeInsight/ValuesMaxLengths.xml +++ b/plugins/devkit/devkit-java-tests/testData/codeInsight/ValuesMaxLengths.xml @@ -1,12 +1,12 @@ 0123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890123456789012345"> + url="0123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890123456789012345"> 0123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890123456789012345 0123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890123456789012345 0123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890123456789012345" + url="0123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890123456789012345" email="0123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890123456789012345" >0123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890123456789012345 diff --git a/plugins/devkit/devkit-java-tests/testData/codeInsight/ValuesRequiredOrInvalid.xml b/plugins/devkit/devkit-java-tests/testData/codeInsight/ValuesRequiredOrInvalid.xml index 28395cb584e1..b3ccaabfc7d1 100644 --- a/plugins/devkit/devkit-java-tests/testData/codeInsight/ValuesRequiredOrInvalid.xml +++ b/plugins/devkit/devkit-java-tests/testData/codeInsight/ValuesRequiredOrInvalid.xml @@ -1,6 +1,6 @@ -mywebsite.com"> +mywebsite.com"> test - mywebsite.com">JetBrains + mywebsite.com">JetBrains 1.0 <name> diff --git a/plugins/devkit/devkit-java-tests/testData/codeInsight/deprecatedImplementationDetail.xml b/plugins/devkit/devkit-java-tests/testData/codeInsight/deprecatedImplementationDetail.xml new file mode 100644 index 000000000000..acf737cbfa3a --- /dev/null +++ b/plugins/devkit/devkit-java-tests/testData/codeInsight/deprecatedImplementationDetail.xml @@ -0,0 +1,6 @@ +implementation-detail="true"> + com.intellij.myPlugin + JetBrains + 1.0 + + \ No newline at end of file diff --git a/plugins/devkit/devkit-java-tests/testData/codeInsight/pluginAttributes.xml b/plugins/devkit/devkit-java-tests/testData/codeInsight/pluginAttributes.xml index acee7a4ba370..b1dfaee76a4c 100644 --- a/plugins/devkit/devkit-java-tests/testData/codeInsight/pluginAttributes.xml +++ b/plugins/devkit/devkit-java-tests/testData/codeInsight/pluginAttributes.xml @@ -1,5 +1,5 @@ implementation-detail="false" allow-bundled-update="false" require-restart="false" url="https://www.jetbrains.com"> diff --git a/plugins/devkit/devkit-java-tests/testData/inspections/lightServiceMustBeFinal/AbstractClass.java b/plugins/devkit/devkit-java-tests/testData/inspections/lightServiceMustBeFinal/AbstractClass.java index de9387526194..4ad0a42587ad 100644 --- a/plugins/devkit/devkit-java-tests/testData/inspections/lightServiceMustBeFinal/AbstractClass.java +++ b/plugins/devkit/devkit-java-tests/testData/inspections/lightServiceMustBeFinal/AbstractClass.java @@ -1,7 +1,7 @@ import com.intellij.openapi.components.Service; @Service abstract class MyService { } diff --git a/plugins/devkit/devkit-java-tests/testData/inspections/lightServiceMustBeFinal/Interface.java b/plugins/devkit/devkit-java-tests/testData/inspections/lightServiceMustBeFinal/Interface.java index 4a732af6dc31..4e52ad4bcefa 100644 --- a/plugins/devkit/devkit-java-tests/testData/inspections/lightServiceMustBeFinal/Interface.java +++ b/plugins/devkit/devkit-java-tests/testData/inspections/lightServiceMustBeFinal/Interface.java @@ -1,7 +1,7 @@ import com.intellij.openapi.components.Service; @Service interface MyService { } diff --git a/plugins/devkit/devkit-java-tests/testSrc/org/jetbrains/idea/devkit/codeInsight/PluginXmlFunctionalTest.java b/plugins/devkit/devkit-java-tests/testSrc/org/jetbrains/idea/devkit/codeInsight/PluginXmlFunctionalTest.java index bc57835dab0b..7dc3d2d9fb45 100644 --- a/plugins/devkit/devkit-java-tests/testSrc/org/jetbrains/idea/devkit/codeInsight/PluginXmlFunctionalTest.java +++ b/plugins/devkit/devkit-java-tests/testSrc/org/jetbrains/idea/devkit/codeInsight/PluginXmlFunctionalTest.java @@ -809,6 +809,10 @@ public class PluginXmlFunctionalTest extends JavaCodeInsightFixtureTestCase { doHighlightingTest("redundantComponentInterfaceClass.xml"); } + public void testDeprecatedImplementationDetailAttribute() { + doHighlightingTest("deprecatedImplementationDetail.xml"); + } + private void doHighlightingTest(String... filePaths) { myFixture.testHighlighting(true, false, false, filePaths); } diff --git a/plugins/devkit/devkit-kotlin-tests/testData/inspections/lightServiceMustBeFinal/AbstractClass.kt b/plugins/devkit/devkit-kotlin-tests/testData/inspections/lightServiceMustBeFinal/AbstractClass.kt index 1307edbb4c77..aaca2ca4fb9a 100644 --- a/plugins/devkit/devkit-kotlin-tests/testData/inspections/lightServiceMustBeFinal/AbstractClass.kt +++ b/plugins/devkit/devkit-kotlin-tests/testData/inspections/lightServiceMustBeFinal/AbstractClass.kt @@ -1,6 +1,6 @@ import com.intellij.openapi.components.Service @Service abstract class MyService \ No newline at end of file diff --git a/plugins/devkit/devkit-kotlin-tests/testData/inspections/lightServiceMustBeFinal/Interface.kt b/plugins/devkit/devkit-kotlin-tests/testData/inspections/lightServiceMustBeFinal/Interface.kt index 78189a252ddf..4bfe5c109820 100644 --- a/plugins/devkit/devkit-kotlin-tests/testData/inspections/lightServiceMustBeFinal/Interface.kt +++ b/plugins/devkit/devkit-kotlin-tests/testData/inspections/lightServiceMustBeFinal/Interface.kt @@ -1,6 +1,6 @@ import com.intellij.openapi.components.Service @Service interface MyService \ No newline at end of file