Is there an "IntelliJ IDEA" way of making a plugin that is compatible with multiple versions while using newer features not all versions support?
I'm modifying a plugin that is compatible with 8.x. I want to keep the compatibility.
But I want to use the DumbAware interface for an Action which was introduced with 9.x.
Also I use DataManager.getInstance().getDataContext() which is deprecated since 9.x and should be replaced by a call to DataManager.getInstance().getDataContextFromFocus().getResult() which is not available in 8.x.
For the getDataContext() call I could either live with the deprecated call and hope for the method staying in place, or I could make a distinction about which method to use according to ApplicationInfo.
But for the Action I don't really see a way except just not implementing DumbAware and living with it.
Are really the above the only ways for this or is there a better way?
If you now want to suggest to release multiple versions with differing since-build and until-build, this is of course possible, but much more maintenance work than releasing just a single version, so I'd prefer to have one version if possible.