On Wed, 7 May 2025 14:35:34 GMT, Andy Goryachev <ango...@openjdk.org> wrote:

>> No, the instance of `PreferenceProperties` is only stored as a private field 
>> in `PlatformPreferences`. I'm usually using public methods in nested classes 
>> to indicate that the method is supposed to be called from outside of the 
>> nested class. That's not strictly necessary, but I think it serves to 
>> differentiate them from "purely" private methods.
>
> let me try again:
> 
> `Platform.getPreferences()` returns an instance of `PlatformPreferences`
> `PlatformPreferences.colorSchemeProperty()` returns a `ColorSchemeProperty` 
> with a public `updateEffectiveValue()`
> 
> the app can use reflection to invoke a public method, though admittedly in a 
> convoluted way.

No, an application would not be able to do that. A getter whose implementation 
happens to return a subtype in a non-exported package does not allow the caller 
of that getter to access any methods in the non-exported class (even public 
ones). If it did, then you could never return a type that implements an 
interface, since all interface methods are public.

@mstr2 is right. There is no problem here that I can see.

-------------

PR Review Comment: https://git.openjdk.org/jfx/pull/1655#discussion_r2077805709

Reply via email to