-
Notifications
You must be signed in to change notification settings - Fork 55
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
fix(engine): don't check for @JsonCreator
annotation and only take @JsonValue
into account
#3097
base: main
Are you sure you want to change the base?
Conversation
Codecov ReportAll modified and coverable lines are covered by tests ✅
Additional details and impacted files@@ Coverage Diff @@
## main #3097 +/- ##
=======================================
Coverage 92.60% 92.60%
=======================================
Files 85 85
Lines 3164 3164
Branches 775 775
=======================================
Hits 2930 2930
Misses 183 183
Partials 51 51
Flags with carried forward coverage won't be shown. Click here to find out more. ☔ View full report in Codecov by Sentry. |
A use case for |
While testing some possible use cases, I realized that public class Email {
private final String email;
public Email(String email) {
this.email = email;
}
@JsonValue
public String getEmail() {
return email;
}
@Override
public String toString() {
return email;
}
} So we should probably just look at |
This version handles both serialization formats correctly (just comment out public class Email {
private String email;
public Email() {}
public Email(String email) {
this.email = email;
}
@JsonValue
public String getEmail() {
return email;
}
public void setEmail(String email) {
this.email = email;
}
@Override
public String toString() {
return email;
}
} |
Sounds like it would make sense to only look for |
Exactly. So I propose to:
|
Makes sense though the cherry pick should be done only if we're over 99.99% certain that it will always be backwards compatible. |
I proposed to cherry-pick since the user who reported on the forum cannot upgrade from 24.5 to 24.6 due to this. |
JsonValue
and JsonCreator
to be generated@JsonCreator
annotation and only take @JsonValue
into account
Quality Gate passedIssues Measures |
As explained in the discussion below, there are use cases for
@JsonValue
use without@JsonCreator
. As the former is needed to create a domain object, it's easier to only check for that one and assume that the user has taken deserialization into account, by using the latter or another means like a constructor.Closes #3095.
This could be cherry-picked to
24.6
(see forum post linked in the issue).