delomboked enum source doesn't respect emptyLines:blank format setting #664

Closed
lombokissues opened this Issue Jul 14, 2015 · 4 comments

Projects

None yet

1 participant

@lombokissues
Collaborator

Migrated from Google Code (issue 629)

@lombokissues
Collaborator

👤 steven676   🕗 Jan 16, 2014 at 01:54 UTC

When you delombok an enum, the resulting source code contains indented blank lines regardless of the value of the emptyLines format setting. For example, delomboking the following source

import lombok.RequiredArgsConstructor;

@ RequiredArgsConstructor
public enum Test {
FOO(1);

private final int foo;

}

with Lombok 1.12.4 with -f emptyLines:blank results in this (output run through sed -e's/ /_/g' to make problem more obvious):

//_Generated_by_delombok_at_Wed_Jan_15_17:52:18_PST_2014

public_enum_Test_{
____FOO(1);
____private_final_int_foo;


____@ java.lang.SuppressWarnings("all")
___private_Test(final_int_foo){
_______this.foo=_foo;
____}
}

This bug's the definition of "trivial" (come to think of it, I'm not entirely sure how I came across it in the first place), but it'd be nice to have the setting respected here.

@lombokissues
Collaborator

👤 r.spilker   🕗 Jan 19, 2014 at 05:51 UTC

Looking at the code, the cause is that printEnumBody prints its own statements, and should contain in the second loop the same check as printStats:

if (!suppressAlignmentForEmptyLines(l.head)) align();
@lombokissues
Collaborator

👤 r.spilker   🕗 Jan 19, 2014 at 20:55 UTC

Fixed. You can already try it out using the latest edge release: https://projectlombok.org/download-edge.html

@lombokissues
Collaborator

End of migration

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment