desruisseaux commented on code in PR #11425:
URL: https://github.com/apache/maven/pull/11425#discussion_r2511974044
##########
impl/maven-core/src/main/java/org/apache/maven/configuration/internal/EnhancedCompositeBeanHelper.java:
##########
@@ -304,20 +301,17 @@ private Object convertProperty(
* Set field value with cached accessibility.
*/
private void setFieldValue(Object bean, Field field, Object value) throws
IllegalAccessException {
- Boolean isAccessible = ACCESSIBLE_FIELD_CACHE.get(field);
- if (isAccessible == null) {
- isAccessible = field.canAccess(bean);
- if (!isAccessible) {
- field.setAccessible(true);
- isAccessible = true;
- }
- ACCESSIBLE_FIELD_CACHE.put(field, isAccessible);
- } else if (!isAccessible) {
+ boolean wasAccessible = field.canAccess(bean);
+ if (!wasAccessible) {
field.setAccessible(true);
Review Comment:
This code assumes that the same `Field` object will not be set by two
threads in same time. It seems to imply that `EnhancedCompositeBeanHelper` is
not really thread-safe. If this limitation okay?
--
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]