PsiAnnotation () { PsiAnnotation annotation = dereference(myParsedFromRepository); if (annotation != null) return annotation; String text = getText(); try { PsiJavaParserFacade facade = JavaPsiFacade.getInstance(getProject()).getParserFacade(); annotation = facade instanceof PsiElementFactoryImpl ? ((PsiElementFactoryImpl) facade).createAnnotationFromText(text, getPsi(), false) : facade.createAnnotationFromText(text, getPsi()); ((LightVirtualFile)annotation.getContainingFile().getViewProvider().getVirtualFile()).setWritable(false); myParsedFromRepository = new SoftReference<>(annotation); return annotation; } catch (IncorrectOperationException e) { LOG.error("Bad annotation in " + fileName(), e); return null; } }