听听那晚风 2021-08-25 15:16 采纳率: 53.8%
浏览 21

java 语法转成kotlin怎么转



```java
private void setRxJavaErrorHandler() {
        if(RxJavaPlugins.getErrorHandler()||RxJavaPlugins.lockdown) return;
        RxJavaPlugins.setErrorHandler(e -> {
            if (e instanceof UndeliverableException) {
                e = e.getCause();
            }
            if ((e instanceof IOException) || (e instanceof SocketException)) {
                // fine, irrelevant network problem or API that throws on cancellation
                return;
            }
            if (e instanceof InterruptedException) {
                // fine, some blocking code was interrupted by a dispose call
                return;
            }
            if ((e instanceof NullPointerException) || (e instanceof IllegalArgumentException)) {
                // that's likely a bug in the application
                Thread.currentThread().getUncaughtExceptionHandler()
                        .handleException(Thread.currentThread(), e);
                return;
            }
            if (e instanceof IllegalStateException) {
                // that's a bug in RxJava or in a custom operator
                Thread.currentThread().getUncaughtExceptionHandler()
                        .handleException(Thread.currentThread(), e);
                return;
            }
            Log.warning("Undeliverable exception received, not sure what to do", e);
        });
    }

```

  • 写回答

1条回答 默认 最新

  • Pliosauroidea 2021-08-25 15:20
    关注

    我记得IDEA可以一键转kotlin来着emm

    评论

报告相同问题?

问题事件

  • 创建了问题 8月25日