Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

SLE-861: Less friction with the Java installation used by SonarLint #658

Merged
merged 3 commits into from
May 15, 2024

Conversation

thahnen
Copy link
Member

@thahnen thahnen commented May 13, 2024

Summary

When SonarLint for Eclipse is installed on a machine that does not allow the execution of unspecified Java installations (e.g. Windows Group Policy issues), the backend won't start. The user should configure a self-managed Java installation in that case via the SonarLint preference page.

This is hideous if the user already configured Eclipse (or the Eclipse-based IDE) to use a self-managed Java installation on the one hand, and on the other hand, changing the Java installation via the SonarLint preference page does not work because it relies on the SonarLint backend up and running.

As the Java installation bundled with SonarLint was intended in the first place for IDEs still running on Java 11, in the case of IDEs running on Java 17+, we don't "need" our Java runtime and can re-use the one configured/used by Eclipse. This also reduces the overhead for power users regarding configuration!

The SonarLint preference pages were changed as well to not assume that the SonarLint backend is up and running, at least for users to change the self-managed Java installation. There should be no UI error or exception anymore when navigating the preference pages. Only saving different combinations that rely on the SonarLint backend might not work, but that is expected!

For debugging this issue in the first place and later for making our lives easier, an abstraction that was introduced for Adapters.adapt(...) a while ago is now used everywhere where we try to adapt. This helps to trace potential issues even better. This was done specifically in a separate commit!

Testing

In order to create a not-working SonarLint installation on Eclipse, the preference /instance/org.sonarlint.eclipse.ui/java17Path must be set to something random (e.g., no working Java installation home directory). After that, it can be tested that the preferences are set up correctly, and changing the Java 17 runtime to a self-managed installation is possible.

In the future, it might be possible that we create additional integration test projects where we test that running SonarLint with a self-managed as well as Eclipse-provided installation and no working installation at all is possible. This is not in the scope of this ticket or hardening!

thahnen and others added 2 commits May 13, 2024 17:24
In order to better trace issues with SonarLint and the integration into Eclipse / other plug-ins we have to use the wrapper around "Adapters.adapt(...)" that includes more logging.
This is highly useful for debugging!
Since SonarLint is mostly out of process the main SonarLint preference page did not work anymore when SonarLint didn't start up correctly.
@thahnen thahnen changed the title (WIP) SLE-861: SonarLint preference pages should still be accessible if backend not started (WIP) SLE-861: Less friction with the Java installation used by SonarLint May 14, 2024
Since 10.0 we bundle our on Java installation in order to keep SonarLint running smoothly on IDEs running on Java 16 or lower.
For power users we removed the friction already a bit by adding the ability to provide their own self-managed Java runtime.
To take this one step further we want to re-use the Java installation of Eclipse if possible, as power users providing their own self-managed Java runtime to SonarLint would do the same for Eclipse.
Copy link

sonarqube-next bot commented May 14, 2024

@thahnen thahnen marked this pull request as ready for review May 14, 2024 13:13
@thahnen thahnen requested a review from a team May 14, 2024 13:13
@thahnen thahnen changed the title (WIP) SLE-861: Less friction with the Java installation used by SonarLint SLE-861: Less friction with the Java installation used by SonarLint May 14, 2024
@thahnen thahnen requested a review from nquinquenel May 15, 2024 08:02
Copy link
Member

@nquinquenel nquinquenel left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

LGTM (did not test)

@thahnen thahnen merged commit 66f6cfe into master May 15, 2024
9 checks passed
@thahnen thahnen deleted the fix/tha/SLE-861_PreferenceFix branch May 15, 2024 09:24
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
2 participants