Remove deprecated classes and APIs marked for removal#5808
Open
sonarqube-agent[bot] wants to merge 1 commit into
Open
Remove deprecated classes and APIs marked for removal#5808sonarqube-agent[bot] wants to merge 1 commit into
sonarqube-agent[bot] wants to merge 1 commit into
Conversation
Fixed issues: - AZ9kMwJag304P0Ql8LLG for java:S5738 rule - AZ9kMwHgg304P0Ql8LLF for java:S5738 rule - AZ9kMwUBg304P0Ql8LLI for java:S5738 rule - AZ9kMwUqg304P0Ql8LLJ for java:S5738 rule - AZ9kMwOrg304P0Ql8LLH for java:S5738 rule Generated by SonarQube Agent (task: dca7a97c-9b1b-4d59-a6ad-aa88c8e8bb1b)
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.
This change resolves 5 SonarQube java:S5738 violations by removing deprecated APIs across multiple test files. The fixes include eliminating the deprecated LogTesterJUnit5 class, replacing Paths.get() with Path.of(), and removing the deprecated @tempdir field-injection pattern—all of which are marked for removal in future Java versions.
View Project in SonarCloud
Fixed Issues
java:S5738 - Remove this call to a deprecated class, it has been marked for removal. • MAJOR • View issue
Location:
java:docs/java-custom-rules-example/src/test/java/org/sonar/samples/java/checks/AvoidBrandInMethodNamesRuleTest.java:14Why is this an issue?
With the introduction of Java 9, the standard annotation class
java.lang.Deprecatedhas been updated with new parameters. Notably, a boolean parameterforRemovalhas been added to clearly signify whether the deprecated code is intended to be removed in the future. This is indicated withforRemoval=true. The javadoc of the annotation explicitly mentions the following:What changed
Removes the import of
LogTesterJUnit5(fromorg.sonar.api.testfixtures.log) and its related imports (RegisterExtension,Level).LogTesterJUnit5is a deprecated class marked for removal. By removing these imports, the code no longer references the deprecated class, which is necessary to resolve the static analysis warning about using a deprecated class marked for removal.java:S5738 - Remove this call to a deprecated class, it has been marked for removal. • MAJOR • View issue
Location:
java:docs/java-custom-rules-example/src/test/java/org/sonar/samples/java/checks/SecurityAnnotationMandatoryRuleTest.java:14Why is this an issue?
With the introduction of Java 9, the standard annotation class
java.lang.Deprecatedhas been updated with new parameters. Notably, a boolean parameterforRemovalhas been added to clearly signify whether the deprecated code is intended to be removed in the future. This is indicated withforRemoval=true. The javadoc of the annotation explicitly mentions the following:What changed
Removes the import statements for LogTesterJUnit5 and related classes (RegisterExtension, Level). LogTesterJUnit5 is a deprecated class marked for removal, and this hunk removes the imports that support its usage, contributing to eliminating the deprecated class reference.
java:S5738 - Remove this call to a deprecated class, it has been marked for removal. • MAJOR • View issue
Location:
java:external-reports/src/test/java/org/sonar/java/externalreport/CheckstyleSensorTest.java:45Why is this an issue?
With the introduction of Java 9, the standard annotation class
java.lang.Deprecatedhas been updated with new parameters. Notably, a boolean parameterforRemovalhas been added to clearly signify whether the deprecated code is intended to be removed in the future. This is indicated withforRemoval=true. The javadoc of the annotation explicitly mentions the following:What changed
Removes the import of
java.nio.file.Paths, which is the deprecated class marked for removal. Since the code is migrated to usePath.of()instead ofPaths.get(), this import is no longer needed. This supports the fix for the static analysis warning about calling a deprecated class that has been marked for removal.java:S5738 - Remove this call to a deprecated class, it has been marked for removal. • MAJOR • View issue
Location:
java:external-reports/src/test/java/org/sonar/java/externalreport/SpotBugsSensorTest.java:46Why is this an issue?
With the introduction of Java 9, the standard annotation class
java.lang.Deprecatedhas been updated with new parameters. Notably, a boolean parameterforRemovalhas been added to clearly signify whether the deprecated code is intended to be removed in the future. This is indicated withforRemoval=true. The javadoc of the annotation explicitly mentions the following:What changed
Removes the import of
java.nio.file.Paths, which is a deprecated class marked for removal. This import is no longer needed because the code now usesPath.of()instead ofPaths.get(), addressing the static analysis warning about using a deprecated class marked for removal at line 46 of SpotBugsSensorTest.java.java:S5738 - Remove this call to a deprecated class, it has been marked for removal. • MAJOR • View issue
Location:
java:java-checks-testkit/src/test/java/org/sonar/java/checks/verifier/FilesUtilsTest.java:30Why is this an issue?
With the introduction of Java 9, the standard annotation class
java.lang.Deprecatedhas been updated with new parameters. Notably, a boolean parameterforRemovalhas been added to clearly signify whether the deprecated code is intended to be removed in the future. This is indicated withforRemoval=true. The javadoc of the annotation explicitly mentions the following:What changed
Removes the deprecated @tempdir field-level annotation at line 30, which was flagged as using a deprecated class marked for removal. By removing this field declaration, the code no longer uses the deprecated field-injection pattern of @tempdir, addressing the static analysis warning about calling a deprecated class that has been marked for removal.
SonarQube Remediation Agent uses AI. Check for mistakes.