Java 17 depends on DNS lookups for hashing a web URL
twitter.com
twitter.com
java.net.URL was introduced in Java 1.0, the very first public release of Java back in 1996.
In 2001, Java 1.4 included a new class java.net.URI that addressed this and other improvements.
Since then, it is well known by average experienced Java developers to a) read javadocs, b) not use URL class, and c) use URI.
It's been 19 years this problem has been fixed.
As to why not remove it, I'd suggest to dig through the OpenJDK mailing list.
Hint: same reasons java.util.Date, and java.util.Vector are still there.
P.S. not trying to flame here.
so im looking here https://docs.oracle.com/en/java/javase/17/docs/api/java.base... and I couldnt see any place where it is specifically recommended to NOT use java.net.url and instead use java.net.URI
thinking from the perspective of someone new to Java.
Also when i search for "java url class" on Google...i only see java.net.url
Given a bunch of URL's, they may have a colliding hashcode just because they resolve to the same IP address. For example because they are all cloudflare websites that resolve to the same cloudflare endpoint.
https://github.com/AndroidSDKSources/android-sdk-sources-for...
I got this from an earlier HN post. Apparently it’s a relic of old Java and they can’t change it for some compatibility reason (?)
In this case, I do see it probably moving to behind some configuration flag at some point.