palantir-java-format icon indicating copy to clipboard operation
palantir-java-format copied to clipboard

Wrapping enhancements for arguments

Open Tim203 opened this issue 1 year ago • 3 comments

What happened?

Original code:

protected <T extends E> void findSubscriptions(
        @NonNull Object listener,
        TriConsumer<Class<T>, Subscribe, BiConsumer<Object, T>> consumer) {
}

After reformatting:

protected <T extends E> void findSubscriptions(
        @NonNull Object listener, TriConsumer<Class<T>, Subscribe, BiConsumer<Object, T>> consumer) {
}

What did you want to happen?

The original code is more readable in my opinion. This essentially boils down to #834 except that it shouldn't be for just records, but every type of argument (constructor, method, ...) when the line becomes too long.

Optionally the stuff after the last argument can be on a new line:

protected <T extends E> void findSubscriptions(
        @NonNull Object listener,
        TriConsumer<Class<T>, Subscribe, BiConsumer<Object, T>> consumer
) {
    // which helps make the actual content easier to distinguish 
}

but I've rarely seen projects do this so I'm not including this in the request.

Tim203 avatar Mar 07 '23 23:03 Tim203