tolerate INRE when checking for java property deprecatedness in structure view (EA-91628 - INRE: FileBasedIndexImpl.handleDumbMode)

This commit is contained in:
peter
2016-11-16 18:18:28 +01:00
parent c98e03bcb7
commit 0d3f5ef6d9
@@ -24,6 +24,7 @@ import com.intellij.openapi.application.Application;
import com.intellij.openapi.application.ApplicationManager;
import com.intellij.openapi.editor.colors.CodeInsightColors;
import com.intellij.openapi.editor.colors.TextAttributesKey;
import com.intellij.openapi.project.IndexNotReadyException;
import com.intellij.openapi.project.Project;
import com.intellij.openapi.util.Comparing;
import com.intellij.openapi.util.IconLoader;
@@ -32,6 +33,7 @@ import com.intellij.psi.util.PropertyUtil;
import com.intellij.psi.util.PsiUtil;
import org.jetbrains.annotations.NonNls;
import org.jetbrains.annotations.NotNull;
import org.jetbrains.annotations.Nullable;
import javax.swing.*;
import java.util.ArrayList;
@@ -254,11 +256,13 @@ public class PropertyGroup implements Group, ColoredItemPresentation, AccessLeve
return isDeprecated(getField()) && isDeprecated(getGetter()) && isDeprecated(getSetter());
}
private static boolean isDeprecated(final PsiElement element) {
if (element == null) return false;
if (!element.isValid()) return false;
if (!(element instanceof PsiDocCommentOwner)) return false;
return ((PsiDocCommentOwner)element).isDeprecated();
private static boolean isDeprecated(@Nullable final PsiDocCommentOwner element) {
try {
return element != null && element.isValid() && element.isDeprecated();
}
catch (IndexNotReadyException e) {
return false;
}
}
public boolean isComplete() {