Open Robinsstudio opened 6 days ago
Yup, it seems similar to https://github.com/eclipse-jdt/eclipse.jdt.core/issues/366 . FWIW, there is work being done to support javac
as a pluggable replacement for ECJ in order for users to have the option to get past such issues.
Environment
Steps To Reproduce
Create a file
Main.java
, paste the following content into it and then open it with VS Code and the Java extension:Current Result
The program doesn't compile.
barsByFooIdAndBarId
's type is inferred asMap<String, Map<String, Object>>
instead ofMap<String, Map<String, Bar>>
. As a result, the assignment toBar bar
is invalid becauseObject
is not assignable toBar
. However, if you replacevar
withMap<String, Map<String, Bar>>
directly, then the program will be just fine. You can even run it and it will printnull
.I know that this doesn't happen with javac nor IntelliJ because I noticed this at work and my colleagues using IntelliJ don't have the issue and manual compilation with Maven is also fine.
I suspect that the issue comes from the Eclipse Java language server which the Java extension is based on. But I cannot confirm this for now as I'm still trying to build and run the language server locally. And this is harder than I thought.
Expected Result
The program compiles and runs with VS Code and the Java extension. I understand that this may not be easy to solve. I would already appreciate some insights on the issue. If you think that I should open an issue on Eclipse's side, please let me know!
Additional Informations
Last but not least, thank you for your amazing work! 💪 I'm so happy to be able to write Java in VS Code thanks to the extension. I was able to move away from IntelliJ which I genuinely dislike. So thank you so much for the dedication in making this possible! ❤️