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

Anthony Vanelverdinghe duke at openjdk.org
Mon Apr 1 21:02:02 UTC 2024


On Mon, 1 Apr 2024 14:20:23 GMT, Roger Riggs <rriggs at openjdk.org> wrote:

> A couple of points toward simplicity...

Obviously I'm unable to get my arguments across, so let's agree to disagree.

> * 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.

We're all in favor of intuitive APIs, we just have different definitions of "intuitive". In my opinion, an intuitive file extension API would work like `System.lineSeparator()`, where the result differs on different OSes, but is the intuitive response on any given OS.

> * the use of Optional creates additional complexity that the developer has to code around; what could be a two state result becomes three.

None of my API proposals used `Optional` to return file extensions, so we agree that introducing `Optional` would be suboptimal.

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

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


More information about the nio-dev mailing list