RFR: 8347826: Introspector shows wrong method list after 8071693 [v9]
Sergey Bylokhov
serb at openjdk.org
Wed Mar 26 08:03:14 UTC 2025
On Wed, 26 Mar 2025 06:32:22 GMT, Roman Marchenko <rmarchenko at openjdk.org> wrote:
>> src/java.desktop/share/classes/com/sun/beans/introspect/MethodInfo.java line 114:
>>
>>> 112: }
>>> 113: for (Method method : iface.getMethods()) {
>>> 114: if (!Modifier.isAbstract(method.getModifiers()) && !method.isBridge()) {
>>
>> I have looked into the `Modifier` class to check which other modifiers we have, and I found that you might also want to skip static and private methods. Perhaps method.isDefault() is the method you're looking for? It seems like none of the tests catch that?
>>
>> Also please double check the code a few lines above:
>>
>> method = MethodFinder.findAccessibleMethod(method);
>> if (!method.getDeclaringClass().isInterface()) {
>> method = null; // ignore methods from superclasses
>> }
>>
>> - ~~Why do we need to skip the methods from the interfaces? Maybe we can inject our logic there?~~
>> - The method `MethodFinder.findAccessibleMethod` also checks each method to be `isExported`
>
> Are you thinking of specific test cases that are not covered here? Could you share, please? Or just about code refactoring?
I wonder if we can return non-public or static methods from non-exported interface? In other words are the checks `!Modifier.isAbstract(method.getModifiers()) && !method.isBridge()` are good enough?
-------------
PR Review Comment: https://git.openjdk.org/jdk/pull/23443#discussion_r2013574039
More information about the client-libs-dev
mailing list