Skip to content

Unexpected type mismatch error for Either and Either.Right. #4178

@ikru

Description

@ikru

VSCode Version: 1.99.3
macOS: 26.0 (25A354)
Language Support for Java(TM) by Red Hat v1.45.0
Java Version: Zulu 17.60 (but I was able to repro on multiple versions

vs code won't build the project reporting the code issue as Type mismatch for Either vs Either.Right. Either.Right is a derived class from Either.
When building with mvn compile or with other IDEs this code works just fine.

Steps to Reproduce:

  1. Create a function
    public <R> Mono<Either<Throwable, ResponseEntity<List<SimpleProductTileV2>>>> noOfferProductDetails(
            BffRequestContext<R> requestContext) {
        
        // No liam return empty list of products
        return Mono.just(new Either.Right<>(new ResponseEntity<>(Collections.<SimpleProductTileV2>emptyList(), HttpStatus.OK)));
    }
  1. Build
  2. Get error
Type mismatch: cannot convert from Mono<Either.Right<ResponseEntity<List<SimpleProductTileV2>>>> to Mono<Either<Throwable,ResponseEntity<List<SimpleProductTileV2>>>>

mvn compile works just fine

Looks like vs code compiler incorrectly decode Either.Right or something like that.

Metadata

Metadata

Assignees

No one assigned

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions