-
Notifications
You must be signed in to change notification settings - Fork 1.9k
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
Allow decoding of parameterizedTypes (generics) Fixes #759 #758
Conversation
@@ -69,6 +70,10 @@ public Object decode(Response response, Type type) throws IOException { | |||
return Util.emptyValueOf(type); | |||
if (response.body() == null) | |||
return null; | |||
while (type instanceof ParameterizedType) { | |||
ParameterizedType ptype = (ParameterizedType) type; |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Would be nice to have a test covering this loop
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
test added
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Sweet, thanks! I will review it right now
3bd8d4b
to
3aec1a5
Compare
@velo Added a test and reformatted using eclipse formatter |
3aec1a5
to
1a68eb7
Compare
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Look good, minor code format...
.hasBody( | ||
"<?xml version=\"1.0\" encoding=\"UTF-8\" " | ||
+ | ||
"standalone=\"yes\"?><mockObject xsi:noNamespaceSchemaLocation=\"http://apihost/schema.xsd\" " |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
could you add the +
sign in front of the string?
+ "standalone=\"yes\"?><mockObject xsi:noNamespaceSchemaLocation=\"http://apihost/schema.xsd\" "
+ "xmlns:xsi=\"http://www.w3.org/2001/XMLSchema-instance\">"
+ "<value>Test</value></mockObject>"
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I used the eclipse formatter on the file before uploading. Can that change be added to the formatting file?
73a095b
to
444c298
Compare
@velo something is off with the Travis build for this PR. It succeeded for JDK8 but not for JDK11. Can you take a look? |
444c298
to
968b4e9
Compare
build failure seems like a fluke, sent a small amend to kick the build |
If type is a parameterizedType then extract rawType before proceeding with decoding instead of Trowing an exception