The Case of the Wrapping Eclipse Comment Line

A quick Eclipse tidbit for you on line wrapping, something you might not realize about the difference between comment and source code line wrapping.

Let’s look at the source example below. We formatted the file and everything looks good with the exception of comments wrapping differently than source code.

If you modify your Eclipse Java Code Style properties and change your line wrapping maximum width you may think this covers both source and comments.

Which would be wrong, because Eclipse gives you even more stylistic control with the addition of a “Comments” tab. Here you can customize the display of comments independent of source code and is where you can modify the maximum line width of comments.

Another really nice feature of Eclipse once you know about it.