On Tue, 4 Feb 2025 16:14:44 GMT, Roman Marchenko <rmarche...@openjdk.org> wrote:
> Fixed `com.sun.beans.introspect.MethodInfo` and > `com.sun.beans.introspect.PropertyInfo` to make `Introspector.addMethod()` > working properly when filtering methods out. > > Also, after PR discussion, added the approptiate test cases with > corresponding fixes in MethodInfo.java and PropertyInfo.java. > > --------- > `getMethodDescriptors()` returns descriptors of public methods of a class and > its parent classes, including default and static methods defined in > interfaces. The result doesn't include methods which were declared and not > implemented, bridge methods, or methods which were overriden in subclasses. > > When a subclass "overrides" a static method from a parent class > `getMethodDescriptors()` behaves as follows: > > - In case of a clash with a class method, the class version will take > precedence rather than interface's one. > - If the same method appears in multiple classes/interfaces within the same > hierarchy, the version from the most specific sub-interface will be selected. > - If the method appears in classes/interfaces from different hierarchies, the > result is undefined, either version can be returned. > > `getPropertyDescriptors()` returns descriptors of methods which were > identified as getters or setters. As there can be the only method > getter/setter per property, the following rules are applied when choosing a > getter/setter: > > * Getters/setters for the same property defined (not necessarily overriden) > in subclasses have higher precedence. > * If there are getters/setters for the same property defined in the same > class and argument types are assignable one to another, the method with the > Least Common Supertype has the lower priority. If argument types are not > assignable, the result is undefined (any method will be chosen). > * Gettters/setters declared and not implemented are not considered. This pull request has now been integrated. Changeset: c5f235c0 Author: Roman Marchenko <rmarche...@openjdk.org> Committer: Sergey Bylokhov <s...@openjdk.org> URL: https://git.openjdk.org/jdk/commit/c5f235c000db6654493ea109008dbccf97f01678 Stats: 455 lines in 4 files changed: 398 ins; 8 del; 49 mod 8347826: Introspector shows wrong method list after 8071693 Reviewed-by: azvegint, serb, aivanov ------------- PR: https://git.openjdk.org/jdk/pull/23443