Skip to content

Add missing @Deprecated annotations and @deprecated Javadoc tags - #2166

Open
sonarqube-agent[bot] wants to merge 1 commit into
masterfrom
remediate-master-20260621-050253-d16e56aa
Open

Add missing @Deprecated annotations and @deprecated Javadoc tags#2166
sonarqube-agent[bot] wants to merge 1 commit into
masterfrom
remediate-master-20260621-050253-d16e56aa

Conversation

@sonarqube-agent

Copy link
Copy Markdown
Contributor

This PR was automatically created by the Remediation Agent's Scheduled backlog remediation feature.

Why these issues? All five issues are MAJOR violations of the same rule (java:S1123) across the rpc-protocol module with identical, low-risk fix patterns—adding missing @deprecated Javadoc tags or @deprecated annotations. These automatable changes form a coherent group addressing deprecation marking consistency throughout the module.

This PR fixes 5 SonarQube violations of rule java:S1123 by adding missing @deprecated annotations and @deprecated Javadoc tags to deprecated classes and fields across the rpc-protocol module. Properly marking deprecation with both the annotation and Javadoc tag ensures consistency and helps developers understand which alternatives to use.

View Project in SonarCloud


Fixed Issues

java:S1123 - Add the missing @deprecated Javadoc tag. • MAJORView issue

Location: sonarlint-core-parent:rpc-protocol/src/main/java/org/sonarsource/sonarlint/core/rpc/protocol/backend/initialize/LanguageSpecificRequirements.java:31

Why is this an issue?

Deprecation should be marked with both the @Deprecated annotation and @deprecated Javadoc tag. The annotation enables tools such as IDEs to warn about referencing deprecated elements, and the tag can be used to explain when it was deprecated, why, and how references should be refactored.

What changed

This hunk adds the missing @deprecated Javadoc tag to the constructor of LanguageSpecificRequirements that is annotated with @deprecated. The static analysis rule requires that deprecation be marked with both the @deprecated annotation and the @deprecated Javadoc tag. The constructor at line 31 already had the @deprecated annotation but was missing the @deprecated Javadoc tag. This hunk adds the Javadoc comment with the @deprecated tag (including information about when it was deprecated and what to use instead), making the deprecation marking complete and compliant with the rule.

