Can I override the target of a ELVariable ?

Hi,
I'm working on a JSP EL expression extensions which should add a more specific type to certain variables.

For example, the JSP EL expression myContext.component is resolved to the accessor method "Object MyContext.getComponent()" .

In the context of the JSP file I know more about the type of the returned type of getComponent.

I would like to patch the PSI to make myContext.component resolve to a synthetic method which has e.g. String as return type.
i.e. instead of resolving to the physical "Object MyContext.getComponent()"  I would like the expression in this JSP file to resolve to a virtual method "String MyContext.getComponent()"

Is there a way to achieve this?

I've tried to use an annotator and calling elVar.getReference().bindToElement() with a PsiMethod implementing the SyntheticElement marker interface. But this does not seem to affect the PSI tree.

I'm very thankful for any hints you may have,
Wallaby

Please sign in to leave a comment.