Perform minor code clean-up#2544
Merged
eamonnmcmanus merged 5 commits intoNov 19, 2023
Merged
Conversation
Notable changes:
- Replace most usages of `<code>` with `{@code ...}` in Javadoc
- Add proper summary sentence to `GsonBuilder.enableComplexMapKeySerialization`
- Extend documentation for `GsonBuilder.setDateFormat` methods
- Fix `TypeToken.isAssignableFrom(Type)` throwing AssertionError in some cases
Maybe the method should not throw an exception in the first place, but it
might not matter much since it is deprecated already anyway.
- Remove outdated `throws NumberFormatException` from internal
`JsonReader.nextQuotedValue`; the behavior had been changed by
85ebaf7
- Fix incorrect documentation on JsonScope fields
- Fix unit tests having 'expected' and 'actual' switched
- Use dedicated Truth methods instead of `isTrue()` / `isFalse()`
- Use common helper methods in JsonWriterTest to avoid duplication
Marcono1234
commented
Nov 18, 2023
Member
eamonnmcmanus
left a comment
There was a problem hiding this comment.
Very nice! Just a few comments.
Actually it looks like the warning is not actually caused by usage of `HEAD` as value, but rather because the project has a snapshot version during development (which is expected though), see https://github.com/apache/maven-artifact-plugin/blob/maven-artifact-plugin-3.5.0/src/main/java/org/apache/maven/plugins/artifact/buildinfo/BuildInfoWriter.java#L140 But this is not a problem either since during release a non-snapshot version is used.
6197235 to
f906b3a
Compare
eamonnmcmanus
requested changes
Nov 19, 2023
Member
eamonnmcmanus
left a comment
There was a problem hiding this comment.
Looking good! Just one small thing...
| : FilterResult.INDECISIVE; | ||
| } | ||
|
|
||
| @Override |
Member
There was a problem hiding this comment.
Can you mention these in the PR description?
Contributor
Author
There was a problem hiding this comment.
Have included it now; sorry that I added this in a follow-up commit and not in the original changes of this PR. I just remembered that this change was something I wanted to do for quite some time because the default toString() during debugging makes it difficult to understand which filter is used.
eamonnmcmanus
approved these changes
Nov 19, 2023
Member
eamonnmcmanus
left a comment
There was a problem hiding this comment.
Thanks again. This is a big improvement!
tibor-universe
pushed a commit
to getuniverse/gson
that referenced
this pull request
Sep 14, 2024
* Perform minor code clean-up
Notable changes:
- Replace most usages of `<code>` with `{@code ...}` in Javadoc
- Add proper summary sentence to `GsonBuilder.enableComplexMapKeySerialization`
- Extend documentation for `GsonBuilder.setDateFormat` methods
- Fix `TypeToken.isAssignableFrom(Type)` throwing AssertionError in some cases
Maybe the method should not throw an exception in the first place, but it
might not matter much since it is deprecated already anyway.
- Remove outdated `throws NumberFormatException` from internal
`JsonReader.nextQuotedValue`; the behavior had been changed by
85ebaf7
- Fix incorrect documentation on JsonScope fields
- Fix unit tests having 'expected' and 'actual' switched
- Use dedicated Truth methods instead of `isTrue()` / `isFalse()`
- Use common helper methods in JsonWriterTest to avoid duplication
* Implement `toString()` for ReflectionAccessFilter constants
* Address most of the review comments
* Add comment about `source.scm.tag=HEAD` warning
Actually it looks like the warning is not actually caused by usage of
`HEAD` as value, but rather because the project has a snapshot version
during development (which is expected though), see
https://github.com/apache/maven-artifact-plugin/blob/maven-artifact-plugin-3.5.0/src/main/java/org/apache/maven/plugins/artifact/buildinfo/BuildInfoWriter.java#L140
But this is not a problem either since during release a non-snapshot
version is used.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Purpose
Performs some minor code clean-up, which should not noticeably (or at all) change functionality
Description
Notable changes:
<code>with{@code ...}in JavadocGsonBuilder.enableComplexMapKeySerializationGsonBuilder.setDateFormatmethodsTypeToken.isAssignableFrom(Type)throwingAssertionErrorin some casesMaybe the method should not throw an exception in the first place, but it might not matter much since it is deprecated already anyway.
throws NumberFormatExceptionfrom internalJsonReader.nextQuotedValue; the behavior had been changed by 85ebaf7JsonScopefieldsFor that I removed the
.getType()call fromTypeTokento use<T> Gson.fromJson(..., TypeToken<T>)instead of<T> Gson.fromJson(..., Type)because otherwise the call toassertThat(...)would have been ambiguous.isTrue()/isFalse()JsonWriterTestto avoid duplicationtoString()forReflectionAccessFilterconstantsChecklist
This is automatically checked by
mvn verify, but can also be checked on its own usingmvn spotless:check.Style violations can be fixed using
mvn spotless:apply; this can be done in a separate commit to verify that it did not cause undesired changes.null@since $next-version$(
$next-version$is a special placeholder which is automatically replaced during release)TestCase)mvn clean verify javadoc:jarpasses without errors