in src/main/java/org/jetbrains/plugins/spotbugs/common/util/FileModificationServiceUtil.java [45:81]
static {
Method _getInstance = null;
Method _preparePsiElementForWrite = null;
// FileModificationService ?
try {
final Class fileModificationService = Class.forName("com.intellij.codeInsight.FileModificationService");
if (fileModificationService != null) {
_getInstance = fileModificationService.getDeclaredMethod("getInstance");
if (_getInstance != null) {
_preparePsiElementForWrite = fileModificationService.getDeclaredMethod("preparePsiElementForWrite", PsiElement.class);
}
}
} catch (final ClassNotFoundException ignored) { // ignore e;
} catch (final NoSuchMethodException ignored) { // ignore e;
}
// or CodeInsightUtilBase ?
if (_preparePsiElementForWrite == null) {
try {
final Class<?> codeInsightUtilBase = Class.forName("com.intellij.codeInsight.CodeInsightUtilBase");
if (codeInsightUtilBase != null) {
_getInstance = null;
_preparePsiElementForWrite = codeInsightUtilBase.getDeclaredMethod("preparePsiElementForWrite", PsiElement.class);
}
} catch (final ClassNotFoundException ignored) { // ignore e;
} catch (final NoSuchMethodException ignored) { // ignore e;
}
}
if (_preparePsiElementForWrite == null) {
throw new Error("Method preparePsiElementForWrite(PsiElement) not found in FileModificationService and CodeInsightUtilBase");
}
getInstance = _getInstance;
preparePsiElementForWrite = _preparePsiElementForWrite;
}