Merge branch '7.0.x'

This commit is contained in:
Sam Brannen
2026-04-06 16:56:26 +02:00
5 changed files with 28 additions and 3 deletions
@@ -74,7 +74,12 @@ class BridgeMethodResolverTests {
assertThat(bridgedMethod.isBridge()).isFalse();
assertThat(bridgedMethod.getName()).isEqualTo("add");
assertThat(bridgedMethod.getParameterCount()).isEqualTo(1);
assertThat(bridgedMethod.getParameterTypes()[0]).isEqualTo(Date.class);
if (IdeUtils.runningInEclipse()) {
assertThat(bridgedMethod.getParameterTypes()).containsOnly(Serializable.class);
}
else {
assertThat(bridgedMethod.getParameterTypes()).containsOnly(Date.class);
}
}
@Test
@@ -490,10 +495,12 @@ class BridgeMethodResolverTests {
interface DefaultMethods extends InterfaceMethods<Integer> {
@Override
default Integer getValue() {
return 0;
}
@Override
default Integer[] getValues() {
return new Integer[0];
}
@@ -19,6 +19,7 @@ package org.springframework.expression.spel;
import java.util.ArrayList;
import java.util.List;
import org.junit.jupiter.api.BeforeEach;
import org.junit.jupiter.api.Test;
import org.springframework.expression.ConstructorResolver;
@@ -41,6 +42,11 @@ import static org.assertj.core.api.Assertions.assertThatException;
*/
class ConstructorInvocationTests extends AbstractExpressionTests {
@BeforeEach
void resetCounter() {
Tester.counter = 0;
}
@Test
void constructorWithArgument() {
evaluate("new String('hello world')", "hello world", String.class);
@@ -2967,6 +2967,7 @@ public class SpelCompilationCoverageTests extends AbstractExpressionTests {
assertThat((Boolean) expression.getValue(tvar)).isFalse();
TestClass7 tc7 = new TestClass7();
TestClass7.reset();
expression = parse("property == 'UK'");
assertThat((Boolean) expression.getValue(tc7)).isTrue();
TestClass7.property = null;
@@ -38,6 +38,7 @@ import java.util.concurrent.atomic.AtomicInteger;
import org.assertj.core.api.InstanceOfAssertFactories;
import org.jspecify.annotations.Nullable;
import org.junit.jupiter.api.BeforeEach;
import org.junit.jupiter.api.Test;
import org.springframework.core.MethodParameter;
@@ -85,6 +86,12 @@ class SpelReproTests extends AbstractExpressionTests {
private static final ParserContext DOLLARSQUARE_TEMPLATE_PARSER_CONTEXT = new TemplateParserContext("$[", "]");
@BeforeEach
void resetGoo() {
Goo.reset();
}
@Test
void NPE_SPR5661() {
evaluate("joinThreeStrings('a',null,'c')", "anullc", String.class);
@@ -1879,7 +1886,11 @@ class SpelReproTests extends AbstractExpressionTests {
static class Goo {
public static Goo instance = new Goo();
public static Goo instance;
static void reset() {
instance = new Goo();
}
public String bar = "key";
@@ -65,7 +65,7 @@ class MethodAssertTests {
}
@Test
void haDeclaringClassWithWrongClass() {
void hasDeclaringClassWithWrongClass() {
Method method = ReflectionUtils.findMethod(TestData.class, "counter");
assertThatExceptionOfType(AssertionError.class)
.isThrownBy(() -> assertThat(method).hasDeclaringClass(Method.class))