Can we deprecate Path.endsWith(String)?
Pavel Rappo
pavel.rappo at gmail.com
Thu Sep 18 21:12:31 UTC 2025
On Thu, Sep 18, 2025 at 7:08 PM Brian Burkhalter
<brian.burkhalter at oracle.com> wrote:
<snip>
> I have filed an issue to improve the specification of this method somehow:
>
> https://bugs.openjdk.org/browse/JDK-8368007
>
Personally, a better spec wouldn't have helped me avoid the trap. The
spec is already clear. I think it's the combination of the method's
name and the argument type that is misleading.
I think I learned about this method by scrolling autocompletion
suggestions in my IDE. The method seemed to fit my need exactly. Of
course, I quickly learned that I was wrong, but somehow kept falling
into the same trap. Not sure how representative my experience in this
case is, though.
Deprecation would flag the method in the IDE and help avoid the trap.
But eventually, it would be good to also have the file extension
functionality.
More information about the core-libs-dev
mailing list