Skip to content

SLCORE-2240 Add artifact resolver interfaces and model types#1922

Open
Krosovok wants to merge 1 commit intofeature/on-demand-analyzersfrom
feature/vt/SLCORE-2240-create-interfaces-and-models
Open

SLCORE-2240 Add artifact resolver interfaces and model types#1922
Krosovok wants to merge 1 commit intofeature/on-demand-analyzersfrom
feature/vt/SLCORE-2240-create-interfaces-and-models

Conversation

@Krosovok
Copy link
Contributor

No description provided.

@Krosovok Krosovok requested a review from nquinquenel March 18, 2026 12:04
@sonar-review-alpha
Copy link

sonar-review-alpha bot commented Mar 18, 2026

Summary

Refactors plugin state management to a more general artifact-oriented model and introduces resolver interfaces for artifact resolution. Renames PluginState to ArtifactState and adds two new types: ResolvedArtifact model (containing state, path, source, version) and ArtifactResolver interface for resolving artifacts with support for async status updates. Also introduces ExtraArtifactResolver for resolving additional artifacts by key. This groundwork supports the on-demand analyzer feature by decoupling plugin-specific logic from general artifact handling.

What reviewers should know

Start with the new interfaces in backend/core/src/main/java/org/sonarsource/sonarlint/core/plugin/resolvers/: ArtifactResolver.java (primary interface with documentation about async resolution) and ExtraArtifactResolver.java for context on what these will handle. Then review ResolvedArtifact.java to understand the model being returned. The bulk of the diff is mechanical: PluginStateArtifactState renaming across 4 files (the enum file, PluginStatus, PluginStatusMapper, PluginsService) plus test updates. The import reordering in PluginsServiceTest is incidental. Note: implementations of these new interfaces are not in this PR—this is pure contract/model definition.


  • Generate Walkthrough
  • Generate Diagram

🗣️ Give feedback

@hashicorp-vault-sonar-prod
Copy link

hashicorp-vault-sonar-prod bot commented Mar 18, 2026

SLCORE-2240

Copy link

@sonar-review-alpha sonar-review-alpha bot left a comment

Choose a reason for hiding this comment

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

Conclusion: Two issues need fixing before merge: an exact enum duplication and a broken Javadoc @link.

🗣️ Give feedback

@nquinquenel nquinquenel requested a review from Copilot March 19, 2026 08:41
Copy link

Copilot AI left a comment

Choose a reason for hiding this comment

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

Pull request overview

Adds new artifact resolution abstractions to SonarLint Core so the backend can represent and resolve analyzer/plugin artifacts in a structured way.

Changes:

  • Introduces ArtifactResolver / ExtraArtifactResolver interfaces under core.plugin.resolvers.
  • Adds new model types ResolvedArtifact and ArtifactState under core.plugin.
  • Sets non-null-by-default semantics for the new resolvers package via package-info.java.

Reviewed changes

Copilot reviewed 5 out of 5 changed files in this pull request and generated 3 comments.

Show a summary per file
File Description
backend/core/src/main/java/org/sonarsource/sonarlint/core/plugin/resolvers/package-info.java Declares non-null-by-default for the new resolvers package.
backend/core/src/main/java/org/sonarsource/sonarlint/core/plugin/resolvers/ExtraArtifactResolver.java Adds interface for resolving additional artifacts by key.
backend/core/src/main/java/org/sonarsource/sonarlint/core/plugin/resolvers/ArtifactResolver.java Adds interface for resolving a language/connection artifact to a model type.
backend/core/src/main/java/org/sonarsource/sonarlint/core/plugin/ResolvedArtifact.java Introduces record representing the outcome of an artifact resolution.
backend/core/src/main/java/org/sonarsource/sonarlint/core/plugin/ArtifactState.java Introduces enum representing artifact resolution state.

💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.

You can also share your feedback on Copilot code review. Take the survey.

@Krosovok Krosovok force-pushed the feature/vt/SLCORE-2240-create-interfaces-and-models branch from c710cb7 to 699216d Compare March 19, 2026 10:28
@sonarqube-next
Copy link

Copy link

@sonar-review-alpha sonar-review-alpha bot left a comment

Choose a reason for hiding this comment

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

Conclusion: Clean groundwork PR. The rename is mechanical and consistent throughout, and the new interfaces/models fit the existing conventions well.

🗣️ Give feedback

import org.sonarsource.sonarlint.core.commons.Version;

public record ResolvedArtifact(ArtifactState state, @Nullable Path path, @Nullable ArtifactSource source, @Nullable Version version) {

Choose a reason for hiding this comment

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

The record allows invalid combinations — e.g. ArtifactState.ACTIVE with a null path, or a non-null path with ArtifactState.UNSUPPORTED. Consider adding compact constructor validation, or factory methods (active(Path, ArtifactSource, Version), failed(), etc.) to make legal states explicit and catch mistakes at construction time rather than at use.

  • Mark as noise

Copy link
Contributor Author

Choose a reason for hiding this comment

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

It is a good feedback, but it's much easier to implement it together with actual usages.

Choose a reason for hiding this comment

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

Fair point — you'll have better visibility into the actual state combinations once implementations are in place. That makes sense to defer this together with the usage patterns.

Marking as resolved. ✓

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.

Not sure I understand the purpose of these changes

import java.nio.file.Path;
import java.util.Optional;

public interface ExtraArtifactResolver {
Copy link
Member

Choose a reason for hiding this comment

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

Can you document what's an "Extra" artifact resolver?

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants