@Override
 protected String stubTreeAndIndexDoNotMatch(
     StubTree stubTree,
     PsiFileWithStubSupport psiFile,
     List<StubElement<?>> plained,
     VirtualFile virtualFile,
     StubTree stubTreeFromIndex) {
   String details = "Please report the problem to JetBrains with the file attached";
   details += "\npsiFile" + psiFile;
   details += "\npsiFile.class" + psiFile.getClass();
   details += "\npsiFile.lang" + psiFile.getLanguage();
   String fileText = psiFile instanceof PsiCompiledElement ? "compiled" : psiFile.getText();
   return LogMessageEx.createEvent(
           "PSI and index do not match",
           details,
           new Attachment(
               virtualFile != null ? virtualFile.getPath() + "_file.txt" : "vFile.txt", fileText),
           new Attachment("stubTree.txt", ((PsiFileStubImpl) stubTree.getRoot()).printTree()),
           new Attachment(
               "stubTreeFromIndex.txt",
               stubTreeFromIndex == null
                   ? "null"
                   : ((PsiFileStubImpl) stubTreeFromIndex.getRoot()).printTree()))
       .toString();
 }
예제 #2
0
 // will restore by stub index until file tree get loaded
 AnchorElementInfo(
     @NotNull PsiElement anchor,
     @NotNull PsiFileWithStubSupport containingFile,
     int stubId,
     @NotNull IStubElementType stubElementType) {
   super(
       containingFile.getProject(),
       new ProperTextRange(0, 0),
       anchor.getClass(),
       containingFile,
       containingFile.getLanguage());
   myStubElementTypeAndId = pack(stubId, stubElementType);
   assert !(anchor instanceof PsiFile) : "FileElementInfo must be used for file: " + anchor;
 }