-
Notifications
You must be signed in to change notification settings - Fork 38.3k
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
impl: HttpHeaders.backedBy and HttpHeaders.copyOf to reduce ambiguity… #34341
base: main
Are you sure you want to change the base?
impl: HttpHeaders.backedBy and HttpHeaders.copyOf to reduce ambiguity… #34341
Conversation
b768ad8
to
5b57c5f
Compare
5b57c5f
to
142b970
Compare
assertThat(readOnly.getContentType()) | ||
.describedAs("readOnly HttpHeaders should NOT have updated content-type value") | ||
.isEqualTo(MediaType.APPLICATION_JSON); | ||
assertThat(writable.getContentType()) | ||
.describedAs("writable HttpHeaders should have updated content-type value") | ||
.isEqualTo(MediaType.TEXT_PLAIN); | ||
assertThat(headers.getContentType()) | ||
.describedAs("initial HttpHeaders should have updated content-type value") | ||
.isEqualTo(MediaType.TEXT_PLAIN); |
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.
I think these assertions point out the confusing behavior of getting a read-only copy and then a writable copy that changes the underlying map through the read-only instance.
Picking comments from the related issue in #34340
This behavior is well documented in the Javadoc. We can always refine it, feel free to suggest changes in this PR.
You're right. This came from the fact that
We have already made some changes in #33913 to align the behavior and expectations; we've seen that while those changes are useful they already create some friction for the 7.0 upgrade. I don't think we should spend more upgrade pain budget on something like this. I think that Note: we recently switched to using a DCO for contributions. Could you squash your commits into one and sign them with |
75f700a
to
c2f0b10
Compare
Maybe I need to be educated a little. |
c2f0b10
to
942dba2
Compare
Deprecating a method sends a signal to the community: you should adapt for a future removal. We do use deprecations and removals, we just try to not ask too much from our community when they upgrade. Here we have fixed already the collection contract of HttpHeaders and we have experienced already some disruption in other Spring projects as a result. Deprecating these constructors is mainly for consistency, so I am not sure this is wise to do this now. Maybe later? Here is an example of feedback we get when we deprecate something: #33934 (comment) |
f32dca1
to
f0861cd
Compare
… on the constructor. chore: Update constructor references with backedBy method. chore: Remove `@Deprecated` annotations. Fixes spring-projects#34340 Signed-off-by: Bryce J. Fisher <[email protected]>
f0861cd
to
0194158
Compare
Understood. You've convinced me. |
… on the constructor.
Fixes #34340