New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

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

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

Comments

Projects
None yet
1 participant
@lombokissues
Collaborator

lombokissues commented Jul 14, 2015

Migrated from Google Code (issue 629)

@lombokissues

This comment has been minimized.

Show comment
Hide comment
@lombokissues

lombokissues Jul 14, 2015

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.

Collaborator

lombokissues commented Jul 14, 2015

👤 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

This comment has been minimized.

Show comment
Hide comment
@lombokissues

lombokissues Jul 14, 2015

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();
Collaborator

lombokissues commented Jul 14, 2015

👤 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

This comment has been minimized.

Show comment
Hide comment
@lombokissues

lombokissues Jul 14, 2015

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

Collaborator

lombokissues commented Jul 14, 2015

👤 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

This comment has been minimized.

Show comment
Hide comment
@lombokissues

lombokissues Jul 14, 2015

Collaborator

End of migration

Collaborator

lombokissues commented Jul 14, 2015

End of migration

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