@@ -138,7 +138,8 @@ public TypedValue read(EvaluationContext context, Object target, String name) th
138
138
if (method != null ) {
139
139
try {
140
140
ReflectionUtils .makeAccessible (method );
141
- return new TypedValue (method .invoke (target ),invoker .typeDescriptor );
141
+ Object value = method .invoke (target );
142
+ return new TypedValue (value , invoker .typeDescriptor .narrow (value ));
142
143
}
143
144
catch (Exception ex ) {
144
145
throw new AccessException ("Unable to access property '" + name + "' through getter" , ex );
@@ -147,7 +148,7 @@ public TypedValue read(EvaluationContext context, Object target, String name) th
147
148
}
148
149
149
150
if (invoker == null || invoker .member instanceof Field ) {
150
- Field field = (Field ) (invoker == null ? null : invoker .member );
151
+ Field field = (Field ) (invoker == null ? null : invoker .member );
151
152
if (field == null ) {
152
153
field = findField (name , type , target instanceof Class );
153
154
if (field != null ) {
@@ -158,7 +159,8 @@ public TypedValue read(EvaluationContext context, Object target, String name) th
158
159
if (field != null ) {
159
160
try {
160
161
ReflectionUtils .makeAccessible (field );
161
- return new TypedValue (field .get (target ),invoker .typeDescriptor );
162
+ Object value = field .get (target );
163
+ return new TypedValue (value , invoker .typeDescriptor .narrow (value ));
162
164
}
163
165
catch (Exception ex ) {
164
166
throw new AccessException ("Unable to access field: " + name , ex );
@@ -183,7 +185,7 @@ public boolean canWrite(EvaluationContext context, Object target, String name) t
183
185
// Treat it like a property
184
186
PropertyDescriptor propertyDescriptor = null ;
185
187
try {
186
- propertyDescriptor = new PropertyDescriptor (name ,null ,method );
188
+ propertyDescriptor = new PropertyDescriptor (name , null , method );
187
189
}
188
190
catch (IntrospectionException ex ) {
189
191
throw new AccessException ("Unable to access property '" + name + "' through setter " +method , ex );
0 commit comments