Skip to content

Commit

Permalink
Fix for vojtechhabarta#172 - Handling empty @JsonTypeName() correctly.
Browse files Browse the repository at this point in the history
  • Loading branch information
Yona Appletree committed Sep 18, 2017
1 parent 880608f commit ce03e9e
Show file tree
Hide file tree
Showing 2 changed files with 2 additions and 1 deletion.
Original file line number Diff line number Diff line change
Expand Up @@ -170,7 +170,7 @@ private String getDiscriminantPropertyName(JsonTypeInfo jsonTypeInfo) {
private String getTypeName(final Class<?> cls) {
// find @JsonTypeName recursively
final JsonTypeName jsonTypeName = getAnnotationRecursive(cls, JsonTypeName.class);
if (jsonTypeName != null) {
if (jsonTypeName != null && ! jsonTypeName.value().isEmpty()) {
return jsonTypeName.value();
}
// find @JsonSubTypes.Type recursively
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -89,6 +89,7 @@ private static interface ParentWithNameDiscriminant {
@JsonTypeName("explicit-name1")
private static class SubTypeDiscriminatedByName1 implements ParentWithNameDiscriminant {
}
@JsonTypeName(/* Default should be the simplename of the class */)
private static class SubTypeDiscriminatedByName2 implements ParentWithNameDiscriminant {
}
private static class SubTypeDiscriminatedByName3 implements ParentWithNameDiscriminant {
Expand Down

0 comments on commit ce03e9e

Please sign in to comment.