Merge branch '7.0.x'

This commit is contained in:
Juergen Hoeller
2026-04-29 21:53:07 +02:00
4 changed files with 12 additions and 6 deletions
@@ -84,7 +84,7 @@ public abstract class AbstractValueAdaptingCache implements Cache {
* @return the value to return to the user
*/
protected @Nullable Object fromStoreValue(@Nullable Object storeValue) {
if (this.allowNullValues && storeValue == NullValue.INSTANCE) {
if (this.allowNullValues && storeValue instanceof NullValue) {
return null;
}
return storeValue;
@@ -24,7 +24,9 @@ import java.util.concurrent.atomic.AtomicInteger;
import org.junit.jupiter.api.Test;
import org.springframework.beans.BeanUtils;
import org.springframework.cache.Cache;
import org.springframework.cache.support.NullValue;
import static org.assertj.core.api.Assertions.assertThat;
@@ -72,6 +74,12 @@ public abstract class AbstractCacheTests<T extends Cache> {
assertThat(cache.get(key).get()).isNull();
assertThat(cache.get(key, String.class)).isNull();
assertThat(cache.get(key, Object.class)).isNull();
cache.put(key, BeanUtils.instantiateClass(NullValue.class));
assertThat(cache.get(key)).isNotNull();
assertThat(cache.get(key).get()).isNull();
assertThat(cache.get(key, String.class)).isNull();
assertThat(cache.get(key, Object.class)).isNull();
}
@Test
@@ -36,10 +36,9 @@ public abstract class AbstractValueAdaptingCacheTests<T extends AbstractValueAda
protected void cachePutNullValueAllowNullFalse() {
T cache = getCache(false);
String key = createRandomKey();
assertThatIllegalArgumentException().isThrownBy(() ->
cache.put(key, null))
.withMessageContaining(CACHE_NAME_NO_NULL)
.withMessageContaining("is configured to not allow null values but null was provided");
assertThatIllegalArgumentException().isThrownBy(() -> cache.put(key, null))
.withMessageContaining(CACHE_NAME_NO_NULL)
.withMessageContaining("is configured to not allow null values but null was provided");
}
}
@@ -854,7 +854,6 @@ public class AntPathMatcher implements PathMatcher {
*/
private static class PatternInfo {
private final @Nullable String pattern;
private int uriVars;