Deprecation warning with ActionUpdateThread

Answered

Recently users of the plugin that I am maintaining get warnings like below (https://github.com/nbadal/ktlint-intellij-plugin/issues/509):

com.intellij.diagnostic.PluginException: ActionUpdateThread.OLD_EDT is deprecated and going to be removed soon. 'com.nbadal.ktlint.actions.LintAction' must override getActionUpdateThread and chose EDT or BGT. See ActionUpdateThread javadoc. [Plugin: com.nbadal.ktlint]
at com.intellij.diagnostic.PluginProblemReporterImpl.createPluginExceptionByClass(PluginProblemReporterImpl.java:23)
at com.intellij.diagnostic.PluginException.createByClass(PluginException.java:90)
at com.intellij.diagnostic.PluginException.reportDeprecatedUsage(PluginException.java:125)
at com.intellij.openapi.actionSystem.ActionUpdateThreadAware.getActionUpdateThread(ActionUpdateThreadAware.java:21)
at com.intellij.openapi.actionSystem.AnAction.getActionUpdateThread(AnAction.java:199)

I found that I can resolve this by overriding the getActionUpdateThread method like below:

@Override
 public @NotNull ActionUpdateThread getActionUpdateThread() {
 return ActionUpdateThread.BGT;
 }

 

But method above is only available for plugins compatible with platform versions 2022.3+. If possible I would like to keep the plugin compatible with the platform version (2021.3) that currently is supported. However with that version the method above can not be overridden. Do you have any suggestion / example how this can be implemented?

0
2 comments

Hi Paul,

If you want to keep your plugin compatible with 2021.3, you will need to release separate plugin versions compatible with older and newer IDE versions.

You can also consider dropping support for older versions, based on this data: https://plugins.jetbrains.com/docs/marketplace/product-versions-in-use-statistics.html

Supporting 2022.3+ means supporting five last major versions (2022.3, 2023.1, 2023.2, 2023.3, 2024.1), which should cover about 95% of the users.

0

Tnx for confirming that I have to release separate plugin versions if I want to keep on supporting the older versions. That is probably not worth the time and effort considering the usage statistics that you refer to.

0

Please sign in to leave a comment.