APIs should be added that manipulate filename extensions.
There is a long history, but most recently the Path::getExtension API was added by JDK-8057113, a modification was proposed by JDK-8297814, and it was removed from JDK 20 by JDK-8298303 because changes were happening at the last minute. This RFE covers re-addition of the Path::getExtension API and a possible new and complementary API.
The Path::getExtension API as discussed in JDK-8297814 should be added pretty much as it was. Background and rationale is discussed in that bug report.
Investigation of use cases in support of that API revealed that a common operation is to remove the extension from a filename. A complementary API, for example named removeExtension(), could be added. This would use the exact same definition of extension as getExtension(), except that it would remove the extension instead of returning it. This is useful for cases where an application wants to replace a filename extension with a different one, or cases where an application wants to insert some unique value between the filename stem and its extension.
The invariant would be: concatenating the result of removeExtension() with getExtension() should equal the string form of Path::getFileName(), assuming the latter returns non-null.