diff --git a/spring-expression/src/main/java/org/springframework/expression/spel/support/ReflectionHelper.java b/spring-expression/src/main/java/org/springframework/expression/spel/support/ReflectionHelper.java
index 224ab62c23..be760a2952 100644
--- a/spring-expression/src/main/java/org/springframework/expression/spel/support/ReflectionHelper.java
+++ b/spring-expression/src/main/java/org/springframework/expression/spel/support/ReflectionHelper.java
@@ -55,7 +55,7 @@ public class ReflectionHelper {
Assert.isTrue(expectedArgTypes.size() == suppliedArgTypes.size(),
"Expected argument types and supplied argument types should be arrays of same length");
- ArgsMatchKind match = ArgsMatchKind.EXACT;
+ ArgumentsMatchKind match = ArgumentsMatchKind.EXACT;
for (int i = 0; i < expectedArgTypes.size() && match != null; i++) {
TypeDescriptor suppliedArg = suppliedArgTypes.get(i);
TypeDescriptor expectedArg = expectedArgTypes.get(i);
@@ -68,12 +68,12 @@ public class ReflectionHelper {
}
else {
if (suppliedArg.isAssignableTo(expectedArg)) {
- if (match != ArgsMatchKind.REQUIRES_CONVERSION) {
- match = ArgsMatchKind.CLOSE;
+ if (match != ArgumentsMatchKind.REQUIRES_CONVERSION) {
+ match = ArgumentsMatchKind.CLOSE;
}
}
else if (typeConverter.canConvert(suppliedArg, expectedArg)) {
- match = ArgsMatchKind.REQUIRES_CONVERSION;
+ match = ArgumentsMatchKind.REQUIRES_CONVERSION;
}
else {
match = null;
@@ -144,7 +144,7 @@ public class ReflectionHelper {
Assert.isTrue(expectedArgTypes.get(expectedArgTypes.size() - 1).isArray(),
"Final expected argument should be array type (the varargs parameter)");
- ArgsMatchKind match = ArgsMatchKind.EXACT;
+ ArgumentsMatchKind match = ArgumentsMatchKind.EXACT;
// Check up until the varargs argument:
@@ -161,12 +161,12 @@ public class ReflectionHelper {
else {
if (!expectedArg.equals(suppliedArg)) {
if (suppliedArg.isAssignableTo(expectedArg)) {
- if (match != ArgsMatchKind.REQUIRES_CONVERSION) {
- match = ArgsMatchKind.CLOSE;
+ if (match != ArgumentsMatchKind.REQUIRES_CONVERSION) {
+ match = ArgumentsMatchKind.CLOSE;
}
}
else if (typeConverter.canConvert(suppliedArg, expectedArg)) {
- match = ArgsMatchKind.REQUIRES_CONVERSION;
+ match = ArgumentsMatchKind.REQUIRES_CONVERSION;
}
else {
match = null;
@@ -202,12 +202,12 @@ public class ReflectionHelper {
else {
if (varargsParamType != suppliedArg.getType()) {
if (ClassUtils.isAssignable(varargsParamType, suppliedArg.getType())) {
- if (match != ArgsMatchKind.REQUIRES_CONVERSION) {
- match = ArgsMatchKind.CLOSE;
+ if (match != ArgumentsMatchKind.REQUIRES_CONVERSION) {
+ match = ArgumentsMatchKind.CLOSE;
}
}
else if (typeConverter.canConvert(suppliedArg, TypeDescriptor.valueOf(varargsParamType))) {
- match = ArgsMatchKind.REQUIRES_CONVERSION;
+ match = ArgumentsMatchKind.REQUIRES_CONVERSION;
}
else {
match = null;
@@ -331,8 +331,9 @@ public class ReflectionHelper {
// Check if repackaging is needed:
if (parameterCount != args.length ||
requiredParameterTypes[parameterCount - 1] !=
- (args[argumentCount - 1] == null ? null : args[argumentCount - 1].getClass())) {
- int arraySize = 0; // zero size array if nothing to pass as the varargs parameter
+ (args[argumentCount - 1] != null ? args[argumentCount - 1].getClass() : null)) {
+
+ int arraySize = 0; // zero size array if nothing to pass as the varargs parameter
if (argumentCount >= parameterCount) {
arraySize = argumentCount - (parameterCount - 1);
}
@@ -341,93 +342,26 @@ public class ReflectionHelper {
Object[] newArgs = new Object[parameterCount];
System.arraycopy(args, 0, newArgs, 0, newArgs.length - 1);
- // Now sort out the final argument, which is the varargs one. Before entering this
- // method the arguments should have been converted to the box form of the required type.
- Class> componentType = requiredParameterTypes[parameterCount-1].getComponentType();
- if (componentType.isPrimitive()) {
- if (componentType == Integer.TYPE) {
- int[] repackagedArguments = (int[]) Array.newInstance(componentType,
- arraySize);
- for (int i = 0; i < arraySize; i++) {
- repackagedArguments[i] = ((Integer) args[parameterCount + i - 1]).intValue();
- }
- newArgs[newArgs.length - 1] = repackagedArguments;
- }
- else if (componentType == Float.TYPE) {
- float[] repackagedArguments = (float[]) Array.newInstance(
- componentType, arraySize);
- for (int i = 0; i < arraySize; i++) {
- repackagedArguments[i] = ((Float) args[parameterCount + i - 1]).floatValue();
- }
- newArgs[newArgs.length - 1] = repackagedArguments;
- }
- else if (componentType == Double.TYPE) {
- double[] repackagedArguments = (double[]) Array.newInstance(
- componentType, arraySize);
- for (int i = 0; i < arraySize; i++) {
- repackagedArguments[i] = ((Double) args[parameterCount + i - 1]).doubleValue();
- }
- newArgs[newArgs.length - 1] = repackagedArguments;
- }
- else if (componentType == Short.TYPE) {
- short[] repackagedArguments = (short[]) Array.newInstance(
- componentType, arraySize);
- for (int i = 0; i < arraySize; i++) {
- repackagedArguments[i] = ((Short) args[parameterCount + i - 1]).shortValue();
- }
- newArgs[newArgs.length - 1] = repackagedArguments;
- }
- else if (componentType == Character.TYPE) {
- char[] repackagedArguments = (char[]) Array.newInstance(
- componentType, arraySize);
- for (int i = 0; i < arraySize; i++) {
- repackagedArguments[i] = ((Character) args[parameterCount + i - 1]).charValue();
- }
- newArgs[newArgs.length - 1] = repackagedArguments;
- }
- else if (componentType == Byte.TYPE) {
- byte[] repackagedArguments = (byte[]) Array.newInstance(
- componentType, arraySize);
- for (int i = 0; i < arraySize; i++) {
- repackagedArguments[i] = ((Byte) args[parameterCount + i - 1]).byteValue();
- }
- newArgs[newArgs.length - 1] = repackagedArguments;
- }
- else if (componentType == Boolean.TYPE) {
- boolean[] repackagedArguments = (boolean[]) Array.newInstance(
- componentType, arraySize);
- for (int i = 0; i < arraySize; i++) {
- repackagedArguments[i] = ((Boolean) args[parameterCount + i - 1]).booleanValue();
- }
- newArgs[newArgs.length - 1] = repackagedArguments;
- }
- else if (componentType == Long.TYPE) {
- long[] repackagedArguments = (long[]) Array.newInstance(
- componentType, arraySize);
- for (int i = 0; i < arraySize; i++) {
- repackagedArguments[i] = ((Long) args[parameterCount + i - 1]).longValue();
- }
- newArgs[newArgs.length - 1] = repackagedArguments;
- }
- }
- else {
- Object[] repackagedArguments = (Object[]) Array.newInstance(componentType, arraySize);
- // Copy all but the varargs arguments
- System.arraycopy(args, parameterCount - 1, repackagedArguments, 0, arraySize);
- newArgs[newArgs.length - 1] = repackagedArguments;
+ // Now sort out the final argument, which is the varargs one. Before entering this method,
+ // the arguments should have been converted to the box form of the required type.
+ Class> componentType = requiredParameterTypes[parameterCount - 1].getComponentType();
+ Object repackagedArgs = Array.newInstance(componentType, arraySize);
+ for (int i = 0; i < arraySize; i++) {
+ Array.set(repackagedArgs, i, args[parameterCount - 1 + i]);
}
+ newArgs[newArgs.length - 1] = repackagedArgs;
return newArgs;
}
return args;
}
- public static enum ArgsMatchKind {
+ static enum ArgumentsMatchKind {
- /** An exact match is where the parameter types exactly match what the method/constructor being invoked is expecting */
+ /** An exact match is where the parameter types exactly match what the method/constructor is expecting */
EXACT,
- /** A close match is where the parameter types either exactly match or are assignment compatible with the method/constructor being invoked */
+ /** A close match is where the parameter types either exactly match or are assignment-compatible */
CLOSE,
/** A conversion match is where the type converter must be used to transform some of the parameter types */
@@ -441,24 +375,24 @@ public class ReflectionHelper {
* If the kind indicates that conversion is required for some of the arguments then the arguments that require
* conversion are listed in the argsRequiringConversion array.
*/
- public static class ArgumentsMatchInfo {
+ static class ArgumentsMatchInfo {
- public final ArgsMatchKind kind;
+ private final ArgumentsMatchKind kind;
- ArgumentsMatchInfo(ArgsMatchKind kind) {
+ ArgumentsMatchInfo(ArgumentsMatchKind kind) {
this.kind = kind;
}
public boolean isExactMatch() {
- return (this.kind == ArgsMatchKind.EXACT);
+ return (this.kind == ArgumentsMatchKind.EXACT);
}
public boolean isCloseMatch() {
- return (this.kind == ArgsMatchKind.CLOSE);
+ return (this.kind == ArgumentsMatchKind.CLOSE);
}
public boolean isMatchRequiringConversion() {
- return (this.kind == ArgsMatchKind.REQUIRES_CONVERSION);
+ return (this.kind == ArgumentsMatchKind.REQUIRES_CONVERSION);
}
@Override
diff --git a/spring-expression/src/main/java/org/springframework/expression/spel/support/ReflectiveConstructorResolver.java b/spring-expression/src/main/java/org/springframework/expression/spel/support/ReflectiveConstructorResolver.java
index 835d25cf64..e2482fc7e6 100644
--- a/spring-expression/src/main/java/org/springframework/expression/spel/support/ReflectiveConstructorResolver.java
+++ b/spring-expression/src/main/java/org/springframework/expression/spel/support/ReflectiveConstructorResolver.java
@@ -32,8 +32,7 @@ import org.springframework.expression.EvaluationException;
import org.springframework.expression.TypeConverter;
/**
- * A constructor resolver that uses reflection to locate the constructor that should be
- * invoked
+ * A constructor resolver that uses reflection to locate the constructor that should be invoked.
*
* @author Andy Clement
* @author Juergen Hoeller
@@ -44,12 +43,10 @@ public class ReflectiveConstructorResolver implements ConstructorResolver {
/**
* Locate a constructor on the type. There are three kinds of match that might occur:
*
- * - An exact match where the types of the arguments match the types of the
- * constructor
- *
- An in-exact match where the types we are looking for are subtypes of those
- * defined on the constructor
- *
- A match where we are able to convert the arguments into those expected by the
- * constructor, according to the registered type converter.
+ *
- An exact match where the types of the arguments match the types of the constructor
+ *
- An in-exact match where the types we are looking for are subtypes of those defined on the constructor
+ *
- A match where we are able to convert the arguments into those expected by the constructor, according to the
+ * registered type converter.
*
*/
@Override
@@ -93,11 +90,10 @@ public class ReflectiveConstructorResolver implements ConstructorResolver {
matchInfo = ReflectionHelper.compareArguments(paramDescriptors, argumentTypes, typeConverter);
}
if (matchInfo != null) {
- if (matchInfo.kind == ReflectionHelper.ArgsMatchKind.EXACT) {
+ if (matchInfo.isExactMatch()) {
return new ReflectiveConstructorExecutor(ctor);
}
- else if (matchInfo.kind == ReflectionHelper.ArgsMatchKind.CLOSE ||
- matchInfo.kind == ReflectionHelper.ArgsMatchKind.REQUIRES_CONVERSION) {
+ else if (matchInfo.isCloseMatch() || matchInfo.isMatchRequiringConversion()) {
closeMatch = ctor;
}
}
diff --git a/spring-expression/src/main/java/org/springframework/expression/spel/support/ReflectiveMethodResolver.java b/spring-expression/src/main/java/org/springframework/expression/spel/support/ReflectiveMethodResolver.java
index 70cdb803b2..4ef7fc4332 100644
--- a/spring-expression/src/main/java/org/springframework/expression/spel/support/ReflectiveMethodResolver.java
+++ b/spring-expression/src/main/java/org/springframework/expression/spel/support/ReflectiveMethodResolver.java
@@ -42,8 +42,8 @@ import org.springframework.expression.spel.SpelEvaluationException;
import org.springframework.expression.spel.SpelMessage;
/**
- * Reflection-based {@link MethodResolver} used by default in
- * {@link StandardEvaluationContext} unless explicit method resolvers have been specified.
+ * Reflection-based {@link MethodResolver} used by default in {@link StandardEvaluationContext}
+ * unless explicit method resolvers have been specified.
*
* @author Andy Clement
* @author Juergen Hoeller
@@ -124,7 +124,6 @@ public class ReflectiveMethodResolver implements MethodResolver {
Method closeMatch = null;
int closeMatchDistance = Integer.MAX_VALUE;
- int[] argsToConvert = null;
Method matchRequiringConversion = null;
boolean multipleOptions = false;
@@ -145,10 +144,10 @@ public class ReflectiveMethodResolver implements MethodResolver {
matchInfo = ReflectionHelper.compareArguments(paramDescriptors, argumentTypes, typeConverter);
}
if (matchInfo != null) {
- if (matchInfo.kind == ReflectionHelper.ArgsMatchKind.EXACT) {
+ if (matchInfo.isExactMatch()) {
return new ReflectiveMethodExecutor(method);
}
- else if (matchInfo.kind == ReflectionHelper.ArgsMatchKind.CLOSE) {
+ else if (matchInfo.isCloseMatch()) {
if (!this.useDistance) {
closeMatch = method;
}
@@ -161,7 +160,7 @@ public class ReflectiveMethodResolver implements MethodResolver {
}
}
}
- else if (matchInfo.kind == ReflectionHelper.ArgsMatchKind.REQUIRES_CONVERSION) {
+ else if (matchInfo.isMatchRequiringConversion()) {
if (matchRequiringConversion != null) {
multipleOptions = true;
}
diff --git a/spring-expression/src/test/java/org/springframework/expression/spel/support/ReflectionHelperTests.java b/spring-expression/src/test/java/org/springframework/expression/spel/support/ReflectionHelperTests.java
index 21f4fb1c69..dcf02b11f9 100644
--- a/spring-expression/src/test/java/org/springframework/expression/spel/support/ReflectionHelperTests.java
+++ b/spring-expression/src/test/java/org/springframework/expression/spel/support/ReflectionHelperTests.java
@@ -35,7 +35,7 @@ import org.springframework.expression.spel.SpelMessage;
import org.springframework.expression.spel.SpelUtilities;
import org.springframework.expression.spel.ast.FormatHelper;
import org.springframework.expression.spel.standard.SpelExpression;
-import org.springframework.expression.spel.support.ReflectionHelper.ArgsMatchKind;
+import org.springframework.expression.spel.support.ReflectionHelper.ArgumentsMatchKind;
import static org.junit.Assert.*;
@@ -107,10 +107,10 @@ public class ReflectionHelperTests extends ExpressionTestCase {
StandardTypeConverter tc = new StandardTypeConverter();
// Calling foo(String) with (String) is exact match
- checkMatch(new Class[] {String.class}, new Class[] {String.class}, tc,ArgsMatchKind.EXACT);
+ checkMatch(new Class[] {String.class}, new Class[] {String.class}, tc, ReflectionHelper.ArgumentsMatchKind.EXACT);
// Calling foo(String,Integer) with (String,Integer) is exact match
- checkMatch(new Class[] {String.class, Integer.class}, new Class[] {String.class, Integer.class}, tc, ArgsMatchKind.EXACT);
+ checkMatch(new Class[] {String.class, Integer.class}, new Class[] {String.class, Integer.class}, tc, ArgumentsMatchKind.EXACT);
}
@Test
@@ -118,13 +118,13 @@ public class ReflectionHelperTests extends ExpressionTestCase {
StandardTypeConverter tc = new StandardTypeConverter();
// Calling foo(List) with (ArrayList) is close match (no conversion required)
- checkMatch(new Class[] {ArrayList.class}, new Class[] {List.class}, tc, ArgsMatchKind.CLOSE);
+ checkMatch(new Class[] {ArrayList.class}, new Class[] {List.class}, tc, ArgumentsMatchKind.CLOSE);
// Passing (Sub,String) on call to foo(Super,String) is close match
- checkMatch(new Class[] {Sub.class, String.class}, new Class[] {Super.class, String.class}, tc, ArgsMatchKind.CLOSE);
+ checkMatch(new Class[] {Sub.class, String.class}, new Class[] {Super.class, String.class}, tc, ArgumentsMatchKind.CLOSE);
// Passing (String,Sub) on call to foo(String,Super) is close match
- checkMatch(new Class[] {String.class, Sub.class}, new Class[] {String.class, Super.class}, tc, ArgsMatchKind.CLOSE);
+ checkMatch(new Class[] {String.class, Sub.class}, new Class[] {String.class, Super.class}, tc, ArgumentsMatchKind.CLOSE);
}
@Test
@@ -132,13 +132,13 @@ public class ReflectionHelperTests extends ExpressionTestCase {
StandardTypeConverter tc = new StandardTypeConverter();
// Calling foo(String,int) with (String,Integer) requires boxing conversion of argument one
- checkMatch(new Class[] {String.class, Integer.TYPE}, new Class[] {String.class,Integer.class},tc, ArgsMatchKind.CLOSE);
+ checkMatch(new Class[] {String.class, Integer.TYPE}, new Class[] {String.class,Integer.class},tc, ArgumentsMatchKind.CLOSE);
// Passing (int,String) on call to foo(Integer,String) requires boxing conversion of argument zero
- checkMatch(new Class[] {Integer.TYPE, String.class}, new Class[] {Integer.class, String.class},tc, ArgsMatchKind.CLOSE);
+ checkMatch(new Class[] {Integer.TYPE, String.class}, new Class[] {Integer.class, String.class},tc, ArgumentsMatchKind.CLOSE);
// Passing (int,Sub) on call to foo(Integer,Super) requires boxing conversion of argument zero
- checkMatch(new Class[] {Integer.TYPE, Sub.class}, new Class[] {Integer.class, Super.class}, tc, ArgsMatchKind.CLOSE);
+ checkMatch(new Class[] {Integer.TYPE, Sub.class}, new Class[] {Integer.class, Super.class}, tc, ArgumentsMatchKind.CLOSE);
// Passing (int,Sub,boolean) on call to foo(Integer,Super,Boolean) requires boxing conversion of arguments zero and two
// TODO checkMatch(new Class[] {Integer.TYPE, Sub.class, Boolean.TYPE}, new Class[] {Integer.class, Super.class, Boolean.class}, tc, ArgsMatchKind.REQUIRES_CONVERSION);
@@ -159,34 +159,34 @@ public class ReflectionHelperTests extends ExpressionTestCase {
Class> integerArrayClass = new Integer[0].getClass();
// Passing (String[]) on call to (String[]) is exact match
- checkMatch2(new Class[] {stringArrayClass}, new Class[] {stringArrayClass}, tc, ArgsMatchKind.EXACT);
+ checkMatch2(new Class[] {stringArrayClass}, new Class[] {stringArrayClass}, tc, ArgumentsMatchKind.EXACT);
// Passing (Integer, String[]) on call to (Integer, String[]) is exact match
- checkMatch2(new Class[] {Integer.class, stringArrayClass}, new Class[] {Integer.class, stringArrayClass}, tc, ArgsMatchKind.EXACT);
+ checkMatch2(new Class[] {Integer.class, stringArrayClass}, new Class[] {Integer.class, stringArrayClass}, tc, ArgumentsMatchKind.EXACT);
// Passing (String, Integer, String[]) on call to (String, String, String[]) is exact match
- checkMatch2(new Class[] {String.class, Integer.class, stringArrayClass}, new Class[] {String.class,Integer.class, stringArrayClass}, tc, ArgsMatchKind.EXACT);
+ checkMatch2(new Class[] {String.class, Integer.class, stringArrayClass}, new Class[] {String.class,Integer.class, stringArrayClass}, tc, ArgumentsMatchKind.EXACT);
// Passing (Sub, String[]) on call to (Super, String[]) is exact match
- checkMatch2(new Class[] {Sub.class, stringArrayClass}, new Class[] {Super.class,stringArrayClass}, tc, ArgsMatchKind.CLOSE);
+ checkMatch2(new Class[] {Sub.class, stringArrayClass}, new Class[] {Super.class,stringArrayClass}, tc, ArgumentsMatchKind.CLOSE);
// Passing (Integer, String[]) on call to (String, String[]) is exact match
- checkMatch2(new Class[] {Integer.class, stringArrayClass}, new Class[] {String.class, stringArrayClass}, tc, ArgsMatchKind.REQUIRES_CONVERSION);
+ checkMatch2(new Class[] {Integer.class, stringArrayClass}, new Class[] {String.class, stringArrayClass}, tc, ArgumentsMatchKind.REQUIRES_CONVERSION);
// Passing (Integer, Sub, String[]) on call to (String, Super, String[]) is exact match
- checkMatch2(new Class[] {Integer.class, Sub.class, String[].class}, new Class[] {String.class,Super .class, String[].class}, tc, ArgsMatchKind.REQUIRES_CONVERSION);
+ checkMatch2(new Class[] {Integer.class, Sub.class, String[].class}, new Class[] {String.class,Super .class, String[].class}, tc, ArgumentsMatchKind.REQUIRES_CONVERSION);
// Passing (String) on call to (String[]) is exact match
- checkMatch2(new Class[] {String.class}, new Class[] {stringArrayClass}, tc, ArgsMatchKind.EXACT);
+ checkMatch2(new Class[] {String.class}, new Class[] {stringArrayClass}, tc, ArgumentsMatchKind.EXACT);
// Passing (Integer,String) on call to (Integer,String[]) is exact match
- checkMatch2(new Class[] {Integer.class, String.class}, new Class[] {Integer.class, stringArrayClass}, tc, ArgsMatchKind.EXACT);
+ checkMatch2(new Class[] {Integer.class, String.class}, new Class[] {Integer.class, stringArrayClass}, tc, ArgumentsMatchKind.EXACT);
// Passing (String) on call to (Integer[]) is conversion match (String to Integer)
- checkMatch2(new Class[] {String.class}, new Class[] {integerArrayClass}, tc, ArgsMatchKind.REQUIRES_CONVERSION);
+ checkMatch2(new Class[] {String.class}, new Class[] {integerArrayClass}, tc, ArgumentsMatchKind.REQUIRES_CONVERSION);
// Passing (Sub) on call to (Super[]) is close match
- checkMatch2(new Class[] {Sub.class}, new Class[] {new Super[0].getClass()}, tc, ArgsMatchKind.CLOSE);
+ checkMatch2(new Class[] {Sub.class}, new Class[] {new Super[0].getClass()}, tc, ArgumentsMatchKind.CLOSE);
// Passing (Super) on call to (Sub[]) is not a match
checkMatch2(new Class[] {Super.class}, new Class[] {new Sub[0].getClass()}, tc, null);
@@ -199,9 +199,9 @@ public class ReflectionHelperTests extends ExpressionTestCase {
checkMatch2(new Class[] {Integer.class, Integer.class, String.class}, new Class[] {String.class, String.class, Super[].class}, tc, null);
- checkMatch2(new Class[] {Integer.class, Integer.class, Sub.class}, new Class[] {String.class, String.class, Super[].class}, tc, ArgsMatchKind.REQUIRES_CONVERSION);
+ checkMatch2(new Class[] {Integer.class, Integer.class, Sub.class}, new Class[] {String.class, String.class, Super[].class}, tc, ArgumentsMatchKind.REQUIRES_CONVERSION);
- checkMatch2(new Class[] {Integer.class, Integer.class, Integer.class}, new Class[] {Integer.class, String[].class}, tc, ArgsMatchKind.REQUIRES_CONVERSION);
+ checkMatch2(new Class[] {Integer.class, Integer.class, Integer.class}, new Class[] {Integer.class, String[].class}, tc, ArgumentsMatchKind.REQUIRES_CONVERSION);
// what happens on (Integer,String) passed to (Integer[]) ?
}
@@ -481,7 +481,7 @@ public class ReflectionHelperTests extends ExpressionTestCase {
/**
* Used to validate the match returned from a compareArguments call.
*/
- private void checkMatch(Class[] inputTypes, Class[] expectedTypes, StandardTypeConverter typeConverter, ArgsMatchKind expectedMatchKind) {
+ private void checkMatch(Class[] inputTypes, Class[] expectedTypes, StandardTypeConverter typeConverter, ArgumentsMatchKind expectedMatchKind) {
ReflectionHelper.ArgumentsMatchInfo matchInfo = ReflectionHelper.compareArguments(getTypeDescriptors(expectedTypes), getTypeDescriptors(inputTypes), typeConverter);
if (expectedMatchKind == null) {
assertNull("Did not expect them to match in any way", matchInfo);
@@ -490,13 +490,13 @@ public class ReflectionHelperTests extends ExpressionTestCase {
assertNotNull("Should not be a null match", matchInfo);
}
- if (expectedMatchKind == ArgsMatchKind.EXACT) {
+ if (expectedMatchKind == ArgumentsMatchKind.EXACT) {
assertTrue(matchInfo.isExactMatch());
}
- else if (expectedMatchKind == ArgsMatchKind.CLOSE) {
+ else if (expectedMatchKind == ArgumentsMatchKind.CLOSE) {
assertTrue(matchInfo.isCloseMatch());
}
- else if (expectedMatchKind == ArgsMatchKind.REQUIRES_CONVERSION) {
+ else if (expectedMatchKind == ArgumentsMatchKind.REQUIRES_CONVERSION) {
assertTrue("expected to be a match requiring conversion, but was " + matchInfo, matchInfo.isMatchRequiringConversion());
}
}
@@ -504,22 +504,22 @@ public class ReflectionHelperTests extends ExpressionTestCase {
/**
* Used to validate the match returned from a compareArguments call.
*/
- private void checkMatch2(Class[] inputTypes, Class[] expectedTypes, StandardTypeConverter typeConverter, ArgsMatchKind expectedMatchKind) {
+ private void checkMatch2(Class[] inputTypes, Class[] expectedTypes, StandardTypeConverter typeConverter, ArgumentsMatchKind expectedMatchKind) {
ReflectionHelper.ArgumentsMatchInfo matchInfo = ReflectionHelper.compareArgumentsVarargs(getTypeDescriptors(expectedTypes), getTypeDescriptors(inputTypes), typeConverter);
if (expectedMatchKind == null) {
- assertNull("Did not expect them to match in any way: "+matchInfo, matchInfo);
+ assertNull("Did not expect them to match in any way: " + matchInfo, matchInfo);
}
else {
assertNotNull("Should not be a null match", matchInfo);
}
- if (expectedMatchKind == ArgsMatchKind.EXACT) {
+ if (expectedMatchKind == ArgumentsMatchKind.EXACT) {
assertTrue(matchInfo.isExactMatch());
}
- else if (expectedMatchKind == ArgsMatchKind.CLOSE) {
+ else if (expectedMatchKind == ArgumentsMatchKind.CLOSE) {
assertTrue(matchInfo.isCloseMatch());
}
- else if (expectedMatchKind == ArgsMatchKind.REQUIRES_CONVERSION) {
+ else if (expectedMatchKind == ArgumentsMatchKind.REQUIRES_CONVERSION) {
assertTrue("expected to be a match requiring conversion, but was " + matchInfo, matchInfo.isMatchRequiringConversion());
}
}