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

Brian Burkhalter bpb at openjdk.org
Thu Jul 28 16:43:43 UTC 2022


On Thu, 28 Jul 2022 16:29:02 GMT, Mark Reinhold <mr at openjdk.org> wrote:

>> Brian Burkhalter has updated the pull request incrementally with one additional commit since the last revision:
>> 
>>   8057113: Correct length 2 case; update test cases
>
> 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>`.

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

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


More information about the nio-dev mailing list