Skip to content

Navigation Menu

Sign in
Appearance settings

Search code, repositories, users, issues, pull requests...

Provide feedback

We read every piece of feedback, and take your input very seriously.

Saved searches

Use saved searches to filter your results more quickly

Appearance settings
This repository was archived by the owner on Feb 26, 2023. It is now read-only.

Use ParameterizedTypeReference in REST method calls#1467

Closed
WonderCsabo wants to merge 1 commit into
androidannotations:developandroidannotations/androidannotations:developfrom
WonderCsabo:1440_restParameterizedTypeReferenceWonderCsabo/androidannotations:1440_restParameterizedTypeReferenceCopy head branch name to clipboard
Closed

Use ParameterizedTypeReference in REST method calls#1467
WonderCsabo wants to merge 1 commit into
androidannotations:developandroidannotations/androidannotations:developfrom
WonderCsabo:1440_restParameterizedTypeReferenceWonderCsabo/androidannotations:1440_restParameterizedTypeReferenceCopy head branch name to clipboard

Conversation

@WonderCsabo

Copy link
Copy Markdown
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
Copy Markdown
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

dodgex commented Sep 11, 2015

Copy link
Copy Markdown
Member

might this #1489 help for the second point?

@WonderCsabo

Copy link
Copy Markdown
Member Author

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

@dodgex

dodgex commented Sep 11, 2015

Copy link
Copy Markdown
Member

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

@WonderCsabo

Copy link
Copy Markdown
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

dodgex commented Sep 11, 2015

Copy link
Copy Markdown
Member

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

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.

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

@dodgex

dodgex commented Sep 13, 2015

Copy link
Copy Markdown
Member

@WonderCsabo

Copy link
Copy Markdown
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

dodgex commented Sep 13, 2015

Copy link
Copy Markdown
Member

shall i open the PR from my branch?

@WonderCsabo

Copy link
Copy Markdown
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

Morty Proxy This is a proxified and sanitized view of the page, visit original site.