Add more investigation info to getFilesForElements

Relates to #EA-209630
This commit is contained in:
Vladimir Dolzhenko
2020-01-06 14:53:09 +01:00
parent 93ce4c003f
commit d644c0125a
3 changed files with 15 additions and 7 deletions
@@ -60,9 +60,9 @@ public class KtElementImpl extends ASTWrapperPsiElement implements KtElement {
public KtFile getContainingKtFile() {
PsiFile file = getContainingFile();
if(!(file instanceof KtFile)) {
String fileString = (file != null && file.isValid()) ? file.getText() : "";
String fileString = (file != null && file.isValid()) ? (" " + file.getText()) : "";
throw new IllegalStateException("KtElement not inside KtFile: " + file + fileString +
"for element " + this + " of type " + this.getClass() + " node = " + getNode());
" for element " + this + " of type " + this.getClass() + " node = " + getNode());
}
return (KtFile) file;
}
@@ -69,9 +69,9 @@ public class KtElementImplStub<T extends StubElement<?>> extends StubBasedPsiEle
PsiFile file = getContainingFile();
if (!(file instanceof KtFile)) {
// KtElementImpl.copy() might be the reason for this exception
String fileString = file.isValid() ? file.getText() : "";
String fileString = file.isValid() ? (" " + file.getText()) : "";
throw new IllegalStateException("KtElement not inside KtFile: " + file + fileString +
"for element " + this + " of type " + this.getClass() + " node = " + getNode());
" for element " + this + " of type " + this.getClass() + " node = " + getNode());
}
return (KtFile) file;
}