PsiElement.getContainingFile() is @Nullable

When would that typically happen? Can PsiElements exist without a file and under what
circumstances would I come across such an element?

Thanks,
Sascha

5 comments

Hello Sascha,

PsiDirectory, PsiPackage

-


Maxim Shafirov
JetBrains, Inc
http://www.jetbrains.com
"Develop with pleasure!"

When would that typically happen? Can PsiElements exist without a file
and under what circumstances would I come across such an element?

Thanks,
Sascha



0

Maxim Shafirov (JetBrains) wrote:

Hello Sascha,

PsiDirectory, PsiPackage


Thanks! (A little note in the Javadoc wouldn't hurt though ;))

Sascha

0

Hello Sascha,

>> PsiDirectory, PsiPackage
>>
SW> Thanks! (A little note in the Javadoc wouldn't hurt though ;))

Added.

--
Dmitry Jemerov
Software Developer
JetBrains, Inc.
http://www.jetbrains.com
"Develop with pleasure!"


0

Also, I believe I've seen it return null inside a completion handler.

Maxim Shafirov (JetBrains) wrote:

Hello Sascha,

PsiDirectory, PsiPackage

------------------
Maxim Shafirov
JetBrains, Inc
http://www.jetbrains.com
"Develop with pleasure!"

>> When would that typically happen? Can PsiElements exist without a file
>> and under what circumstances would I come across such an element?
>>
>> Thanks,
>> Sascha


0

Keith Lea wrote:

Also, I believe I've seen it return null inside a completion handler.


Wasn't that about PsiElement.getContainingFile().getVirtualFile() == null vs.
PsiElement.getContainingFile().getOriginalFile().getVirtualFile() ?

Sascha

0

Please sign in to leave a comment.