Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

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

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

like image 342
Ayyoudy Avatar asked Apr 10 '12 17:04

Ayyoudy


2 Answers

To the best of my knowledge the internal Sun coding stds document was never officially updated to include conventions to encompass language changes such as Generics, Annotations, or now (in JDK 8) Lambdas etc.

I personally have always used the empirical style derived from the JDK itself, i.e if my code doesn't look like JDK code, then I am not following the coding practice.

like image 106
Larry Cable Avatar answered Oct 30 '22 16:10

Larry Cable


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.

like image 42
Scott M. Avatar answered Oct 30 '22 16:10

Scott M.