Skip to content

[test-util] Set accessible on @Parameters provider and @Parameter field - #9510

Open
thswlsqls wants to merge 1 commit into
apache:masterfrom
thswlsqls:fix/parameterized-test-extension-set-accessible
Open

[test-util] Set accessible on @Parameters provider and @Parameter field#9510
thswlsqls wants to merge 1 commit into
apache:masterfrom
thswlsqls:fix/parameterized-test-extension-set-accessible

Conversation

@thswlsqls

Copy link
Copy Markdown
Contributor

Purpose

fix #9509

  • ParameterizedTestExtension invokes the @Parameters provider and writes @Parameter fields reflectively without setAccessible(true), so a test class the extension cannot access fails with IllegalAccessException even when the provider is public static.
  • A package-private test class is enough to trigger it: all 20 usage sites here are public class, while about a quarter of the repo's *Test/*ITCase classes are package-private.
  • Adds the two setAccessible(true) calls upstream flink-test-utils-junit, the origin of this file, added in FLINK-32058 and FLINK-32942. No existing test changes behavior.

Tests

  • Added ParameterizedTestExtensionTest with two fixtures: an inaccessible @Parameters provider and an inaccessible @Parameter field.
  • Reverting the two lines makes them fail with 3 errors (1 provider + 2 field invocations); with the fix all 4 pass.
  • mvn -pl paimon-test-utils -DfailIfNoTests=false clean install on JDK 11: green, checkstyle and spotless included.

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
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

[Bug] ParameterizedTestExtension fails on test classes it cannot access

1 participant