Migrate deprecated JUnit 4 TemporaryFolder to JUnit 5 @TempDir#5799
Closed
sonarqube-agent[bot] wants to merge 1 commit into
Closed
Migrate deprecated JUnit 4 TemporaryFolder to JUnit 5 @TempDir#5799sonarqube-agent[bot] wants to merge 1 commit into
sonarqube-agent[bot] wants to merge 1 commit into
Conversation
Fixed issues: - AZ9kMueAg304P0Ql8LLD for java:S5738 rule - AZ9kMufag304P0Ql8LLE for java:S5738 rule - AZ9kMuWEg304P0Ql8LLA for java:S5738 rule - AZ9kMucYg304P0Ql8LLC for java:S5738 rule - AZ9kMua6g304P0Ql8LLB for java:S5738 rule Generated by SonarQube Agent (task: 5f83de3c-1584-46cd-bd40-570b534fdb27)
Contributor
|
already addressed in #5796 |
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.
Replaces deprecated JUnit 4 TemporaryFolder and @EnableRuleMigrationSupport (marked for removal) with JUnit 5's native @tempdir annotation across five test files. This eliminates MAJOR SonarQube violations and modernizes the test infrastructure to use current JUnit 5 APIs.
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:java-frontend/src/test/java/org/sonar/java/BatchGeneratorTest.java:36Why 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 the deprecated
EnableRuleMigrationSupportclass (marked for removal) and the JUnit 4TemporaryFolderclass, replacing them with the JUnit 5 native@TempDirannotation import. This directly addresses the usage of the deprecatedEnableRuleMigrationSupportclass that was flagged as a code smell for calling 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:java-frontend/src/test/java/org/sonar/java/JavaFrontendTest.java:86Why 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
org.junit.Rule, which was needed for the JUnit 4@Ruleannotation used withTemporaryFolder. This import is no longer needed because the deprecated@EnableRuleMigrationSupport(marked for removal) and the JUnit 4@Rule/TemporaryFolderpattern are being replaced with JUnit 5's@TempDir.java:S5738 - Remove this call to a deprecated class, it has been marked for removal. • MAJOR • View issue
Location:
java:java-frontend/src/test/java/org/sonar/java/ast/visitors/SonarSymbolTableVisitorTest.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
Adds the import for
java.nio.file.Path, which is needed because the deprecatedTemporaryFolder(from JUnit 4 migration support) is being replaced with JUnit 5's@TempDirannotation that usesPathinstead. This supports the removal of the deprecated@EnableRuleMigrationSupportclass that was marked for removal.java:S5738 - Remove this call to a deprecated class, it has been marked for removal. • MAJOR • View issue
Location:
java:java-frontend/src/test/java/org/sonar/java/ast/visitors/SyntaxHighlighterVisitorTest.java:53Why 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
Adds the import for java.nio.file.Path, which is needed because the deprecated TemporaryFolder (JUnit 4 rule used via @EnableRuleMigrationSupport, which is a deprecated class marked for removal) is being replaced with JUnit 5's @tempdir that uses Path instead of File. This supports the removal of the deprecated @EnableRuleMigrationSupport usage at line 53 of SyntaxHighlighterVisitorTest.java.
java:S5738 - Remove this call to a deprecated class, it has been marked for removal. • MAJOR • View issue
Location:
java:java-frontend/src/test/java/org/sonar/java/model/JParserReleasingJarsTest.java:34Why 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
Adds the import for java.nio.file.Path, which is needed to support the migration from the deprecated TemporaryFolder (used with @EnableRuleMigrationSupport, which is marked for removal) to JUnit 5's @tempdir annotation that uses Path instead.
SonarQube Remediation Agent uses AI. Check for mistakes.