Skip to content

Reorder modifiers in Ref.tag field to comply with JLS#2

Open
sonarqube-agent[bot] wants to merge 1 commit into
mainfrom
remediate-main-20260610-071929-6ebdc582
Open

Reorder modifiers in Ref.tag field to comply with JLS#2
sonarqube-agent[bot] wants to merge 1 commit into
mainfrom
remediate-main-20260610-071929-6ebdc582

Conversation

@sonarqube-agent

Copy link
Copy Markdown

This PR was created because a team member assigned these issues to the Remediation Agent.

Fixed a SonarQube MINOR issue by reordering the modifiers on the 'tag' field in Ref.java to comply with the Java Language Specification. The @nullable annotation is now correctly placed after the 'final' modifier rather than between access and non-access modifiers.

View Project in SonarCloud


Fixed Issues

java:S1124 - Reorder the modifiers to comply with the Java Language Specification. • MINORView issue

Location: src/main/java/land/oras/Ref.java:37

Why is this an issue?

The Java Language Specification recommends listing modifiers in the following order:

What changed

This hunk reorders the modifiers on the 'tag' field from 'protected @nullable final' to 'protected final @nullable'. The original code had the @nullable annotation placed between 'protected' and 'final', which caused the static analyzer to flag it as non-compliant with the Java Language Specification's recommended modifier ordering. By moving 'final' before the @nullable annotation, the modifiers now follow the correct order: access modifier (protected), then final, then the type annotation (@nullable) on the type itself (String).

--- a/src/main/java/land/oras/Ref.java
+++ b/src/main/java/land/oras/Ref.java
@@ -37,1 +37,1 @@ public abstract sealed class Ref<T extends Ref<T>> permits ContainerRef, LayoutR
-    protected @Nullable final String tag;
+    protected final @Nullable String tag;

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


SonarQube Remediation Agent uses AI. Check for mistakes.

Fixed issues:
- AZ6wRBfmQw83x_y7ZeMO for java:S1124 rule

Generated by SonarQube Agent (task: 49bb2634-a635-411d-b503-5d90c3a4d100)
@sonarqubecloud

Copy link
Copy Markdown

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