One of the messages produced by Lint4J is this:
I started to change these, then began wondering if it was really necessary. I thought "what do they do in the JDK?" I found System.getProperty("line.separator") called six times in the entire JDK, whereas \n was used over 1400 times.
Don't hardcode newline characters, use System.getProperty("line.separator") instead.
I'm going to go out on a limb here and guess that, if System.getProperty("line.separator") was important at one time, something has changed so that \n is now safe to use, at least for building strings. Cross-platform input scanning might still need line.separator.
Neither PMD nor FindBugs suggested this fix, either. In fact, it was quite interesting to see the differences in the kinds of things suggested by the three different tools; they were all pretty different. It seems like we could benefit from a common database of guidelines that any tool could use. Then the tools could compete on quality of implementation (if you've used these tools you know that there's generally a bit of wierd messing around just to get them to run) and features like auto-fixing, rather than their rule sets.
MindView Home Page