I have the following API:
Object getThing(String s)
Depending on the value of the argument, the return type will be a String or Integer etc. The problem is in usage, you need to work out what the actual return type would be, and cast the return value.
I am trying to make my idea plugin inject the correct return type based on the parameter.
I have a com.intellij.psi.injection.ReferenceInjector. In the reference I inject, I implement bindToElement like this, to make it appear to return a String:
Is this the right way to handle this scenario? (Clearly it's not, so any suggestions appreciated).