intellij 不存在类型变量 R 的实例,因此 Flux<R> 符合 Publisher<? extends DataBuffer> 问题

问题描述 投票:0回答:1

我正在尝试使用带有reactor和spring的java将

Mono<Part>
转换为
Mono<InputStream>

我有一个可以正常编译和工作的代码,但它会生成 Intellij 错误。

代码:

import org.springframework.core.io.buffer.DataBuffer;
import org.springframework.core.io.buffer.DataBufferUtils;
import org.springframework.http.codec.multipart.Part;
import reactor.core.publisher.Mono;
import java.io.InputStream;

public Mono<InputStream> loadFile(Mono<Part> fileMono) {
  return DataBufferUtils.join(fileMono.flatMapMany(Part::content))
                        .map(DataBuffer::asInputStream);
}

错误:

Required type: Publisher

Provided: Flux <org.springframework.core.io.buffer.DataBuffer>

no instance(s) of type variable(s) R exist so that Flux<R> conforms to Publisher<? extends DataBuffer>

作为

Flux<T> implements CorePublisher<T>
CorePublisher<T> extends Publisher<T>
,我不明白这个错误。 此外,我的一些同事有错误,而其他人则没有。 这很奇怪。

我尝试通过 gradle 删除并重新导入库依赖项,并执行所有 7 个 intellij 步骤来调试项目,包括清除缓存和重新索引应用程序。

可能出了什么问题?

java spring intellij-idea project-reactor
1个回答
0
投票

嗯,显然 Intellij 中的 Kotlin 插件有错误。

https://youtrack.jetbrains.com/issue/KTIJ-16925

建议的解决方案是:

  • 停用 Kotlin 插件
  • 回滚到较旧的 Kotlin 插件版本
© www.soinside.com 2019 - 2024. All rights reserved.