RxJava的又一个版本: RxJava3

RxJava出3啦

早上看见一个库支持RxJava3, 还以为自己眼花了, 查了下果然是出RxJava3了.

RxJava2会怎样呢?

RxJava2会进入维护状态, 只有bugfix的改动, 不会有新feature, 到February 28, 2021将会停止所有2.0的开发.

With the release of RxJava 3.0.0, the previous version line, 2.2.x, is in maintenance mode. 

This means only bugfixes will be accepted and applied; no new operators or documentation changes will be accepted or applied.

:information_source: 2.x will be supported until February 28, 2021, after which all development on that branch will stop.

RxJava2和RxJava3可以共存.

为了解决逐步迁移过程中, RxJava2和RxJava3互相调用的问题, 有一个外部的library: https://github.com/akarnokd/RxJavaBridge#rxjavabridge

RxJava3依赖添加

之前RxJava1是这样的:

implementation 'io.reactivex:rxjava:1.3.0

RxJava2是这样的:

implementation 'io.reactivex.rxjava2:rxjava:2.0.9'

现在RxJava3是这样的:

implementation 'io.reactivex.rxjava3:rxjava:3.0.0'

主要改变

Java 8

因为Android Studio 4.0的desugaring, 见: Java 8 library desugaring in D8 and R8, 使用Java 8的一些APIs, 不再限制app的最小API level.

所以RxJava的基准也变为Java 8.

Package

一些包名的改变.
现在的包都是: io.reactivex.rxjava3.

行为改变 Behavior changes

  • More undeliverable errors
  • Connectable source reset
  • Flowable.publish pause
  • Processor.offer null-check
  • MulticastProcessor.offer fusion-check
  • Group abandonment in groupBy
  • Backpressure in groupBy
  • Window abandonment in window
  • CompositeException cause generation
  • Parameter validation exception change
  • From-callbacks upfront cancellation
  • Using cleanup order

API改变

  • Functional interfaces
  • New Types
  • Moved components
  • API promotions
  • API additions
  • Java 8 additions
  • API renames
  • API signature changes
  • API removals

这两部分太长太具体了, 这里只是列出来项目, 大家自己点去原文看吧. What's different in 3.0

参考

  • RxJava Releases
  • What's different in 3.0

你可能感兴趣的:(RxJava的又一个版本: RxJava3)