Skip to content

Issue with Reactive Streams Wrapper code #1023

@RonyOCuinn

Description

@RonyOCuinn

The example code given here for ExampleReactor does not compile.

The code in question:

public interface GitHubReactor {
      
  @RequestLine("GET /repos/{owner}/{repo}/contributors")
  Flux<Contributor> contributors(@Param("owner") String owner, @Param("repo") String repo);
  
  class Contributor {
    String login;
    
    public Contributor(String login) {
      this.login = login;
    }
  }
}

public class ExampleReactor {
  public static void main(String args[]) {
    GitHubReactor gitHub = ReactorFeign.builder()      
      .target(GitHubReactor.class, "https://api.github.com");
    
    List<Contributor> contributors = gitHub.contributors("OpenFeign", "feign")
      .map(Contributor::new)
      .collect(Collectors.toList())
      .block();
  }
}

Gives the error:

Error:(31, 17) java: method map in class reactor.core.publisher.Flux<T> cannot be applied to given types;
  required: java.util.function.Function<? super com.example.spring.demo.GitHubReactor.Contributor,? extends V>
  found: GitHubReac[...]::new
  reason: cannot infer type-variable(s) V
    (argument mismatch; invalid constructor reference
      incompatible types: com.example.spring.demo.GitHubReactor.Contributor cannot be converted to java.lang.String)

Metadata

Metadata

Assignees

No one assigned

    Labels

    documentationIssues that require updates to our documentation

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions