Add virtual `extends` clause during IFileElementType#parseConents()?

I have subclasses of JavaParserDefinition, IFileElementType, etc. and all is working fine.  I want all the psi classes in the context of this custom Java file type to implicitly extend another class, so in my implementation of IFileElementType#parseContents() I'd like to inject a light extends clause into the classes, if possible.  For instance, I'd like to change this class:

class Foo {


to behave like this:

class Foo extends {


Is this possible?  I've been experimenting with manually inserting CompositeElements and rolling my own "light" PsiJavaCodeReferenceElementImpl etc. to no avail.


1 comment

Sorry for the late reply.

There is no way to directly "inject" a reference into an existing PsiClass implementation, but you still can fiddle with element finders.


Please sign in to leave a comment.