Skip to content
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

java 20 / 21 - constructor URL(String!) is deprecated #626

Open
wavedeck opened this issue Sep 14, 2024 · 0 comments · May be fixed by #627
Open

java 20 / 21 - constructor URL(String!) is deprecated #626

wavedeck opened this issue Sep 14, 2024 · 0 comments · May be fixed by #627

Comments

@wavedeck
Copy link

wavedeck commented Sep 14, 2024

I was trying to locally build grpc-kotlin because v1.4.2 didn't release yet on maven central repository but i wanted to test it.
while I did, I have noticed that gradle logged a warning during the first sync that using java.net.URL(string) was deprecated.

As i have tracked down the source of this deprecation warning, i noticed that it is coming from the build.gradle.kts of the stub sub-project. Apparently, java.net.URL was deprecated in Java 20, which is the reason i got this warning when trying to build it using the latest LTS release (21.0.4)

I have researched the deprecation warning as it was documented and deemed as unsafe on the Java 21 specification.

The easy and straight forward fix is to replace java.net.URL(string) with java.net.URI(string).toURL() in the gradle project file for the stub sub-project.

This change has no effect on the functionality or backwards compatibility as .toURL() already existed back in Java 8

@wavedeck wavedeck linked a pull request Sep 14, 2024 that will close this issue
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging a pull request may close this issue.

1 participant