Can we deprecate Path.endsWith(String)?

Brian Burkhalter brian.burkhalter at oracle.com
Wed Sep 10 20:38:48 UTC 2025


Hello David,

On Sep 10, 2025, at 1:28 PM, David Alayachew <davidalayachew at gmail.com> wrote:

Yes exactly.

And I'm not trying to say that the method is underspecified -- the javadoc is fairly clear.

I'm merely saying that this overload adds little value, while being a tripping hazard for those thinking the name describes the obvious.

So, I'd like to deprecate the overload. Those who want the overload, just use the suggestion in the javadocs.

There are a number of methods in Path which are the same except for String- vs. Path-valued parameters. I’m not sure we’d want to deprecate just this one although I do see your point. Perhaps some additional disambiguating verbiage in the endsWith(String) specification would help?

Brian
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <https://mail.openjdk.org/pipermail/core-libs-dev/attachments/20250910/5c192acc/attachment-0001.htm>


More information about the core-libs-dev mailing list