Skip to content

fix: rename local variable to prevent field shadowing#8

Open
sonarqube-agent[bot] wants to merge 1 commit into
masterfrom
remediate-master-20260331-032523-5b981214
Open

fix: rename local variable to prevent field shadowing#8
sonarqube-agent[bot] wants to merge 1 commit into
masterfrom
remediate-master-20260331-032523-5b981214

Conversation

@sonarqube-agent

Copy link
Copy Markdown

Renamed local variable 'compilerArgs' to 'resolvedCompilerArgs' to eliminate variable shadowing of the class field. This resolves a MAJOR SonarQube issue and improves code clarity by ensuring variable names don't hide outer scope declarations.

View Project in SonarCloud


Fixed Issues

java:S1117 - Rename "compilerArgs" which hides the field declared at line 63. • MAJORView issue

Location: core/src/main/java/com/webcohesion/enunciate/Enunciate.java:639

Why is this an issue?

Shadowing occurs when a local variable has the same name as a variable or a field in an outer scope.

What changed

Renames the local variable 'compilerArgs' to 'resolvedCompilerArgs' at line 639, which was shadowing the class field 'compilerArgs' declared at line 63. This directly resolves the variable shadowing code smell by giving the local variable a unique name that no longer hides the outer field.

--- a/core/src/main/java/com/webcohesion/enunciate/Enunciate.java
+++ b/core/src/main/java/com/webcohesion/enunciate/Enunciate.java
@@ -639,3 +639,3 @@ public class Enunciate implements Runnable {
-      List<String> compilerArgs = getCompilerArgs();
-      getLogger().debug("Compiler args: %s", compilerArgs);
-      options.addAll(compilerArgs);
+      List<String> resolvedCompilerArgs = getCompilerArgs();
+      getLogger().debug("Compiler args: %s", resolvedCompilerArgs);
+      options.addAll(resolvedCompilerArgs);

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


SonarQube Remediation Agent uses AI. Check for mistakes.

Fixed issues:
- AZZmtiWq2HDYqP_XyoAw for java:S1117 rule

Generated by SonarQube Agent (task: 325be25b-1101-4b0f-be63-391505c6cd22)
@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