--- a/rpc-protocol/src/main/java/org/sonarsource/sonarlint/core/rpc/protocol/backend/initialize/LanguageSpecificRequirements.java
+++ b/rpc-protocol/src/main/java/org/sonarsource/sonarlint/core/rpc/protocol/backend/initialize/LanguageSpecificRequirements.java
@@ -29,0 +30,3 @@ public class LanguageSpecificRequirements {
+  /**
+   * @deprecated since 11.2, use {@link #LanguageSpecificRequirements(JsTsRequirementsDto, boolean)} instead
+   */
java:S1123 - Add the missing @deprecated Javadoc tag. • MAJORView issue

Location: sonarlint-core-parent:rpc-protocol/src/main/java/org/sonarsource/sonarlint/core/rpc/protocol/backend/connection/auth/HelpGenerateUserTokenParams.java:32

Why is this an issue?

Deprecation should be marked with both the @Deprecated annotation and @deprecated Javadoc tag. The annotation enables tools such as IDEs to warn about referencing deprecated elements, and the tag can be used to explain when it was deprecated, why, and how references should be refactored.

What changed

This hunk adds the missing @deprecated Javadoc tag to the HelpGenerateUserTokenParams constructor that is already annotated with @deprecated. The static analysis rule requires that deprecation be marked with both the @deprecated annotation and the @deprecated Javadoc tag. The constructor at line 32 had the @deprecated annotation but was missing the @deprecated Javadoc tag, so this hunk adds the Javadoc comment with the @deprecated tag explaining which alternative constructor to use instead.

--- a/rpc-protocol/src/main/java/org/sonarsource/sonarlint/core/rpc/protocol/backend/connection/auth/HelpGenerateUserTokenParams.java
+++ b/rpc-protocol/src/main/java/org/sonarsource/sonarlint/core/rpc/protocol/backend/connection/auth/HelpGenerateUserTokenParams.java
@@ -30,0 +31,3 @@ public class HelpGenerateUserTokenParams {
+  /**
+   * @deprecated use {@link #HelpGenerateUserTokenParams(String, Utm)} instead
+   */
java:S1123 - Add the missing @deprecated annotation. • MAJORView issue

Location: sonarlint-core-parent:rpc-protocol/src/main/java/org/sonarsource/sonarlint/core/rpc/protocol/client/analysis/FileEditDto.java:30

Why is this an issue?

Deprecation should be marked with both the @Deprecated annotation and @deprecated Javadoc tag. The annotation enables tools such as IDEs to warn about referencing deprecated elements, and the tag can be used to explain when it was deprecated, why, and how references should be refactored.

What changed

This hunk adds the missing @deprecated annotation to the FileEditDto class. The static analysis rule requires that deprecation be marked with both the @deprecated annotation and the @deprecated Javadoc tag. The class already had a @deprecated Javadoc tag but was missing the @deprecated annotation, so adding @Deprecated(since = "10.2") makes the deprecation compliant by ensuring both the annotation and the Javadoc tag are present.

--- a/rpc-protocol/src/main/java/org/sonarsource/sonarlint/core/rpc/protocol/client/analysis/FileEditDto.java
+++ b/rpc-protocol/src/main/java/org/sonarsource/sonarlint/core/rpc/protocol/client/analysis/FileEditDto.java
@@ -29,0 +30,1 @@ import org.sonarsource.sonarlint.core.rpc.protocol.backend.analysis.AnalyzeFiles
+@Deprecated(since = "10.2")
java:S1123 - Add the missing @deprecated Javadoc tag. • MAJORView issue

Location: sonarlint-core-parent:rpc-protocol/src/main/java/org/sonarsource/sonarlint/core/rpc/protocol/backend/config/binding/BindingSuggestionDto.java:28

Why is this an issue?

Deprecation should be marked with both the @Deprecated annotation and @deprecated Javadoc tag. The annotation enables tools such as IDEs to warn about referencing deprecated elements, and the tag can be used to explain when it was deprecated, why, and how references should be refactored.

What changed

This hunk adds the missing @deprecated Javadoc tag to the field 'isFromSharedConfiguration' in BindingSuggestionDto.java. The field was annotated with @deprecated but lacked the corresponding @deprecated Javadoc tag. The static analysis rule requires that deprecation be marked with both the @deprecated annotation and the @deprecated Javadoc tag. By adding the Javadoc comment with '@deprecated use {@link #origin} instead', the code now satisfies both requirements, resolving the code smell.

--- a/rpc-protocol/src/main/java/org/sonarsource/sonarlint/core/rpc/protocol/backend/config/binding/BindingSuggestionDto.java
+++ b/rpc-protocol/src/main/java/org/sonarsource/sonarlint/core/rpc/protocol/backend/config/binding/BindingSuggestionDto.java
@@ -26,0 +27,3 @@ public class BindingSuggestionDto {
+  /**
+   * @deprecated use {@link #origin} instead
+   */
java:S1123 - Add the missing @deprecated Javadoc tag. • MAJORView issue

Location: sonarlint-core-parent:rpc-protocol/src/main/java/org/sonarsource/sonarlint/core/rpc/protocol/client/binding/AssistBindingParams.java:29

Why is this an issue?

Deprecation should be marked with both the @Deprecated annotation and @deprecated Javadoc tag. The annotation enables tools such as IDEs to warn about referencing deprecated elements, and the tag can be used to explain when it was deprecated, why, and how references should be refactored.

What changed

This hunk adds the missing @deprecated Javadoc tag to the field 'isFromSharedConfiguration' in AssistBindingParams.java. The field already had the @deprecated annotation but was missing the corresponding @deprecated Javadoc tag. By adding the Javadoc comment with '@deprecated Use {@link #getOrigin()} instead.', the code now properly has both the @deprecated annotation and the @deprecated Javadoc tag, satisfying the rule that deprecation should be marked with both.

--- a/rpc-protocol/src/main/java/org/sonarsource/sonarlint/core/rpc/protocol/client/binding/AssistBindingParams.java
+++ b/rpc-protocol/src/main/java/org/sonarsource/sonarlint/core/rpc/protocol/client/binding/AssistBindingParams.java
@@ -27,0 +28,3 @@ public class AssistBindingParams {
+  /**
+   * @deprecated Use {@link #getOrigin()} instead.
+   */

Have a suggestion or found an issue? Share your feedback here.


SonarQube Remediation Agent uses AI. Check for mistakes.

Fixed issues:
- AZjRnmUzCue1PWb8I6hR for java:S1123 rule
- AZjRnmSwCue1PWb8I6gn for java:S1123 rule
- AZjRnmVECue1PWb8I6hV for java:S1123 rule
- AZjRnmS-Cue1PWb8I6gq for java:S1123 rule
- AZ6HdAqqZMgPBM841Lww for java:S1123 rule

Generated by SonarQube Agent (task: d586253c-e4d4-4788-aef2-87edcec388ab)
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant