On Sat, 22 Nov 2025 10:11:11 GMT, Michael Strauß <[email protected]> wrote:
>> modules/javafx.graphics/src/test/java/test/com/sun/scenario/animation/LinearInterpolatorTest.java
>> line 41:
>>
>>> 39: try {
>>> 40: Field f =
>>> LinearInterpolator.class.getDeclaredField("controlPoints");
>>> 41: f.setAccessible(true);
>>
>> should an Accessor be used instead?
>
> I'm not a big fan of that because of its impact on the source code of the
> class (you know those comments: "package-private only for the sake of
> testing").
I would recommend to use the Accessor pattern then.
Reflection is brittle, the IDEs won't track the dependency, and I prefer clear
and obvious dependencies. Besides, this is the pattern used throughout the
JavaFX code.
-------------
PR Review Comment: https://git.openjdk.org/jfx/pull/1977#discussion_r2556875403