On Mon, 31 Oct 2022 22:00:01 GMT, Phil Race <p...@openjdk.org> wrote:

> Deprecate URL constructors. Developers are encouraged to use java.net.URI to 
> parse or construct any URL. ... To construct a URL, using URI::toURL should 
> be preferred.
> 
> You have jumped through some refactoring hoops to be able to apply the 
> deprecation suppression to as little code as possible .. having made such 
> changes, then why didn't you just make the recommended change instead ?
> 
> Should I presume that the recommended route will have some nasty little 
> incompatibilities we will need to be careful of first ?

Possibly yes. Using URI where it was not used before might cause some 
behavioral changes, that would need to be examined and possibly documented 
through separate CSRs. This is better handled on a case-by-case basis
for each area affected. The changes as currently proposed will not lead to any 
behavioral difference.

> 
> And what about Peter Firmstone's comment "We stopped using java.net.URI some 
> years ago as it's obsolete.?"
> 
> I can't reconcile that with the recommendation to use it ..

URI implements RFC 2396 with some deviations, noted in its API documentation, 
which make it a crossbreed between RFC 2396 and RFC 3986. As Alan noted 
earlier, changing URI to strictly implement RFC 3986 is not a compatible move: 
it was attempted in JDK 6 but had to backed out quickly as it caused widespread 
breakage. But even if it doesn't implement the latest RFC strictly, it's still 
a much more modern API and implementation than java.net.URL.

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

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

Reply via email to