在哪里可以找到官方的Java编码/样式标准? [英] Where can I find the OFFICIAL Java Coding/Style Standards?

查看:196
本文介绍了在哪里可以找到官方的Java编码/样式标准?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我使用CheckStyle插件为Eclipse,它做了一个奇妙的工作。我想知道是否有一个官方的代码/样式标准(和应该有)由Sun / Oracle ...在那里我找到的是如此过时,他们甚至不包括任何Java 1.6特定语法等...

I use CheckStyle plugin for Eclipse and it does a wonderful job. I would like to know if there an official Code/Style standard (and there should be!) out there by Sun/Oracle... The ones I am finding are so out-dated, they don't even include any Java 1.6 specific syntax, etc...

以下是我发现的:

http://developers.sun.com/sunstudio/products/archive/whitepapers/java-style .pdf (最后修改2000年)

http://developers.sun.com/sunstudio/products/archive/whitepapers/java-style.pdf (last modified 2000)

http://www.oracle.com/technetwork/java/javase/documentation/codeconvtoc-136057.html (最后修改时间:1999 - CheckStyle网站引用此)

http://www.oracle.com/technetwork/java/javase/documentation/codeconvtoc-136057.html (last modified 1999 - CheckStyle website references this)

我理解,大多数Java语法没有改变太多,但你会认为它不会超过10岁!

I understand that to a degree most of the Java syntax has not changed much but you'd think it wouldn't be over 10 years old!!! Any ideas where to find an updated version or if there is any that I am just not finding?

感谢

推荐答案

尝试查看 javac 的编译器标志 -Xlint 检查(如果这是你的问题)。它为你检查大多数东西。

Try looking at the -Xlint compiler flag for javac for a programmatic check (if that's your question). It checks most things for you.

此外,有一个大于10岁的代码风格文档有什么问题?这意味着语言是相当稳定的,旧代码看起来很像较新的代码,使维护更容易。库可能已扩展,但大部分语法是相同的。您的第二个链接是我的搜索返回,并且似乎非常全面。

Also, what's wrong with having a code style document that's > 10 years old? That means the language is fairly stable and older code looks much like newer code, making maintenance easier. The library may have expanded but much of the syntax is identical. Your second link is what my searches returned and seems very comprehensive.

编辑:如果你想要新的Java语法的nitty gritty的细节,检查 Java规范

If you want the nitty gritty details on the new Java syntax, check out the Java Specifications.

这篇关于在哪里可以找到官方的Java编码/样式标准?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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