Skip to content

Replace Collections.unmodifiableList(new ArrayList(..)) with List.copyOf() #30166

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

Merged
merged 5 commits into from
Apr 12, 2023

Conversation

ssang1105
Copy link
Contributor

This PR replaces Collections.unmodifiableList() with List.copyOf().
It creates a new immutable list by copying the elements of the given list.
Using List.copyOf() results in more readable and prevents unexpected bugs, and makes the code easier to maintain.

@pivotal-cla
Copy link

@ssang1105 Please sign the Contributor License Agreement!

Click here to manually synchronize the status of this Pull Request.

See the FAQ for frequently asked questions.

@spring-projects-issues spring-projects-issues added the status: waiting-for-triage An issue we've not yet triaged or decided on label Mar 22, 2023
@pivotal-cla
Copy link

@ssang1105 Thank you for signing the Contributor License Agreement!

@rstoyanchev rstoyanchev changed the title replace unmodifiableList to copyOf Replace Collections.unmodifiableList(new ArrayList(..)) with List.copyOf() Mar 27, 2023
@rstoyanchev rstoyanchev added the in: web Issues in web modules (web, webmvc, webflux, websocket) label Mar 27, 2023
@rstoyanchev rstoyanchev added this to the 6.0.8 milestone Mar 27, 2023
@rstoyanchev rstoyanchev added the type: enhancement A general enhancement label Mar 27, 2023
Copy link
Contributor

@rstoyanchev rstoyanchev left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

There is one more such case in DefaultMetadataExtractor.

@ssang1105
Copy link
Contributor Author

@rstoyanchev I found and fix it

@sbrannen sbrannen removed the status: waiting-for-triage An issue we've not yet triaged or decided on label Apr 4, 2023
@jhoeller jhoeller self-assigned this Apr 11, 2023
@jhoeller jhoeller merged commit 59c65fa into spring-projects:main Apr 12, 2023
@ssang1105 ssang1105 deleted the feature/modify branch April 12, 2023 15:11
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) type: enhancement A general enhancement
Projects
None yet
Development

Successfully merging this pull request may close these issues.

6 participants