gpt4 book ai didi

java - IDEA 不想使用 javax 中的 NotNull,而是使用 org.jetbrains

转载 作者:塔克拉玛干 更新时间:2023-11-02 19:07:42 26 4
gpt4 key购买 nike

当我在我的 DTO 中的 @NotNull 注释上看到这个时,我正在设置我的项目

Not 'javax.validation.constraints.NotNull' but 'org.jetbrains.annotations.NotNull' would be used for code generation

我有 import javax.validation.constraints.NotNull;

但还是看到这个警告。

为什么 IDEA 不想使用 javax NotNull,我应该怎么做才能强制使用它?

最佳答案

When you compile your project, the IDE adds assertions to all methods and parameters annotated with the @NotNull annotation. The assertions will fail if null is passed in code where @NotNull is expected. You can disable this option and configure the list of annotations in the Settings/Preferences dialog Ctrl+Alt+S. Go to Build, Execution, Deployment | Compiler.

https://www.jetbrains.com/help/idea/nullable-and-notnull-annotations.html

也许这会成功。

关于java - IDEA 不想使用 javax 中的 NotNull,而是使用 org.jetbrains,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/52179888/

26 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com