[英]@Nullable/@NotNull with IntelliJ IDEA, Maven & JSR 305
I really like the code inspection functionalities which are now able with either JSR 305 or Jetbrains' proprietary annotations for IntelliJ. 我非常喜欢代码检查功能,现在可以使用JSR 305或Jetbrains的IntelliJ专有注释。 Unfortunately both implementations (JSR 305 and Jetbrains') do not mix well:
不幸的是,这两种实现(JSR 305和Jetbrains')混合不好:
The only possible workaround might be to go for JSR-305 and use the Findbugs plugin in IntelliJ. 唯一可能的解决方法可能是使用JSR-305并使用IntelliJ中的Findbugs插件。 Has anybody a better idea?
谁有更好的主意? (please don't say change your IDE ;) ).
(请不要说改变你的IDE;))。
Thanks Thomas 谢谢托马斯
使用IntelliJ的10.5可以实现这一点: http : //blogs.jetbrains.com/idea/2011/03/more-flexible-and-configurable-nullublenotnull-annotations/
I'm late to the party, but for future readers this might be interesting. 我迟到了,但对于未来的读者来说,这可能很有趣。
As of IntelliJ 15.0.2, you may natively use other annotations than the JetBrains ones: 从IntelliJ 15.0.2开始,您可以使用其他注释而不是JetBrains注释:
Editor > Inspections
tab Editor > Inspections
选项卡 Java > Probable Bugs > "@NotNull/@Nullable problems"
Java > Probable Bugs > "@NotNull/@Nullable problems"
Configure annotations
button, leading to this dialog where you can select from a list of well-known annotations: Configure annotations
按钮,通向此对话框,您可以从中选择一个众所周知的注释列表: According to IntelliJ issue IDEA-64677 : 根据IntelliJ问题IDEA-64677 :
As this question is IntelliJ specific it is perhaps best asked on an IntelliJ forum. 由于这个问题是IntelliJ特定的,因此最好在IntelliJ论坛上询问。 You might find this thread interesting http://devnet.jetbrains.net/message/5262800 .
您可能会发现此主题很有趣http://devnet.jetbrains.net/message/5262800 。 The downside of using Findbugs is that it doesn't provide code injection for runtime checks and JSR-305 doesn't appear likely to be approved anytime soon.
使用Findbugs的缺点是它不为运行时检查提供代码注入,并且JSR-305似乎不会很快被批准。
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.