-
Notifications
You must be signed in to change notification settings - Fork 38.3k
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Avoid use of java.net.URL
constructors
#29481
Comments
This turns out to be rather involved due to the differences between URI and URL rules and the restricted behavior of the |
With a combination of URI construction from a cleaned path and subsequent defensive URL conversion, all our tests pass. This is still rather involved but seems to be equivalent for our common purposes now. Corresponding code is available in |
Update: added a section with additional resources regarding changes in behavior in URL constructors beginning with Java 20. |
Overview
Since all
URL
constructors are deprecated starting with Java 20, we should stop using them in order to allow Spring Framework to be built using Java 20.In addition, the rationale for deprecating those constructors (which is more important than the actual deprecation) is applicable today.
For full details, see the Constructing instances of URL section of the
URL
Javadoc. The API Note also provides valuable advice regarding correct usage ofFile
,Path
,URI
, andURL
.Additional Resources
The text was updated successfully, but these errors were encountered: