-
Notifications
You must be signed in to change notification settings - Fork 354
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
base: main
Are you sure you want to change the base?
Conversation
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.
rewrite-core/src/main/java/org/openrewrite/PrintOutputCapture.java
Outdated
Show resolved
Hide resolved
|
||
@Incubating(since = "8.41.4") | ||
@RequiredArgsConstructor | ||
enum MarkerMode { |
There was a problem hiding this comment.
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") |
There was a problem hiding this comment.
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.
Instead of having to redefine
MarkerPrinter
everywhere we have a few standardMarkerPrinter
s 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 defineMarkerPrinter
sWhat'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