fix: use List interface instead of ArrayList in TransformationService#48
Open
sonarqube-agent[bot] wants to merge 1 commit intomainfrom
Open
fix: use List interface instead of ArrayList in TransformationService#48sonarqube-agent[bot] wants to merge 1 commit intomainfrom
sonarqube-agent[bot] wants to merge 1 commit intomainfrom
Conversation
Fixed issues: - AZZjJ298STHyJcTACtx8 for java:S1319 rule Generated by SonarQube Agent (task: f644162a-4f2a-495b-8c2a-f807ac28ee81)
Author
|
|
|
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.



Changed the return type of the unwind method from ArrayList to List to adhere to best practices of returning interface types rather than concrete implementations. This improves code flexibility and maintainability by allowing implementations to be swapped without affecting the method signature.
View Project in SonarCloud
Fixed Issues
java:S1319 - The return type of this method should be an interface such as "List" rather than the implementation "ArrayList". • MINOR • View issue
Location:
src/main/java/fr/ans/psc/pscextract/service/TransformationService.java:149Why is this an issue?
The Java Collections API offers a well-structured hierarchy of interfaces designed to hide collection implementation details. For the various collection data structures like lists, sets, and maps, specific interfaces (
java.util.List,java.util.Set,java.util.Map) cover the essential features.What changed
Changes the return type of the public method
unwindfrom the concrete implementationArrayList<Ps>to the interface typeList<Ps>. This directly fixes the code smell where a collection implementation class (ArrayList) was used as a public method return type instead of the appropriate interface (List).SonarQube Remediation Agent uses AI. Check for mistakes.