seregamorph opened a new pull request, #234: URL: https://github.com/apache/commons-beanutils/pull/234
Once https://github.com/apache/commons-beanutils/pull/68 was merged I realized it can work not properly in a concurrent environment 🤦. I made some tests and it was pretty hard to trigger failure - the merged fix is relatively resistant and a combination of random factors should happen simultaneously, also it only happened with high number of threads (for this reason I believe `1.x` fix can stay as is). But finally I got proof there is a problem still and tried to find a better solution without erasing the cache. So, how the updated implementation works: now there is no more `PropertyDescriptor.setWriteMethod` and the shared cached `PropertyDescriptor` object is not updated anymore as there is a risk to define a setter method for a field which is wrong in case if getter is defined in super-class and it has several subtypes defining their own setters (with generic types). Instead, in the `IntrospectionContext` the `PropertyDescriptor` is just replaced with a copy of the shared object with configured setter. This should be valid, because `IntrospectionContext` is not a cached type. If you run `Jira541TestCase.testFluentBeanIntrospectorOnOverriddenSetter` in debugger, you can see that at line `FluentPropertyBeanIntrospector:163` which makes this call ```java PropertyDescriptor fluentPropertyDescriptor = new PropertyDescriptor( pd.getName(), pd.getReadMethod(), m); // replace existing (possibly interited from super-class) to one specific to current class icontext.addPropertyDescriptor(fluentPropertyDescriptor); ``` the existing object is replaced with the copied by the same name. Sorry for missing this initially, I just got this insight. But I'd like to notice that initial fix (merged yesterday) makes the situation much better than it was. I hope you will find time to check this carefully in the debugger and see the specific how the fluent setters logic is working. Thanks for your attention and trust. -- This is an automated message from the Apache Git Service. To respond to the message, please log on to GitHub and use the URL above to go to the specific comment. To unsubscribe, e-mail: [email protected] For queries about this service, please contact Infrastructure at: [email protected]
