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

AA doesn't generate ParameterizedTypeReference code when using ResponseEntity<T> as return type #1735

Description

@alexthec0d3r

my build.gradle

dependencies {
    //annotations
    apt "org.androidannotations:androidannotations:4.0.0"
    compile "org.androidannotations:androidannotations-api:4.0.0"
    compile "org.androidannotations:rest-spring-api:4.0.0"
    apt "org.androidannotations:rest-spring:4.0.0"
}

#1440 is good idea, but If you create interface like:

public interface OperatorsService {
    @Get("/")
    ResponseEntity<List<OperatorInfo>> getOperators();
}

then in generated class we still get

public final class OperatorsService_ {
....

    @Override
    public ResponseEntity<List<OperatorInfo>> getOperators() {
        return restTemplate.exchange(rootUrl.concat("/"), HttpMethod.GET, null, List_OperatorInfo.class);
    }

... 
}

and Android Studio will show an error:

Error:(42, 37) error: incompatible types
required: ResponseEntity<List<OperatorInfo>>
found:    ResponseEntity<List_OperatorInfo>

Activity

  1. WonderCsabo commented on Mar 25, 2016

    @WonderCsabo
    Member

    @alexthec0d3r what is the expected generated code in this case?

  2. alexthec0d3r commented on Mar 25, 2016

    @alexthec0d3r
    Author

    The only one working workaround is to use wrapper class like

    public class Operators extends ArrayList<OperatorInfo> {
    }

    @WonderCsabo , I expected from AA that generated code will be

    @Override
    public ResponseEntity<List<Operator>> getOperators() {
        return restTemplate.exchange(rootUrl.concat("/"), HttpMethod.GET, null, new ParameterizedTypeReference<List<Operator>>() {});
    }

    but not

    @Override
    public ResponseEntity<List<Operator>> getOperators() {
        return restTemplate.exchange(rootUrl.concat("/"), HttpMethod.GET, null, List_Operator.class);
    }
  3. WonderCsabo commented on Mar 25, 2016

    @WonderCsabo
    Member

    @alexthec0d3r thanks for filing the bug. Wanna contribute to fix it? 😉

  4. modified the milestone: 4.1 on Mar 28, 2016
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    Type

    No type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions