Do not use constructor injection in IJ plugin

When starting IJ 2020.1 with enabled SonarLint plugin, you get the following warnings:

2020-05-22 23:45:02,505 [   5118]   WARN - Container.ComponentManagerImpl - Do not use constructor injection (requestorClass=org.sonarlint.intellij.core.SonarLintEngineManager)
2020-05-22 23:45:02,505 [   5118]   WARN - Container.ComponentManagerImpl - Do not use constructor injection (requestorClass=org.sonarlint.intellij.core.SonarLintEngineFactory)
2020-05-22 23:45:02,505 [   5118]   WARN - Container.ComponentManagerImpl - Do not use constructor injection (requestorClass=org.sonarlint.intellij.util.SonarLintActions)
2020-05-22 23:45:02,529 [   5142]   WARN - Container.ComponentManagerImpl - Do not use constructor injection (requestorClass=org.sonarlint.intellij.telemetry.SonarLintTelemetryImpl)
2020-05-22 23:45:02,529 [   5142]   WARN - Container.ComponentManagerImpl - Do not use constructor injection (requestorClass=org.sonarlint.intellij.telemetry.TelemetryManagerProvider)

Actually there are even more later in the log.

Hello, thank you for reporting this.

For the moment these are only warnings, shown each time a constructor-injected component is initialized by the platform. They should not have any impact on SonarLint’s features.

They are due to a push by JetBrains for plugin developers to switch to their “new” component model, and we already track this as SLI-368.

As you can see from the logged messages, we use constructor injection quite extensively, for 2 main reasons: it was similar to our recommended patterns on other products, and it classes unit tests simpler to write. The alternative is to switch to statically-accessed “Services” in the IntelliJ platform, and it will require a significant development effort, for a functional benefit that is not quite obvious at short term. However there is a good chance that this gets addressed in the next few weeks, as we always strive for the best possible UX for developers.