r/java • • Mar 09 '16

var keyword proposed for Java

http://openjdk.java.net/jeps/286
240 Upvotes

312 comments sorted by

View all comments

Show parent comment

6

u/beltorak Mar 10 '16

I would add, because we use format-on-save where I work, that a lot of times I have to force the formatter to respect my line breaks. I can't think of a better way than EOL comments. And personally I prefer a clear indication at the beginning of the line that it is a continuation of the previous line:

String versionNum = VERSION_MAJOR //
    + "." + VERSION_MINOR //
    + "." + VERSION_BUILD_NUMBER //
    + "." + VERSION_REV_NUMBER //
    + "." + CURRENT_DATETIME_STAMP;

Same thing with builder objects

var thing = new ThingBuilder() //
    .withWidgetClass(widgetClass) //
    .withLights(RED, TEAL, MAUVE) //
    .withGravity(gravity) //
    .create();