SLCORE-2240 Add artifact resolver interfaces and model types#1922
SLCORE-2240 Add artifact resolver interfaces and model types#1922Krosovok wants to merge 1 commit intofeature/on-demand-analyzersfrom
Conversation
SummaryRefactors plugin state management to a more general artifact-oriented model and introduces resolver interfaces for artifact resolution. Renames What reviewers should knowStart with the new interfaces in
|
backend/core/src/main/java/org/sonarsource/sonarlint/core/plugin/ArtifactState.java
Show resolved
Hide resolved
...end/core/src/main/java/org/sonarsource/sonarlint/core/plugin/resolvers/ArtifactResolver.java
Show resolved
Hide resolved
There was a problem hiding this comment.
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/ExtraArtifactResolverinterfaces undercore.plugin.resolvers. - Adds new model types
ResolvedArtifactandArtifactStateundercore.plugin. - Sets non-null-by-default semantics for the new
resolverspackage viapackage-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.
backend/core/src/main/java/org/sonarsource/sonarlint/core/plugin/ResolvedArtifact.java
Show resolved
Hide resolved
...end/core/src/main/java/org/sonarsource/sonarlint/core/plugin/resolvers/ArtifactResolver.java
Show resolved
Hide resolved
backend/core/src/main/java/org/sonarsource/sonarlint/core/plugin/ArtifactState.java
Show resolved
Hide resolved
c710cb7 to
699216d
Compare
|
| import org.sonarsource.sonarlint.core.commons.Version; | ||
|
|
||
| public record ResolvedArtifact(ArtifactState state, @Nullable Path path, @Nullable ArtifactSource source, @Nullable Version version) { | ||
|
|
There was a problem hiding this comment.
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
There was a problem hiding this comment.
It is a good feedback, but it's much easier to implement it together with actual usages.
There was a problem hiding this comment.
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. ✓
nquinquenel
left a comment
There was a problem hiding this comment.
Not sure I understand the purpose of these changes
| import java.nio.file.Path; | ||
| import java.util.Optional; | ||
|
|
||
| public interface ExtraArtifactResolver { |
There was a problem hiding this comment.
Can you document what's an "Extra" artifact resolver?



No description provided.