redhat-developer / vscode-java

Java Language Support for Visual Studio Code
Eclipse Public License 2.0
2.17k stars 475 forks source link

1.42.0 - 1.43.2025051708 Problems with generics casting #4053

Open anar-ibragimoff opened 3 weeks ago

anar-ibragimoff commented 3 weeks ago

Starting from 1.42.0 we experiencing massive problems with most of our java-projects with SpringBoot Webflux - builtin java-analyser detects false-positive compilation errors.

Example: with Language Support for Java v1.41.1, still works:

Image

starting from v1.42.0 we are getting following errors:

Image

The issue is reproducible till the latest v1.43.2025051708.

As a workaround, it helps to activate experimental javac-option:

    "java.jdt.ls.java.home": "C:\\Program Files\\Java\\jdk-24.0.0_36",
    "java.jdt.ls.javac.enabled": "on"

Unfortunately this workaround is not preferred solution due to various reasons.

Sample class:

import reactor.core.publisher.Mono;

public class TestClass {

    public Mono<Integer> testMethod() {
        return Mono.just(Integer.valueOf(13))
                .switchIfEmpty(
                    Mono.defer( () -> Mono.just( Integer.valueOf(12) ) )
                );
    }

}

I've prepared a small sample-project with error, see attached archive.

test.zip

Together with https://github.com/redhat-developer/vscode-java/issues/3899 it led us to stick with v1.37, which unfortunately is also not optimal, due to other problems with, for example, Test Runner for Java extension compatibility.

lehuythangit commented 3 weeks ago

same issue

linuxhelf commented 2 weeks ago

i'm having a similar issue since this problem disappears with java.jdt.ls.javac.enabled on, it is probably also an issue in ecj i took a quick look at the issues over there and found this similar one: https://github.com/eclipse-jdt/eclipse.jdt.core/issues/4003 which links to https://github.com/eclipse-jdt/eclipse.jdt.core/pull/3910 probably being the reason