RFR: 8057113: (fs) Path should have a method to obtain the filename extension [v15]

Brian Burkhalter bpb at openjdk.org
Thu Jul 28 23:14:45 UTC 2022


On Thu, 28 Jul 2022 16:41:27 GMT, Brian Burkhalter <bpb at openjdk.org> wrote:

>> src/java.base/share/classes/java/nio/file/Path.java line 264:
>> 
>>> 262:      * representation of the file name after the last dot ('.'). All leading
>>> 263:      * dots are ignored. If the extension is missing, then an
>>> 264:      * {@link String#isEmpty() empty} {@code String} ({@code ""}) is returned.
>> 
>> Don’t you mean to say here that if the extension is missing then `null` is returned? That’s what the `@return` tag below implies, and that’s what would be most useful.
>
> Yes, that is what it should be. This was translated incorrectly from the previous version returning `Optional<String>`.

Fixed in 8a4a4bc6fc41453d9480a5eba0a8f227dd7ceadc.

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

PR: https://git.openjdk.org/jdk/pull/8066


More information about the nio-dev mailing list