Skip to content

Allow decoding of parameterizedTypes (generics) Fixes #759 - #758

Merged
kdavisk6 merged 2 commits into
OpenFeign:masterfrom
RicardoRdzG:JAXB-Generic-decoding
Aug 12, 2018
Merged

kdavisk6 merged 2 commits into
OpenFeign:masterfrom
RicardoRdzG:JAXB-Generic-decoding

Conversation

@RicardoRdzG

Copy link
Copy Markdown
Contributor

If type is a parameterizedType then extract rawType before proceeding with decoding instead of Trowing an exception

if (response.body() == null)
return null;
while (type instanceof ParameterizedType) {
ParameterizedType ptype = (ParameterizedType) type;

Copy link
Copy Markdown
Member

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

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

test added

Copy link
Copy Markdown
Member

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

@RicardoRdzG RicardoRdzG closed this Aug 9, 2018
@RicardoRdzG RicardoRdzG reopened this Aug 9, 2018
@RicardoRdzG
RicardoRdzG force-pushed the JAXB-Generic-decoding branch from 3bd8d4b to 3aec1a5 Compare August 9, 2018 19:55
@RicardoRdzG

Copy link
Copy Markdown
Contributor Author

@velo Added a test and reformatted using eclipse formatter

@RicardoRdzG RicardoRdzG changed the title Allow decoding of parameterizedTypes (generics) Allow decoding of parameterizedTypes (generics) Fixes #759 Aug 9, 2018
@RicardoRdzG
RicardoRdzG force-pushed the JAXB-Generic-decoding branch from 3aec1a5 to 1a68eb7 Compare August 9, 2018 20:09

@velo velo left a comment

Copy link
Copy Markdown
Member

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\" "

Copy link
Copy Markdown
Member

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>"

Copy link
Copy Markdown
Contributor Author

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?

@RicardoRdzG
RicardoRdzG force-pushed the JAXB-Generic-decoding branch 2 times, most recently from 73a095b to 444c298 Compare August 10, 2018 00:37
@kdavisk6

Copy link
Copy Markdown
Member

@velo something is off with the Travis build for this PR. It succeeded for JDK8 but not for JDK11. Can you take a look?

@kdavisk6 kdavisk6 added this to the 10.0.0 milestone Aug 10, 2018
@RicardoRdzG
RicardoRdzG force-pushed the JAXB-Generic-decoding branch from 444c298 to 968b4e9 Compare August 10, 2018 15:47
@RicardoRdzG

Copy link
Copy Markdown
Contributor Author

build failure seems like a fluke, sent a small amend to kick the build

@kdavisk6 kdavisk6 added the bug Unexpected or incorrect behavior label Aug 12, 2018
@kdavisk6
kdavisk6 merged commit e4743d4 into OpenFeign:master Aug 12, 2018
velo pushed a commit that referenced this pull request Oct 7, 2024
* Allow decoding of parameterizedTypes (generics)

* Allow decoding of parameterizedTypes (generics)
velo pushed a commit that referenced this pull request Oct 8, 2024
* Allow decoding of parameterizedTypes (generics)

* Allow decoding of parameterizedTypes (generics)
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

bug Unexpected or incorrect behavior

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants