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

Remove reflection warning caused by overloads introduced by Java 10 #43

Closed
wants to merge 1 commit into from
Closed

Remove reflection warning caused by overloads introduced by Java 10 #43

wants to merge 1 commit into from

Conversation

kassapo
Copy link

@kassapo kassapo commented Aug 9, 2018

Java 10 added an overload with a Charset as second argument for these
methods:

java.net.URLEncoder.encode(java.lang.String, java.lang.String)
java.net.URLEncoder.encode(java.lang.String, java.nio.charset.Charset)

java.net.URLDecoder.decode(java.lang.String, java.lang.String)
java.net.URLDecoder.decode(java.lang.String, java.nio.charset.Charset)

My change removes the reflection warning by casting both arguments to
String in the #+clj case trusting that clojure prefers the String
variant.

Please note the asymmetry in the implementation of url-encode which
calls str on the first argument and url-decode which does not.

Java 10 added an overload with a Charset as second argument for these
methods:

 java.net.URLEncoder.encode(java.lang.String, java.lang.String)
 java.net.URLEncoder.encode(java.lang.String, java.nio.charset.Charset)

 java.net.URLDecoder.decode(java.lang.String, java.lang.String)
 java.net.URLDecoder.decode(java.lang.String, java.nio.charset.Charset)

My change removes the reflection warning by casting both arguments to
String in the #+clj case trusting that clojure prefers the String
variant.

Please note the asymmetry in the implementation of url-encode which
calls str on the first argument and url-decode which does not.
@ptaoussanis
Copy link
Member

Thanks Ulrich, merging manually!

ptaoussanis pushed a commit that referenced this pull request Aug 10, 2018
…a 10 (@kassapo)

Java 10 added an overload with a Charset as second argument for these
methods:

 java.net.URLEncoder.encode(java.lang.String, java.lang.String)
 java.net.URLEncoder.encode(java.lang.String, java.nio.charset.Charset)

 java.net.URLDecoder.decode(java.lang.String, java.lang.String)
 java.net.URLDecoder.decode(java.lang.String, java.nio.charset.Charset)

My change removes the reflection warning by casting both arguments to
String in the #+clj case trusting that clojure prefers the String
variant.
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 this pull request may close these issues.

2 participants