On Thu, 13 Feb 2025 13:52:05 GMT, Roman Marchenko <rmarche...@openjdk.org> 
wrote:

> > It was implemented in a way to minimize the difference between different 
> > 'stopClasses' for the same object. In the example above, the next call will 
> > produce the same properties:
> > ...
> > Thus, the methods of the current class have some priority over those of the 
> > parent class.
> > But if the same class has multiple setFoo(xxx) methods, the behavior will 
> > be undefined/unspecified.
> 
> Currently, I see from `PropertyInfo` implementation that methods are just 
> sorted by argument's type name if arguments are not assignable from each 
> other. So, in case `Long` vs `Number`, `Long` will be chosen 
> (`isAssignable()` check works); in case `Float` vs `Integer`, `Float` will be 
> chosen (sorted by type name).

There is "test/jdk/java/beans/Introspector/TestMethodOrderDependence.java" 
which was added to prevent accidental change in the implementation, but part of 
the behavior is undefined/unspecified.

>If no docs, could you review the test cases below, please? Is it correct, or 
>redundant, or incomplete? I will add them to the test when OK.

New tests are always welcome, especially for interfaces, as they are a 
relatively new feature.

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

PR Comment: https://git.openjdk.org/jdk/pull/23443#issuecomment-2657410227

Reply via email to