Where can I find the OFFICIAL Java Coding/Style Standards?

Ayyoudy picture Ayyoudy · Apr 10, 2012 · Viewed 20.5k times · Source

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...

Here is what I found so far:

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 (last modified 1999 - CheckStyle website references this)

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?

Thanks

Answer

Scott M. picture Scott M. · Apr 10, 2012

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

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.

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