当我将 Java 8 方法引用双冒号运算符 (::
) 与 new 运算符(例如 MyType::new
)一起使用时,我在 Eclipse 中收到此错误 Spring 工具套件(STS):
The type org.eclipse.jdt.annotation.NonNull cannot be resolved. It is indirectly referenced from required .class files
如何摆脱这个错误?
最佳答案
Stephan Herrmann 的评论中提供了错误描述。有开放Eclipse issue使这个问题对用户更友好。
解决方案是包含以下依赖项:
<dependency>
<groupId>org.eclipse.jdt</groupId>
<artifactId>org.eclipse.jdt.annotation</artifactId>
<version>2.0.0</version>
</dependency>
关于java - org.eclipse.jdt.annotation.NonNull 类型无法解析。它是从所需的 .class 文件中间接引用的,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/33785727/