在项目中使用@NotNull其中两个的IntelliJ和Eclipse的开发人员正在努力 [英] Using @NotNull in a project where both IntelliJ and Eclipse developers are working

查看:1953
本文介绍了在项目中使用@NotNull其中两个的IntelliJ和Eclipse的开发人员正在努力的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

上的IntelliJ IDEA(另一个项目工作),一位同事向我展示了惊人的@NotNull注释。我在这里对SO读取消息有关如何开始添加@NotNull处处节省大量的时间和头痛(和IntelliJ 10甚至可以自动添加@NotNull老code,当它检测到的的将肆虐)。

A co-worker on IntelliJ IDEA (working on another project) showed me the amazing @NotNull annotation. I've read messages here on SO about how starting to add @NotNull everywhere saved lots of time and headaches (and IntelliJ 10 can even add automatically @NotNull to old code when it detects that null would wreak havoc).

自从我读我的第一次的可能违反了@NotNull的消息(在实时,在IDE中,甚至在部分的的.java 的文件不编译还)我的下巴下降,我迷上了。

Since I read my first "Probable @NotNull violation" message (in real-time, in the IDE, even on a partial .java file that doesn't compile yet) my jaw dropped and I got hooked.

所以我想知道:有什么需要知道,如果我们想开始在项目中使用@NotNull,开发人员使用Eclipse和的IntelliJ

So I was wondering: is there anything that needs to be known if we want to start using @NotNull in a project where developers are using both Eclipse and IntelliJ?

我知道的IntelliJ附带的 annotations.jar 的。是与Eclipse兼容这个?

I know IntelliJ ships with the annotations.jar. Is this compatible with Eclipse?

推荐答案

有也是注释存储源之外的可能性。
设置> code样式> code一代>使用外部注释。
注释然后存储在一个annotations.xml文件,而不是在源。这样Eclipse用户永远不会看到注释。该annotations.xml的位置可以进行配置,它可能是最好将文件存储在版本控制项目。

There is also the possibility to store the annotations outside of the source. Settings > Code Style > Code generation > Use external annotations. The annotations are then stored in an annotations.xml file instead of in the source. That way Eclipse users never have to see the annotations. The location of the annotations.xml can be configured and it is probably best to store the file with the project in version control.

请参阅

http://www.jetbrains.com/idea/webhelp/使用-外部annotations.html
http://blogs.jetbrains.com/idea/2008/02/external-注释/

这篇关于在项目中使用@NotNull其中两个的IntelliJ和Eclipse的开发人员正在努力的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