RFR: 8347826: Introspector shows wrong method list after 8071693 [v9]
Roman Marchenko
rmarchenko at openjdk.org
Wed Apr 2 09:45:29 UTC 2025
On Wed, 2 Apr 2025 04:01:25 GMT, Sergey Bylokhov <serb at openjdk.org> wrote:
>> @mrserb
>>
>>> getMethodDescriptors() returns all methods of the class, **including static ones**, but static methods are not considered properties
>>
>> I'd like to clarify the behavior:
>>
>> - Should `getMethodDescriptors()` return static methods defined in the interfaces the class extends?
>> - If yes, should it recursively find static methods defined in interfaces? For example, the test scenario 1 defines `static int getStaticValue()` in `A1` interface hidden in the inheritance chain. Should it be included to the method descriptor list?
>
>>Should getMethodDescriptors() return static methods defined in the interfaces the class extends?
>
> Yes, I think it should return static methods as well, similar to how it works for classes.
>
>>If yes, should it recursively find static methods defined in interfaces? For example, the test scenario 1 defines static int getStaticValue() in A1 interface hidden in the inheritance chain. Should it be included to the method descriptor list?
>
> For classes, this approach returns all static methods up to Object.class, with one exception - when a subclass "overrides" a static method from a parent class. Interfaces should follow a similar logic.
>
> - In case of a clash with a class method, the class version should take precedence. (Is it better for compatibility?)
> - If the same method appears in multiple interfaces within the same hierarchy, the version from the most specific sub-interface should be selected.
> - If the method appears in interfaces from different hierarchies, either version can be returned.
Implemented. Could you review new version?
-------------
PR Review Comment: https://git.openjdk.org/jdk/pull/23443#discussion_r2024472470
More information about the client-libs-dev
mailing list