Skip to content

Avoid unnecessary Map wrapping in DefaultPathSegment#27063

Closed
Dunemaster wants to merge 2 commits into
spring-projects:mainfrom
Dunemaster:avoidUnessaryWrappings
Closed

Avoid unnecessary Map wrapping in DefaultPathSegment#27063
Dunemaster wants to merge 2 commits into
spring-projects:mainfrom
Dunemaster:avoidUnessaryWrappings

Conversation

@Dunemaster

Copy link
Copy Markdown

Avoid creating unnessary wrapper for empty map in DefaultPathSegment

@spring-projects-issues spring-projects-issues added the status: waiting-for-triage An issue we've not yet triaged or decided on label Jun 15, 2021
@sbrannen sbrannen self-assigned this Jun 15, 2021
@sbrannen sbrannen added the in: web Issues in web modules (web, webmvc, webflux, websocket) label Jun 15, 2021
@sbrannen sbrannen changed the title Avoid unessary wrappings Avoid unnecessary Map wrapping in DefaultPathSegment Jun 15, 2021
@sbrannen sbrannen added this to the 5.3.9 milestone Jun 15, 2021
@sbrannen sbrannen added type: bug A general bug and removed status: waiting-for-triage An issue we've not yet triaged or decided on labels Jun 15, 2021
@sbrannen sbrannen changed the title Avoid unnecessary Map wrapping in DefaultPathSegment DefaultPathSegment allows shared empty map to be mutated Jun 15, 2021
@sbrannen

sbrannen commented Jun 15, 2021

Copy link
Copy Markdown
Member

Thanks for the PR!

It turns out that your proposal introduces a bug, which in turn made me notice an existing bug.

Namely, any map returned by PathSegment#parameters() must be immutable, and this includes the shared empty map (EMPTY_PARAMS).

@sbrannen sbrannen marked this pull request as draft June 15, 2021 12:37
@sbrannen sbrannen removed this from the 5.3.9 milestone Jun 15, 2021
@sbrannen sbrannen added status: declined A suggestion or change that we don't feel we should currently apply type: enhancement A general enhancement status: superseded An issue that has been superseded by another and removed type: bug A general bug labels Jun 15, 2021
@sbrannen

Copy link
Copy Markdown
Member

Superseded by #27064

@sbrannen sbrannen closed this Jun 15, 2021
@sbrannen sbrannen changed the title DefaultPathSegment allows shared empty map to be mutated Avoid unnecessary Map wrapping in DefaultPathSegment Jun 15, 2021
@snicoll snicoll removed the status: superseded An issue that has been superseded by another label Jun 15, 2021
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

in: web Issues in web modules (web, webmvc, webflux, websocket) status: declined A suggestion or change that we don't feel we should currently apply type: enhancement A general enhancement

Projects

None yet

Development

Successfully merging this pull request may close these issues.

4 participants