Skip to content

Conversation

dmitrykuzmin
Copy link
Contributor

@dmitrykuzmin dmitrykuzmin commented Aug 23, 2019

This PR fixes Stringifiers.toString(...) throwing an exception on receiving an enum value.

The enum values were not supported because the EnumStringifier was actually abstract and was intended for inheritance only. It was done so because the EnumStringifier is a SerializableStringifier 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 a SerializableStringifier but is not persisted as a singleton (but rather as an ordinary serializable object).

@dmitrykuzmin dmitrykuzmin self-assigned this Aug 23, 2019
@dmitrykuzmin dmitrykuzmin requested a review from armiol August 23, 2019 17:08
@dmitrykuzmin
Copy link
Contributor Author

@armiol PTAL.

Copy link
Collaborator

@armiol armiol left a 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")
Copy link
Collaborator

Choose a reason for hiding this comment

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

an enum class.

@codecov
Copy link

codecov bot commented Aug 28, 2019

Codecov Report

Merging #462 into master will increase coverage by 0.16%.
The diff coverage is 77.27%.

@@             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

@dmitrykuzmin dmitrykuzmin merged commit 3dab5ba into master Aug 28, 2019
@dmitrykuzmin dmitrykuzmin deleted the fix-stringifiers branch August 28, 2019 17:20
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants