Automatically reformat long Java code to 80 columns and still compile?

My team is developing Java code in several different IDEs with different numbers of columns. This has worked well so far, but we have been asked to provide compiled code to a partner with a source limited to 80 columns. We would like to do this as a professional courtesy, but we are not able / not ready to work with a limited code with 80 columns on a daily basis. Are there any tools that will use Java code, and is it wise to add line breaks so that it matches 80 characters and still compiles correctly? Ideally, I would like it to be another automated step in our build process, to recursively navigate through our source directory for .java files and create a copy with a new formatting.

I'm not interested in the virtues of 80-column code or editors who make or can't stand words, just seeing if there is a quick fix that will make everyone happy without having to change the way they do things.

+5
source share
4 answers

It is not as automated as you like, but in Eclipse you can define a profile with 80 columns (Preferences → Java → Code Style → Formatter), then in the Package Explorer, right-click on the root package and select "Source-> Format" .

+7
source

Intellij and eclipse and almost any IDE will do this. But...

, , , , , maven, , , , , , .

XML eclipse intellij ( ), maven checkstyle, ; , , , .

, , , 100 120, 80.

+8

Eclipse, 80 , .

, , - , , .

0

IDE , , , . , , .

100-120 . 80 CRT (24 80 ), 1928 IBM punch card standard.

0

All Articles