Is there a way to cast a Intention to QuickFix?

I’m new to developing plugins.

I’m developing a plugin to ignore RedundantTypeArguments when the called method is marked by a certain annotation, and ask for a explicit generic type marked.

There’s a InsertExplicitTypeArgumentsIntention from kotlin plugin, and I want to reuse the logic. Inside, it calls addTypeArguments but I don’t know what the context is.

Motivation JetBrains/java-annotations#139

Hi, unfortunately intentions are not meant to be called programmatically, they are UI elements.

In order to reuse any code from them, their logic should be extracted to a function/service.

You could extend com.intellij.codeInspection.IntentionAndQuickFixAction to provide a single implementation that serves both roles, or you use could use com.intellij.codeInspection.ex.QuickFixWrapper to wrap a LocalQuickFix as an IntentionAction. Of course, those are both just specific ways to do what Yuriy recommends, each taking advantage of a existing features of the plugin SDK.