salesforce / bazel-vscode-java

Bazel Java development extension for VS Code
BSD 3-Clause "New" or "Revised" License
41 stars 8 forks source link

Missing Error Markers, possibly due to _Preview features enabled at an invalid source release level 11, preview can be enabled only at source level 21?_ #85

Closed vorburger closed 8 months ago

vorburger commented 8 months ago

When I use this extension for https://github.com/enola-dev/enola/, "Error Markers" are missing - there are no "red squiggles" for syntax errors. However other Java (JDT) features such as e.g. Cross References and Ctrl-Space Completion do work just fine for me.

Perhaps this is related to https://github.com/salesforce/bazel-vscode-java/blob/main/docs/troubleshoot.md#java-version, and the Preview features enabled at an invalid source release level 11, preview can be enabled only at source level 21 error that I'm seeing? I may have been wrong in #74 that this message is "harmless"...

When I'll have a moment, I'll explore installing another JDK and running VSC with that, to see if that solves this.

@guw FYI

vorburger commented 8 months ago

OK so closing VSC and doing e.g. killall java && sudo dnf remove "java-17*" && sudo dnf install java-21-openjdk-devel java-21-openjdk-src java-21-openjdk-javadoc java-21-openjdk-javadoc-zip java-21-openjdk-jmods and then restarting VSC and doing a Clean Java Language Server Workspace, as per https://github.com/salesforce/bazel-vscode-java/blob/main/docs/troubleshoot.md#hard-reset, doesn't seem to fix this.

Those Problems are still there, and there is also a pop-up whining about Invalid runtime for JavaSE-17: The path points to a missing or inaccessible folder (/usr/lib/jvm/java-17/).

vorburger commented 8 months ago

Invalid runtime for JavaSE-17: The path points to a missing or inaccessible folder (/usr/lib/jvm/java-17/).

https://github.com/vorburger/vorburger-dotfiles-bin-etc/commit/05e79267d32172b9f028709818dd8f7e145330bb and https://github.com/vorburger/vorburger-dotfiles-bin-etc/commit/43ab20a6767f07bafafb6a1d6b187d3ee71447c9 fix this.

vorburger commented 8 months ago

I'm toying with upgrading from Java 11 to 21 to see if that could fix this, but it's a PITA; see referenced PRs & issues...

@guw if you can think of a better way to workaround the problem reported here, please do shout.

vorburger commented 8 months ago

I'm toying with upgrading from Java 11 to 21 to see if that could fix this, but it's a PITA; see referenced PRs & issues...

https://github.com/enola-dev/enola/pull/426/files has that, and Bazel builds it fine on the CLI...

... in VSC however it's "all red" - even worse than before. Not just on the PR, but even without; see #86.

guw commented 8 months ago

Closing as duplicate of #86

vorburger commented 8 months ago

@guw perhaps not a dupe of #86, as I still saw this, even with that.

However with https://github.com/enola-dev/enola/pull/426 (after #86 fix) this goes away!

I'm not entirely sure yet I really can upgrade to Java 21... but may be I will temporarily.

Can you think of a better way to workaround the problem than bumping projects to Java 21?

Also, Troubleshooting needs a related update; I'll send a PR.