mirror of
https://gitflic.ru/project/openide/openide.git
synced 2026-04-19 21:11:28 +07:00
devkit: highlight usages of the internal exception reporter as errors
(IDEA-189743)
This commit is contained in:
@@ -146,6 +146,7 @@ inspections.plugin.xml.until.build.use.asterisk.instead.of.big.number=Don''t use
|
||||
inspections.plugin.xml.until.build.misleading.plain.number=Plain numbers in ''until-build'' attribute may be misleading. ''{0}'' means the same as ''{0}.0'', so the plugin won''t be compatible with {0}.* builds. It''s better to specify ''{1}'' instead.
|
||||
inspections.plugin.xml.deprecated.ep=Deprecated EP ''{0}''
|
||||
inspections.plugin.xml.no.need.to.specify.itnReporter=Exceptions from plugins developed by JetBrains are reported via ITNReporter automatically, there is no need to specify it explicitly
|
||||
inspections.plugin.xml.third.party.plugins.must.not.use.itnReporter='com.intellij.diagnostic.ITNReporter' reports errors for internal processing at JetBrains, it should not be used for third-party plugins
|
||||
inspections.plugin.xml.deprecated.attribute=Deprecated attribute ''{0}''
|
||||
inspections.plugin.xml.attribute.not.used.anymore=Attribute ''{0}'' not used anymore
|
||||
inspections.plugin.xml.anchor.must.have.relative-to-action='anchor' must be specified with 'relative-to-action'
|
||||
|
||||
@@ -289,12 +289,17 @@ public class PluginXmlDomInspection extends BasicDomElementsInspection<IdeaPlugi
|
||||
IdeaPlugin plugin = extension.getParentOfType(IdeaPlugin.class, true);
|
||||
if (plugin != null) {
|
||||
Vendor vendor = plugin.getVendor();
|
||||
LocalQuickFix fix = new RemoveDomElementQuickFix(extension);
|
||||
if (DomUtil.hasXml(vendor) && PluginManagerMain.isDevelopedByJetBrains(vendor.getValue())) {
|
||||
LocalQuickFix fix = new RemoveDomElementQuickFix(extension);
|
||||
holder.createProblem(extension, ProblemHighlightType.LIKE_UNUSED_SYMBOL,
|
||||
DevKitBundle.message("inspections.plugin.xml.no.need.to.specify.itnReporter"),
|
||||
null, fix).highlightWholeElement();
|
||||
}
|
||||
else {
|
||||
holder.createProblem(extension, ProblemHighlightType.GENERIC_ERROR_OR_WARNING,
|
||||
DevKitBundle.message("inspections.plugin.xml.third.party.plugins.must.not.use.itnReporter"),
|
||||
null, fix).highlightWholeElement();
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@@ -0,0 +1,12 @@
|
||||
<idea-plugin>
|
||||
<id>com.intellij</id>
|
||||
<vendor>Example, Inc</vendor>
|
||||
<extensionPoints>
|
||||
<extensionPoint name="errorHandler"
|
||||
interface="com.intellij.openapi.diagnostic.ErrorReportSubmitter"/>
|
||||
</extensionPoints>
|
||||
<extensions defaultExtensionNs="com.intellij">
|
||||
<error descr="'com.intellij.diagnostic.ITNReporter' reports errors for internal processing at JetBrains, it should not be used for third-party plugins"><errorHandler implementation="com.intellij.diagnostic.ITNReporter"/></error>
|
||||
<errorHandler implementation="MyErrorHandler"/>
|
||||
</extensions>
|
||||
</idea-plugin>
|
||||
@@ -12,7 +12,6 @@ import com.intellij.codeInspection.xml.DeprecatedClassUsageInspection
|
||||
import com.intellij.diagnostic.ITNReporter
|
||||
import com.intellij.lang.LanguageExtensionPoint
|
||||
import com.intellij.openapi.application.ApplicationManager
|
||||
import com.intellij.openapi.application.PluginPathManager
|
||||
import com.intellij.openapi.extensions.LoadingOrder
|
||||
import com.intellij.psi.ElementDescriptionUtil
|
||||
import com.intellij.psi.PsiElement
|
||||
@@ -422,6 +421,14 @@ public class MyErrorHandler extends ErrorReportSubmitter {}
|
||||
myFixture.testHighlighting("errorHandlerExtensionInJetBrainsPlugin.xml")
|
||||
}
|
||||
|
||||
void testErrorHandlerExtensionInNonJetBrainsPlugin() {
|
||||
myFixture.addClass("""
|
||||
import com.intellij.openapi.diagnostic.ErrorReportSubmitter;
|
||||
public class MyErrorHandler extends ErrorReportSubmitter {}
|
||||
""")
|
||||
myFixture.testHighlighting("errorHandlerExtensionInNonJetBrainsPlugin.xml")
|
||||
}
|
||||
|
||||
void testExtensionPointPresentation() {
|
||||
myFixture.configureByFile(getTestName(true) + ".xml")
|
||||
final PsiElement element =
|
||||
|
||||
Reference in New Issue
Block a user