From 0e25daec99023c339ea64f495d571f560fbb864a Mon Sep 17 00:00:00 2001 From: Nikita Katkov Date: Wed, 20 Mar 2019 23:44:53 +0300 Subject: [PATCH] BlockingMethodInNonBlockingContextInspection: both thrown exception and it's supers are checked (IDEA-209249) GitOrigin-RevId: b9f74b84e6fd68482cb49e2c7753b0f338eceee4 --- .../ThrowsTypeBlockingMethodChecker.java | 8 +++++--- 1 file changed, 5 insertions(+), 3 deletions(-) diff --git a/jvm/jvm-analysis-impl/src/com/intellij/codeInspection/blockingCallsDetection/ThrowsTypeBlockingMethodChecker.java b/jvm/jvm-analysis-impl/src/com/intellij/codeInspection/blockingCallsDetection/ThrowsTypeBlockingMethodChecker.java index fb552d9d6fbd..c7e5ff0b0249 100644 --- a/jvm/jvm-analysis-impl/src/com/intellij/codeInspection/blockingCallsDetection/ThrowsTypeBlockingMethodChecker.java +++ b/jvm/jvm-analysis-impl/src/com/intellij/codeInspection/blockingCallsDetection/ThrowsTypeBlockingMethodChecker.java @@ -3,10 +3,11 @@ package com.intellij.codeInspection.blockingCallsDetection; import com.intellij.psi.PsiFile; import com.intellij.psi.PsiMethod; +import com.intellij.psi.util.InheritanceUtil; import com.intellij.util.containers.ContainerUtil; +import one.util.streamex.StreamEx; import org.jetbrains.annotations.NotNull; -import java.util.Arrays; import java.util.Set; public class ThrowsTypeBlockingMethodChecker implements BlockingMethodChecker { @@ -21,7 +22,8 @@ public class ThrowsTypeBlockingMethodChecker implements BlockingMethodChecker { @Override public boolean isMethodBlocking(@NotNull PsiMethod method) { - return Arrays.stream(method.getThrowsList().getReferenceElements()) - .anyMatch(thrownException -> BLOCKING_EXCEPTION_TYPES.contains(thrownException.getQualifiedName())); + return StreamEx.of(method.getThrowsList().getReferencedTypes()) + .cross(BLOCKING_EXCEPTION_TYPES) + .anyMatch(entry -> InheritanceUtil.isInheritor(entry.getKey(), entry.getValue())); } }