gnodet commented on code in PR #11425:
URL: https://github.com/apache/maven/pull/11425#discussion_r2518437006
##########
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:
Good catch. I'll remove the `setAccessible(false)`, as once the field has
been made accessible, there's no real need to un-expose it.
--
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]