mirror of
https://gitflic.ru/project/openide/openide.git
synced 2026-09-27 10:03:11 +07:00
BlockingMethodInNonBlockingContextInspection: both thrown exception and it's supers are checked (IDEA-209249)
GitOrigin-RevId: b9f74b84e6fd68482cb49e2c7753b0f338eceee4
This commit is contained in:
committed by
intellij-monorepo-bot
parent
5a51a1b2b5
commit
0e25daec99
+5
-3
@@ -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()));
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user