RFR: 8256649: Parameterized tests must not use instances as parameters
Kevin Rushforth
kcr at openjdk.java.net
Thu Nov 19 23:41:01 UTC 2020
On Thu, 19 Nov 2020 15:13:49 GMT, Jeanette Winzenburg <fastegal at openjdk.org> wrote:
> the issue was an (my ;) overzealous refactoring when introducing support for cross-control testing for memory leaks on switching skins.
>
> Fixed by
> - using control class as parameter
> - instantiate the control at setup time
Ah, right. Parameters should be immutable to avoid this. Each test runs in its own instance, but if a test stores a reference to a parameter and then modifies it, that modification will leak into subsequent tests. FWIW, the same thing can happen if a test modifies a static field or if it modifies global state of the JavaFX runtime.
-------------
Marked as reviewed by kcr (Lead).
PR: https://git.openjdk.java.net/jfx/pull/356
More information about the openjfx-dev
mailing list