Skip to content

Commit

Permalink
Fix reflection registration issue with Jackson's @JsonSerialize & @Js…
Browse files Browse the repository at this point in the history
…onDeserialize

This is a follow up to PR quarkusio#12387.

It registers the rest of the “using” options (`keyUsing`, `contentUsing`, `nullsUsing`) for both `@JsonSerialize` and `@JsonDeserialize`
  • Loading branch information
kdubb committed May 6, 2021
1 parent 8de7953 commit 446b214
Showing 1 changed file with 25 additions and 0 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -135,6 +135,16 @@ void register(
// the Deserializers are constructed internally by Jackson using a no-args constructor
reflectiveClass.produce(new ReflectiveClassBuildItem(false, false, usingValue.asClass().name().toString()));
}
AnnotationValue keyUsingValue = deserializeInstance.value("keyUsing");
if (keyUsingValue != null) {
// the Deserializers are constructed internally by Jackson using a no-args constructor
reflectiveClass.produce(new ReflectiveClassBuildItem(false, false, keyUsingValue.asClass().name().toString()));
}
AnnotationValue contentUsingValue = deserializeInstance.value("contentUsing");
if (contentUsingValue != null) {
// the Deserializers are constructed internally by Jackson using a no-args constructor
reflectiveClass.produce(new ReflectiveClassBuildItem(false, false, contentUsingValue.asClass().name().toString()));
}
}

// handle the various @JsonSerialize cases
Expand All @@ -144,6 +154,21 @@ void register(
// the Serializers are constructed internally by Jackson using a no-args constructor
reflectiveClass.produce(new ReflectiveClassBuildItem(false, false, usingValue.asClass().name().toString()));
}
AnnotationValue keyUsingValue = serializeInstance.value("keyUsing");
if (keyUsingValue != null) {
// the Deserializers are constructed internally by Jackson using a no-args constructor
reflectiveClass.produce(new ReflectiveClassBuildItem(false, false, keyUsingValue.asClass().name().toString()));
}
AnnotationValue contentUsingValue = serializeInstance.value("contentUsing");
if (contentUsingValue != null) {
// the Deserializers are constructed internally by Jackson using a no-args constructor
reflectiveClass.produce(new ReflectiveClassBuildItem(false, false, contentUsingValue.asClass().name().toString()));
}
AnnotationValue nullsUsingValue = serializeInstance.value("nullsUsing");
if (nullsUsingValue != null) {
// the Deserializers are constructed internally by Jackson using a no-args constructor
reflectiveClass.produce(new ReflectiveClassBuildItem(false, false, nullsUsingValue.asClass().name().toString()));
}
}

// make sure we register the constructors and methods marked with @JsonCreator for reflection
Expand Down

0 comments on commit 446b214

Please sign in to comment.