Skip to content

Conversation

@kilink
Copy link
Contributor

@kilink kilink commented Jan 28, 2026

Use helpers from java.nio.file.Files for some methods in FileCopyUtils.

Additionally, add unit tests for the various file-related methods.

Use helpers from java.nio.file.Files for some methods in FileCopyUtils.

Additionally, add unit tests for the various file-related methods.

Signed-off-by: Patrick Strawderman <pstrawderman@netflix.com>
@kilink kilink force-pushed the file-copy-utils-jdk-files-util branch from ff2628b to ffd8f2e Compare January 28, 2026 16:16
@spring-projects-issues spring-projects-issues added the status: waiting-for-triage An issue we've not yet triaged or decided on label Jan 28, 2026
@jhoeller jhoeller self-assigned this Jan 28, 2026
@jhoeller jhoeller added in: core Issues in core modules (aop, beans, core, context, expression) type: enhancement A general enhancement and removed status: waiting-for-triage An issue we've not yet triaged or decided on labels Jan 28, 2026
@jhoeller jhoeller added this to the 7.0.4 milestone Jan 28, 2026
@jhoeller jhoeller merged commit bf53867 into spring-projects:main Jan 28, 2026
5 checks passed
@bclozel
Copy link
Member

bclozel commented Jan 28, 2026

@jhoeller should we deprecate some of those utility methods as a result? We've done that in the past when Java upgrades turn those into one-liners.

@jhoeller
Copy link
Contributor

For completeness, I've also applied consistent stream closing through try-with-resources in #36223 and aligned 6.2.16 in #36224.

As for deprecating some methods, most of them do not provide much additional anymore indeed. However, they are quite old and potentially called from many parts of the ecosystem, so I'd rather leave them in place - not least of it all, for their consistent closing of streams in FileCopyUtils and the flushing after copying in StreamUtils (which some callers may effectively rely on).

FWIW, once we have a JDK 25 baseline, we can use Reader#readAllAsString in our FileCopyUtils#copyToString implementation.

@kilink kilink deleted the file-copy-utils-jdk-files-util branch January 28, 2026 21:50
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

in: core Issues in core modules (aop, beans, core, context, expression) type: enhancement A general enhancement

Projects

None yet

Development

Successfully merging this pull request may close these issues.

4 participants