private static boolean shouldBeSuppressed(@NotNull PsiExpression anchor) {
    if (anchor instanceof PsiInstanceOfExpression) {
      PsiType type = ((PsiInstanceOfExpression)anchor).getOperand().getType();
      if (type == null || !TypeConstraints.instanceOf(type).isResolved()) return true;
      // 5.20.2 Removed restriction on pattern instanceof for unconditional patterns (JEP 427)
      if (PsiUtil.isAvailable(JavaFeature.PATTERN_GUARDS_AND_RECORD_PATTERNS, anchor)) return false;
      PsiPattern pattern = ((PsiInstanceOfExpression)anchor).getPattern();
      if (pattern instanceof PsiTypeTestPattern && ((PsiTypeTestPattern)pattern).getPatternVariable() != null) {
        PsiTypeElement checkType = ((PsiTypeTestPattern)pattern).getCheckType();
        // Reported as compilation error
        return checkType != null && checkType.getType().isAssignableFrom(type);
      }
    }
    return false;
  }
private static boolean shouldBeSuppressed(@NotNull PsiExpression anchor)