RFR: 8298318: (fs) APIs for handling filename extensions [v8]

Roger Riggs rriggs at openjdk.org
Mon Apr 1 14:22:38 UTC 2024


On Wed, 13 Mar 2024 23:12:50 GMT, Brian Burkhalter <bpb at openjdk.org> wrote:

>> Add to `java.nio.file.Path` a method `getExtension` to retrieve the `Path`'s extension, and companion methods `removeExtension` and `addExtension`.
>
> Brian Burkhalter has updated the pull request incrementally with one additional commit since the last revision:
> 
>   8298318: Add parameter checks for withExtension

A couple of points toward simplicity...
- the API needs to be intuitive and avoid system dependencies; a developer should not have to anticipate how the behavior is different on different operating systems; we used to call this write-once-run-anywhere; its still a good feature of most APIs. Especially, when it covers all of the common use cases.
- the use of Optional creates additional complexity that the developer has to code around; what could be a two state result becomes three.

-------------

PR Comment: https://git.openjdk.org/jdk/pull/16226#issuecomment-2029833942


More information about the nio-dev mailing list