RFR: 8308152: PropertyDescriptor should work with overridden generic getter method

Sergey Bylokhov serb at openjdk.org
Wed May 31 22:28:35 UTC 2023


Description of the bug, copied from https://github.com/openjdk/jdk/pull/7190


> In jdk 9 we started to sort the list of methods for each class for two reasons:
>  1. We had a number of bugs which state that our JavaBeans randomly does not work, examples: JDK-6807471[1] , JDK-6788525[2], the reason was that the order of methods from Class.getMethods() is not specified.
>  2. We tried to sort methods so the more specific returns types come first, this was done because our logic for selecting the correct method did not work properly. 
> 
> The second issue above was fixed by the separate change [JDK-8196373](https://bugs.openjdk.java.net/browse/JDK-8196373) so now we only need to sort the list of methods in any order and do not care about return types.
> 

Unfortunatly it was found that we have two code paths to create a PropertyDescriptor, one of them is used by the `Introspector.getBeanInfo` and was patched by the [JDK-8196373](https://bugs.openjdk.java.net/browse/JDK-8196373) and another when the PropertyDescriptor is created directly and it still affected by that bug.

The code added by this patch is the same we already use in PropertyInfo.java, see
https://github.com/openjdk/jdk/blob/master/src/java.desktop/share/classes/com/sun/beans/introspect/PropertyInfo.java#L81

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

Commit messages:
 - 8308152: PropertyDescriptor should work with overridden generic getter method

Changes: https://git.openjdk.org/jdk/pull/14228/files
 Webrev: https://webrevs.openjdk.org/?repo=jdk&pr=14228&range=00
  Issue: https://bugs.openjdk.org/browse/JDK-8308152
  Stats: 107 lines in 2 files changed: 105 ins; 0 del; 2 mod
  Patch: https://git.openjdk.org/jdk/pull/14228.diff
  Fetch: git fetch https://git.openjdk.org/jdk.git pull/14228/head:pull/14228

PR: https://git.openjdk.org/jdk/pull/14228



More information about the client-libs-dev mailing list