How can you add a PsiJavaCodeReferenceElement to a PsiReferenceList

The PsiElementFactory factory methods returns only PsiJavaCodeReferenceElement. PsiReferenceList does not have anything special to add reference except its super class PsiElement addXXX() methods that takes a PsiElement in parameter. Unfortunately PsiJavaCodeReferenceElement does not descend from PsiElement even though its name might indicate that.

So how do I add a reference to a PsiReferenceList now?


Jacques

PS:
Sorry if I should not have asked PSI questions in this forum. I am somewhat confused where we left off this issue.

1 comment
Comment actions Permalink

Jacques Morel wrote:

The PsiElementFactory factory methods returns only
PsiJavaCodeReferenceElement. PsiReferenceList does not have anything
special to add reference except its super class PsiElement addXXX()
methods that takes a PsiElement in parameter. Unfortunately
PsiJavaCodeReferenceElement does not descend from PsiElement even though
its name might indicate that.

So how do I add a reference to a PsiReferenceList now?


PsiJavaCodeReferenceElement does descend from PsiElement, so you just say
addXXX() and it gets added (it takes care of commas and stuff too).

Friendly,
Dmitry

--
Dmitry Lomov
IntelliJ Labs / JetBrains Inc.
http://www.intellij.com
"Develop with pleasure!"

0

Please sign in to leave a comment.