Skip to content
This repository was archived by the owner on Feb 26, 2023. It is now read-only.

Conversation

@WonderCsabo
Copy link
Member

Generic response class is natively supported in Spring for Android 2.0. This change utilizes that support, if it is available and the reponse class is generic. It falls back to the old implementation otherwise.

Unfortunetaly there is no way to add this to the compile or functional tests.

Related to #1440.

Generic response class is natively supported in Spring for Android 2.0.
This commit utilize that support, if it is available in the reponse
class is generic. It falls back to the old implementation otherwise.
@WonderCsabo WonderCsabo force-pushed the 1440_restParameterizedTypeReference branch from 49c284d to 2507b1e Compare September 11, 2015 10:36
@WonderCsabo
Copy link
Member Author

Unfortunately this does not work for multiple reasons:

  • there are too much cases and i did not figure out how to handle them with both ParameterizedTypeReference and the old way
  • CodeModel import generation is buggy with generic anonymous classes

However i am leaving this branch if anybody wants to continue.

@dodgex
Copy link
Member

dodgex commented Sep 11, 2015

might this #1489 help for the second point?

@WonderCsabo
Copy link
Member Author

Yeah, i also thought about that. But i am stranded about the first. :(

@dodgex
Copy link
Member

dodgex commented Sep 11, 2015

could you elaborate on the issue? what cases do you mean? maybe we can find a solution together :)

@WonderCsabo
Copy link
Member Author

Thanks for helping out! I really appreciate that.

In this class, there are lots of cases when arrays and generics are used together. There are two problems with my solution:

  • for one of the cases i generate this List<Event>[].class, which is invalid
  • i think the ParameterizedTypeReference is still not used in some cases where it could be

You can check out this branch and see for yourself. You have to upgrade the Spring Android version in the POM to 2.0.0.M2, and also have to add the Spring repo:

<repositories>
    <repository>
        <id>spring-milestones</id>
        <name>Spring Milestones</name>
        <url>http://repo.spring.io/milestone</url>
    </repository>
</repositories>

@dodgex
Copy link
Member

dodgex commented Sep 11, 2015

I'll try to take a look on it this weekend.

Copy link
Member

Choose a reason for hiding this comment

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

shouldnt the expectedType be declaredType? if not you should remove the unused variable declaredType.

@dodgex
Copy link
Member

dodgex commented Sep 13, 2015

@WonderCsabo
Copy link
Member Author

Good job! Let's open a PR. However, we cannot merge that yet, since the List importing problem is still here. I really hope switching to phax/jcodemodel will solve that.

@dodgex
Copy link
Member

dodgex commented Sep 13, 2015

shall i open the PR from my branch?

@WonderCsabo
Copy link
Member Author

Yes, please, so until that other people can comment.

Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants