On Thu, 27 Mar 2025 08:12:00 GMT, Roman Marchenko <rmarche...@openjdk.org> 
wrote:

>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.

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

PR Review Comment: https://git.openjdk.org/jdk/pull/23443#discussion_r2024031331

Reply via email to