On 1/14/2026 8:15 AM, Alan Bateman wrote:
On 13/01/2026 20:13, Anthony Vanelverdinghe wrote:
There are 3 questions:
(1) should we deprecate `Path::startsWith(String)`?
(2) should we deprecate `Path::endsWith(String)`?
(3) should we add a file extension API?
The "plan" is to deprecate startsWith(String) and endsWith(String),
and to reboot the effort to add the file extension API.
-Alan
Just for the record, emptying my bag of arguments:
Google's Error Prone has a whole catalog of bug patterns, including
confusing Java SE APIs. Shall we deprecate all of those as well then?
And note that it does *not* have a bug pattern for
`Path::{starts,ends}With`. So nobody at Google ever bothered to add it.
And nobody outside Google ever bothered to file an issue to add it.
(Same for SonarQube, SpotBugs, or FindBugs: no pattern for this.)
Virtually every Java developer has made the mistake of using
`Thread.sleep(5)` to mean "sleep 5 seconds" (which is the behavior in
pretty much every shell). So why are we not deprecating that method then?
Even `String::endsWith(String)` itself is confusing, since some people
assume its argument is a regex (as with some other String methods like
`matches`) [1]. So why not e.g., replace `String::matches(String)` with
`String::matches(Pattern)`?
[1]
https://stackoverflow.com/questions/9943609/checking-if-string-ends-with-something-with-java-regex
Anthony