How to access source code of classes attached as library using PSI
I have project with jar files attached as libraries. Source code of classes attached to libraries too.
I wrote visitor what parses source code of class. It works fine for classes from my project but ignores source code of classes from library files.
psiMethos.getText() for library classes returns something like
public void foo() { /* compiled code */ }
Idea itself can display source code of library classes.
Can I use PsiElement.acceptChildren() to parse source of library classes like source of project classes?
Please sign in to leave a comment.
Hello Andrew,
Call ((PsiCompiledElement) element).getMirror() on such a class or method
to get the corresponding element in library sources.
--
Dmitry Jemerov
Development Lead
JetBrains, Inc.
http://www.jetbrains.com/
"Develop with Pleasure!"
Hello Dmitry,
It looks like PsiElement.getNavigationElement() should be called instead of getMirror().
Thank you, anyway - your answer was helpfull.