-
Notifications
You must be signed in to change notification settings - Fork 4.3k
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
Use non-null
FormattingStyle
; configure space after separator
#2345
Use non-null
FormattingStyle
; configure space after separator
#2345
Conversation
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.
This looks great! I like the look of the API changes.
Just some very minor comments.
@@ -35,7 +34,7 @@ | |||
public class FormattingStyleTest { | |||
|
|||
private static final String[] INPUT = {"v1", "v2"}; | |||
private static final String EXPECTED = "[<EOL><INDENT>\"v1\",<EOL><INDENT>\"v2\"<EOL>]"; | |||
private static final String EXPECTED = "[<EOL><INDENT>\"v1\",<SPACE><EOL><INDENT>\"v2\"<EOL>]"; |
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 misread this as saying that there would be a space before a newline here, which of course would be surprising. Perhaps replace <SPACE><EOL>
with <SPACE_OR_EOL>
or something like that?
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.
Have named them COLON_SPACE
and COMMA_SPACE
, still slightly misleading but hopefully a bit less than before. Are these fine?
3eb18ff
to
f2e8218
Compare
Gson gson = new GsonBuilder().setPrettyPrinting(style).create(); | ||
String json = gson.toJson(INPUT); | ||
assertThat(json).isEqualTo(buildExpected(newline, indent)); | ||
public void testFormat() { |
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.
Combined all these separate test methods into a single method which also tests more combinations.
The "Check API compatibility" CI task correctly identified incompatible changes here:
But that is expected and also acceptable I guess because the |
@eamonnmcmanus, could you please have a look? As mentioned above the failure for "Check API compatibility" is expected, since it compares these changes against |
@eamonnmcmanus, could you please have a look at this pull request when you have some time? Would be good to get this merged (with any adjustments you request) before the next release, since this makes backward-incompatible changes to the not yet released |
Sorry for the delay. I'll merge this as soon as the automated checks have completed. (For some reason they are remaining queued for a very long time at the moment.) |
…ogle#2345) * Use non-`null` `FormattingStyle`; configure space after separator * Improve Javadoc and tests * Rename to plural separator*s* * Add explicit tests for default formatting styles --------- Co-authored-by: Éamonn McManus <emcmanus@google.com>
Depends on #2327
Purpose
Follow-up for #2327 containing the API changes, see also #2327 (comment).
Description
Also contains an experimental implementation for #2344 (closes #2344). Please let me know what you think, and whether that should be omitted from this pull request.
Have marked this pull request as draft for now to first gather some feedback. This pull request is also not complete; it is missing unit tests.
Checklist
null
@since $next-version$
(
$next-version$
is a special placeholder which is automatically replaced during release)TestCase
)mvn clean verify javadoc:jar
passes without errors