无法解析org.eclipse.jdt.annotation.NonNull类型。它是从所需的.class文件间接引用的 [英] The type org.eclipse.jdt.annotation.NonNull cannot be resolved. It is indirectly referenced from required .class files
问题描述
当我使用带有新运算符的Java 8方法引用双冒号运算符( ::
)时(例如 MyType :: new
),我在Eclipse的Spring工具套件(STS)中遇到这个错误:
When I use the Java 8 method reference double colon operator (::
) with new operator (e.g. MyType::new
), I get this error in Eclipse of Spring Tool suite (STS):
类型org.eclipse.jdt.annotation .NonNull无法解决。它是从所需的.class文件间接引用的。
The type org.eclipse.jdt.annotation.NonNull cannot be resolved. It is indirectly referenced from required .class files
如何摆脱这个错误?
推荐答案
Stephan Herrmann的评论中提供了错误描述。有一个开放的 Eclipse问题,以使此问题更加用户友好。
Error description is provided in Stephan Herrmann's comment. There is open Eclipse issue to make this issue more user friendly.
解决方案是包含以下依赖项:
Solution is to include following dependency:
<dependency>
<groupId>org.eclipse.jdt</groupId>
<artifactId>org.eclipse.jdt.annotation</artifactId>
<version>2.0.0</version>
</dependency>
这篇关于无法解析org.eclipse.jdt.annotation.NonNull类型。它是从所需的.class文件间接引用的的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!