On Thu, 23 Jul 2026 19:45:42 GMT, Michael Strauß <[email protected]> wrote:

>> modules/javafx.base/src/main/java/javafx/beans/property/ReadOnlyProperty.java
>>  line 81:
>> 
>>> 79:      * @since 28
>>> 80:      */
>>> 81:     default Class<?> getDeclaringClass() {
>> 
>> I'm a little worried that this might accidentally reduce performance. 
>> If developers don't know/forget to set the declaring class and rely on this 
>> reflective fallback without knowing it.
>> 
>> But I don't have an idea to solve this right now. Just thinking out loud.
>
> All properties in JavaFX will override this method and directly return their 
> declaring class. So this will only impact third-party properties for which 1) 
> the declaring class is queried, and 2) the `getDeclaringClass()` method is 
> not overridden, and the declaring class is not specified in the property 
> constructor.
> 
> Also, keep in mind that the declaring class is only resolved once, and then 
> cached for repeated queries. I can't imagine that this will be a performance 
> problem.

But only for the `SimpleXXXProperty` classes right now. Not cached for other 
classes like e.g. `StyleableBooleanProperty`.

Am I understanding you right that another PR will override this method in 
JavaFX nodes?

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

PR Review Comment: https://git.openjdk.org/jfx/pull/2015#discussion_r3661047335

Reply via email to