Merge branch '6.0.x'

This commit is contained in:
Sam Brannen
2023-06-22 15:12:25 +02:00
14 changed files with 27 additions and 30 deletions

View File

@@ -349,9 +349,9 @@ public class ReflectivePropertyAccessor implements PropertyAccessor {
@Nullable
private Method findGetterForProperty(String propertyName, Class<?> clazz, Object target) {
boolean targetIsaClass = (target instanceof Class);
Method method = findGetterForProperty(propertyName, clazz, targetIsaClass);
if (method == null && targetIsaClass) {
boolean targetIsAClass = (target instanceof Class);
Method method = findGetterForProperty(propertyName, clazz, targetIsAClass);
if (method == null && targetIsAClass) {
// Fallback for getter instance methods in java.lang.Class.
method = findGetterForProperty(propertyName, Class.class, false);
}

View File

@@ -544,7 +544,7 @@ class EvaluationTests extends AbstractExpressionTests {
pattern += "?";
assertThat(pattern).hasSize(1001);
evaluateAndCheckError("'abc' matches '" + pattern + "'", Boolean.class, SpelMessage.MAX_REGEX_LENGTH_EXCEEDED);
evaluateAndCheckError("'X' matches '" + pattern + "'", Boolean.class, SpelMessage.MAX_REGEX_LENGTH_EXCEEDED);
}
}

View File

@@ -50,7 +50,7 @@ class KotlinSpelReproTests {
val expr = parser.parseExpression("#key.startsWith('hello')")
context.registerFunction("suspendingGet", Config::class.java.getMethod("suspendingGet", String::class.java, Continuation::class.java))
context.setVariable("key", "hello world")
assertThat(expr .getValue(context, Boolean::class.java)).isTrue()
assertThat(expr.getValue(context, Boolean::class.java)).isTrue()
context.setVariable("key", "")
assertThat(expr.getValue(context, Boolean::class.java)).isFalse()
}