Code Styles

rolfl edited this page Sep 10, 2011 · 4 revisions

Yes, yes, yes. Eveyone loves code styles.

Right, the current issue is that I have been writing code in eclipse, in Windows, and in a few places I have inadvertantly changed the existing unix-style LF line terminators to DOS/Windows style CRLF.

Additionally, all new files have been created with CRLF terminators.

This has made the commit diff's hard to read, etc. (see for example ). It is poor practice to change terminators.

The vast majority of JDOM is simple LF, and it makes sense to keep it that way. In commit I have repaired the mess of linefeeds I made.

   TO PREVENT THIS HAPPENING AGAIN (at least from eclipse)
   Change your preferences in Eclipse: Window -> Preferences
   Choose the page: General->Workspace
   Set (at the bottom)
   Text File Encoding ->  "Other" US-ASCII
   New Textfile Line Delimiter -> "Other" Unix

Other observations:

JDOM uses a line-length of 80 characters.

This limit is fairly rigorously applied to the core code, but more relaxed in the test and contrib folders.

I have been lax about adhering to that standard when writing the jUnit tests. But, it may be worth re-strcuturing the unit test files to conform. My screen is large enough though, that, even when in a smallish panel in eclipse, there is at least screen-space for 120 characters... 80 seems too limiting, especially when you start using generics...