From 9350698e63f579eedc5f4ed987592d26b04e455f Mon Sep 17 00:00:00 2001 From: Nicolay Mitropolsky Date: Mon, 9 Jul 2018 15:49:12 +0300 Subject: [PATCH] `UnstableApiUsageInspection` cleanup as long as IDEA-195008 is fixed --- .../codeInspection/UnstableApiUsageInspection.java | 10 ++-------- 1 file changed, 2 insertions(+), 8 deletions(-) diff --git a/jvm/jvm-analysis-impl/src/com/intellij/codeInspection/UnstableApiUsageInspection.java b/jvm/jvm-analysis-impl/src/com/intellij/codeInspection/UnstableApiUsageInspection.java index eb4faa841a34..40178a4c3e23 100644 --- a/jvm/jvm-analysis-impl/src/com/intellij/codeInspection/UnstableApiUsageInspection.java +++ b/jvm/jvm-analysis-impl/src/com/intellij/codeInspection/UnstableApiUsageInspection.java @@ -8,6 +8,7 @@ import com.intellij.lang.java.JavaLanguage; import com.intellij.openapi.application.ApplicationManager; import com.intellij.openapi.project.Project; import com.intellij.openapi.roots.ProjectFileIndex; +import com.intellij.openapi.util.Condition; import com.intellij.openapi.util.text.StringUtil; import com.intellij.openapi.vfs.VirtualFile; import com.intellij.psi.*; @@ -96,14 +97,7 @@ public class UnstableApiUsageInspection extends LocalInspectionTool { } private static boolean isInsideImport(@NotNull PsiElement element) { - //TODO remove once IDEA-195008 is fixed - if (JavaLanguage.INSTANCE == element.getLanguage()) { - return PsiTreeUtil.getParentOfType(element, PsiImportStatementBase.class) != null; - } - - UElement uElement = UastContextKt.toUElement(element); - if (uElement == null) return false; - return UastUtils.getParentOfType(uElement, UImportStatement.class) != null; + return PsiTreeUtil.findFirstParent(element, parent -> UastContextKt.toUElement(parent, UImportStatement.class) != null) != null; } private static boolean isLibraryElement(@NotNull PsiElement element) {