Skip to content
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

Blank line is removed in enum #309

Closed
benjavalero opened this issue Dec 3, 2019 · 1 comment · Fixed by #351
Closed

Blank line is removed in enum #309

benjavalero opened this issue Dec 3, 2019 · 1 comment · Fixed by #351

Comments

@benjavalero
Copy link

When defining an enumeration item with an integer value, this value is indented, but no the rest of the enumeration items.

By the way, if a method exists after the declaration of the items, there is no blank line before.

Input:

public enum WikipediaNamespace {

    // Odd numbers correspond to the Talk namespaces
    ARTICLE(0),
    USER(2),
    WIKIPEDIA(4),
    FILE(6),
    MEDIA_WIKI(8),
    TEMPLATE(10),
    HELP(12),
    CATEGORY(14),
    PORTAL(100),
    WIKI_PROJECT(102),
    ANNEX(104),
    MODULE(828);

    private static final Map<Integer, WikipediaNamespace> map =
            Arrays.stream(WikipediaNamespace.values()).collect(Collectors.toMap(ns -> ns.value, ns -> ns));
    [...]
}

Output (0.4.0):

public enum WikipediaNamespace {
    // Odd numbers correspond to the Talk namespaces
    ARTICLE(
        0
    ), USER(2), WIKIPEDIA(4), FILE(6), MEDIA_WIKI(8), TEMPLATE(10), HELP(12), CATEGORY(14), PORTAL(100), WIKI_PROJECT(102), ANNEX(104), MODULE(828);
    private static final Map<Integer, WikipediaNamespace> map = Arrays
        .stream(WikipediaNamespace.values())
        .collect(Collectors.toMap(ns -> ns.value, ns -> ns));

    [...]
}
@clementdessoude
Copy link
Contributor

Thank you for reporting all this @benjavalero !

Just tested with master branch, and it is printed like this:

public enum WikipediaNamespace {
  // Odd numbers correspond to the Talk namespaces
  ARTICLE(0),
  USER(2),
  WIKIPEDIA(4),
  FILE(6),
  MEDIA_WIKI(8),
  TEMPLATE(10),
  HELP(12),
  CATEGORY(14),
  PORTAL(100),
  WIKI_PROJECT(102),
  ANNEX(104),
  MODULE(828);
  private static final Map<Integer, WikipediaNamespace> map = Arrays
    .stream(WikipediaNamespace.values())
    .collect(Collectors.toMap(ns -> ns.value, ns -> ns));
}

I'll keep this issue open to track the issue with the removed blank line. That is why I am changing the title. The first issue was fixed in #278

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

Successfully merging a pull request may close this issue.

2 participants