polishing

This commit is contained in:
Keith Donald
2011-06-05 05:46:27 +00:00
parent c84cccf06d
commit c306afed63
8 changed files with 86 additions and 29 deletions

View File

@@ -106,7 +106,7 @@ public class FunctionReference extends SpelNodeImpl {
try {
ReflectionUtils.makeAccessible(method);
Object result = method.invoke(method.getClass(), functionArgs);
return new TypedValue(result, new TypeDescriptor(new MethodParameter(method,-1)).narrowType(result));
return new TypedValue(result, new TypeDescriptor(new MethodParameter(method,-1)).narrow(result));
}
catch (Exception ex) {
throw new SpelEvaluationException(getStartPosition(), ex, SpelMessage.EXCEPTION_DURING_FUNCTION_CALL,

View File

@@ -30,7 +30,6 @@ import org.springframework.expression.spel.SpelMessage;
import org.springframework.util.Assert;
import org.springframework.util.ClassUtils;
import org.springframework.util.MethodInvoker;
import org.springframework.util.ObjectUtils;
/**
* Utility methods used by the reflection resolver code to discover the appropriate
@@ -219,13 +218,12 @@ public class ReflectionHelper {
// All remaining parameters must be of this type or convertable to this type
for (int i = expectedArgTypes.size() - 1; i < suppliedArgTypes.size(); i++) {
TypeDescriptor suppliedArg = suppliedArgTypes.get(i);
if (!ObjectUtils.nullSafeEquals(varargsParameterType, suppliedArg)) {
if (suppliedArg == null) {
if (varargsParameterType.isPrimitive()) {
match = null;
}
}
else {
if (suppliedArg == null) {
if (varargsParameterType.isPrimitive()) {
match = null;
}
} else {
if (varargsParameterType != suppliedArg.getType()) {
if (ClassUtils.isAssignable(varargsParameterType, suppliedArg.getType())) {
if (match != ArgsMatchKind.REQUIRES_CONVERSION) {
match = ArgsMatchKind.CLOSE;

View File

@@ -67,7 +67,7 @@ class ReflectiveMethodExecutor implements MethodExecutor {
}
ReflectionUtils.makeAccessible(this.method);
Object value = this.method.invoke(target, arguments);
return new TypedValue(value, new TypeDescriptor(new MethodParameter(this.method, -1)).narrowType(value));
return new TypedValue(value, new TypeDescriptor(new MethodParameter(this.method, -1)).narrow(value));
}
catch (Exception ex) {
throw new AccessException("Problem invoking method: " + this.method, ex);

View File

@@ -509,7 +509,7 @@ public class ReflectivePropertyAccessor implements PropertyAccessor {
ReflectionUtils.makeAccessible((Method) member);
}
Object value = ((Method) member).invoke(target);
return new TypedValue(value, typeDescriptor.narrowType(value));
return new TypedValue(value, typeDescriptor.narrow(value));
}
catch (Exception ex) {
throw new AccessException("Unable to access property '" + name + "' through getter", ex);
@@ -521,7 +521,7 @@ public class ReflectivePropertyAccessor implements PropertyAccessor {
ReflectionUtils.makeAccessible((Field)member);
}
Object value = ((Field)member).get(target);
return new TypedValue(value, typeDescriptor.narrowType(value));
return new TypedValue(value, typeDescriptor.narrow(value));
}
catch (Exception ex) {
throw new AccessException("Unable to access field: " + name, ex);