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

Add MarkerMode to select a MarkerPrinter #4799

Draft
wants to merge 3 commits into
base: main
Choose a base branch
from

Conversation

pstreef
Copy link
Contributor

@pstreef pstreef commented Dec 19, 2024

Instead of having to redefine MarkerPrinter everywhere we have a few standard MarkerPrinters that can be used. There is a new diff method that uses the enum to select the right marker printer.

What's changed?

Add MarkerMode and define MarkerPrinters

What's your motivation?

Reuse

Anything in particular you'd like reviewers to focus on?

the set of marker printers

Anyone you would like to review specifically?

@knutwannheden

Have you considered any alternatives or workarounds?

Not doing this

Any additional context

No

Instead of having to redefine MarkerPrinter everywhere we have a few standard `MarkerPrinter`s that can be used. There is a new diff method that uses the enum to select the right marker printer.
@pstreef pstreef marked this pull request as draft December 20, 2024 07:58

@Incubating(since = "8.41.4")
@RequiredArgsConstructor
enum MarkerMode {
Copy link
Member

@jkschneider jkschneider Dec 25, 2024

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I know naming is hard, but I don't love the name. I think there is a similar design concept in java.nio.charset. There is a Charset abstract class and a separate top level class called StandardCharsets. I think a top level StandardMarkerPrinters might be a slightly better design.

}

public String diff(@Nullable Path relativeTo, PrintOutputCapture.@Nullable MarkerPrinter markerPrinter) {
return diff(relativeTo, markerPrinter, false);
}

@Incubating(since = "8.41.4")
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

If we move this StandardMarkerPrinters then we don't need to add these overloads. Indeed I would prefer we don't add more overload variations here unless absolutely necessary. Every new overload is one more item in the IDE autocomplete list.

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

Successfully merging this pull request may close these issues.

3 participants