[test-util] Set accessible on @Parameters provider and @Parameter field - #9510
Open
thswlsqls wants to merge 1 commit into
Open
[test-util] Set accessible on @Parameters provider and @Parameter field#9510thswlsqls wants to merge 1 commit into
thswlsqls wants to merge 1 commit into
Conversation
ParameterizedTestExtension invokes the @parameters provider and writes the @parameter fields reflectively without calling setAccessible(true), so a test class the extension cannot access fails with IllegalAccessException even when the provider is public static. Generated-by: Claude Code
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.
Purpose
fix #9509
ParameterizedTestExtensioninvokes the@Parametersprovider and writes@Parameterfields reflectively withoutsetAccessible(true), so a test class the extension cannot access fails withIllegalAccessExceptioneven when the provider ispublic static.public class, while about a quarter of the repo's*Test/*ITCaseclasses are package-private.setAccessible(true)calls upstreamflink-test-utils-junit, the origin of this file, added in FLINK-32058 and FLINK-32942. No existing test changes behavior.Tests
ParameterizedTestExtensionTestwith two fixtures: an inaccessible@Parametersprovider and an inaccessible@Parameterfield.mvn -pl paimon-test-utils -DfailIfNoTests=false clean installon JDK 11: green, checkstyle and spotless included.