vscode-java icon indicating copy to clipboard operation
vscode-java copied to clipboard

Unexpected type mismatch error for Either and Either.Right.

Open ikru opened this issue 2 months ago • 7 comments

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.

ikru avatar Sep 26 '25 20:09 ikru