Skip to content

ChangeMethodAccessLevelVisitor should also consider Space #5592

@Laurens-W

Description

@Laurens-W

What problem are you trying to solve?

ChangeMethodAccessLevelVisitor should probably also copy over the Space from the previous modifier as the auto formatter doesn't influence spacing when comments are involved (neither does IntelliJ)

if (!modifierComments.isEmpty()) {
J.Modifier nextModifier = mod.withComments(ListUtils.concatAll(new ArrayList<>(modifierComments), mod.getComments()));
modifierComments.clear();
return nextModifier;
}

This test is a good show of what we don't want happening (see the dataSource3 bean)
We'd rather update the expectation

Metadata

Metadata

Assignees

No one assigned

    Labels

    Type

    Projects

    Status

    Backlog

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions