-
Notifications
You must be signed in to change notification settings - Fork 4
Fix Stringifiers.toString(...)
not processing enum values
#462
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
Conversation
Also simplify and rename its "enum" counterpart.
Also fixed the old doc formatting across changed files.
The conversion of `List` and `Map` by `Stringifiers.toString(...)` will remain unsupported. The conversion logic is too convoluted and includes complex type parameter resolution. Anyone trying to stringify `List` or `Map` is better off using `Stringifiers.newForListOf(...)` and `Stringifiers.newForMapOf(...)`.
@armiol PTAL. |
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.
@dmitrykuzmin LGTM with a single comment to address.
void createListType() { | ||
Type type = listTypeOf(String.class); | ||
Type expectedType = new TypeToken<List<String>>(){}.getType(); | ||
assertEquals(expectedType, type); | ||
} | ||
|
||
@Test | ||
@DisplayName("tell if the type is a enum class") |
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.
an enum class
.
Codecov Report
@@ Coverage Diff @@
## master #462 +/- ##
===========================================
+ Coverage 72.94% 73.1% +0.16%
- Complexity 2525 2535 +10
===========================================
Files 432 432
Lines 10191 10204 +13
Branches 608 610 +2
===========================================
+ Hits 7434 7460 +26
+ Misses 2587 2573 -14
- Partials 170 171 +1 |
This PR fixes
Stringifiers.toString(...)
throwing an exception on receiving anenum
value.The
enum
values were not supported because theEnumStringifier
was actually abstract and was intended for inheritance only. It was done so because theEnumStringifier
is aSerializableStringifier
and all serializable stringifiers are persisted as singletons. But it's impossible to persist an arbitrary enum stringifier as a singleton.This PR makes an
EnumStringifier
a concrete class which is still aSerializableStringifier
but is not persisted as a singleton (but rather as an ordinary serializable object).