Skip to content

Commit 9db16e4

Browse files
committed
Merge branch '7.0.x'
# Conflicts: # framework-platform/framework-platform.gradle
2 parents ec8f0ca + 665c9ad commit 9db16e4

8 files changed

Lines changed: 27 additions & 13 deletions

File tree

framework-platform/framework-platform.gradle

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -9,7 +9,7 @@ javaPlatform {
99
dependencies {
1010
api(platform("com.fasterxml.jackson:jackson-bom:2.21.2"))
1111
api(platform("io.micrometer:micrometer-bom:1.16.5"))
12-
api(platform("io.netty:netty-bom:4.2.12.Final"))
12+
api(platform("io.netty:netty-bom:4.2.13.Final"))
1313
api(platform("io.projectreactor:reactor-bom:2025.0.5"))
1414
api(platform("io.rsocket:rsocket-bom:1.1.5"))
1515
api(platform("org.apache.groovy:groovy-bom:5.0.5"))
@@ -120,7 +120,7 @@ dependencies {
120120
api("org.glassfish:jakarta.el:4.0.2")
121121
api("org.graalvm.sdk:graal-sdk:22.3.1")
122122
api("org.hamcrest:hamcrest:3.0")
123-
api("org.hibernate.orm:hibernate-core:7.3.2.Final")
123+
api("org.hibernate.orm:hibernate-core:7.3.3.Final")
124124
api("org.hibernate.validator:hibernate-validator:9.1.0.Final")
125125
api("org.hsqldb:hsqldb:2.7.4")
126126
api("org.htmlunit:htmlunit:4.21.0")

spring-beans/src/main/java/org/springframework/beans/AbstractNestablePropertyAccessor.java

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -956,8 +956,8 @@ private PropertyTokenHolder getPropertyNameTokens(String propertyName) {
956956
actualName = propertyName.substring(0, keyStart);
957957
}
958958
String key = propertyName.substring(keyStart + PROPERTY_KEY_PREFIX.length(), keyEnd);
959-
if (key.length() > 1 && (key.startsWith("'") && key.endsWith("'")) ||
960-
(key.startsWith("\"") && key.endsWith("\""))) {
959+
if (key.length() > 1 && ((key.startsWith("'") && key.endsWith("'")) ||
960+
(key.startsWith("\"") && key.endsWith("\"")))) {
961961
key = key.substring(1, key.length() - 1);
962962
}
963963
keys.add(key);

spring-beans/src/main/java/org/springframework/beans/PropertyAccessorUtils.java

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -154,7 +154,8 @@ public static String canonicalPropertyName(@Nullable String propertyName) {
154154
PropertyAccessor.PROPERTY_KEY_SUFFIX, keyStart + PropertyAccessor.PROPERTY_KEY_PREFIX.length());
155155
if (keyEnd != -1) {
156156
String key = sb.substring(keyStart + PropertyAccessor.PROPERTY_KEY_PREFIX.length(), keyEnd);
157-
if ((key.startsWith("'") && key.endsWith("'")) || (key.startsWith("\"") && key.endsWith("\""))) {
157+
if (key.length() > 1 && ((key.startsWith("'") && key.endsWith("'")) ||
158+
(key.startsWith("\"") && key.endsWith("\"")))) {
158159
sb.delete(keyStart + 1, keyStart + 2);
159160
sb.delete(keyEnd - 2, keyEnd - 1);
160161
keyEnd = keyEnd - 2;

spring-beans/src/test/java/org/springframework/beans/AbstractPropertyAccessorTests.java

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1413,6 +1413,8 @@ void getAndSetIndexedProperties() {
14131413
assertThat(accessor.getPropertyValue("map[key5[foo]].name")).isEqualTo("name8");
14141414
assertThat(accessor.getPropertyValue("map['key5[foo]'].name")).isEqualTo("name8");
14151415
assertThat(accessor.getPropertyValue("map[\"key5[foo]\"].name")).isEqualTo("name8");
1416+
assertThat(accessor.getPropertyValue("map['].name")).isEqualTo("name9");
1417+
assertThat(accessor.getPropertyValue("map[\"].name")).isEqualTo("name9");
14161418
assertThat(accessor.getPropertyValue("iterableMap[key1].name")).isEqualTo("nameC");
14171419
assertThat(accessor.getPropertyValue("iterableMap[key2][0].name")).isEqualTo("nameA");
14181420
assertThat(accessor.getPropertyValue("iterableMap[key2][1].name")).isEqualTo("nameB");

spring-beans/src/test/java/org/springframework/beans/PropertyAccessorUtilsTests.java

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -79,6 +79,10 @@ void canonicalPropertyName() {
7979
assertThat(PropertyAccessorUtils.canonicalPropertyName("map[key1].name")).isEqualTo("map[key1].name");
8080
assertThat(PropertyAccessorUtils.canonicalPropertyName("map['key1'].name")).isEqualTo("map[key1].name");
8181
assertThat(PropertyAccessorUtils.canonicalPropertyName("map[\"key1\"].name")).isEqualTo("map[key1].name");
82+
assertThat(PropertyAccessorUtils.canonicalPropertyName("map['key1]")).isEqualTo("map['key1]");
83+
assertThat(PropertyAccessorUtils.canonicalPropertyName("map[\"key1]")).isEqualTo("map[\"key1]");
84+
assertThat(PropertyAccessorUtils.canonicalPropertyName("map[']")).isEqualTo("map[']");
85+
assertThat(PropertyAccessorUtils.canonicalPropertyName("map[\"]")).isEqualTo("map[\"]");
8286
}
8387

8488
@Test

spring-beans/src/testFixtures/java/org/springframework/beans/testfixture/beans/IndexedTestBean.java

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -76,6 +76,7 @@ public void populate() {
7676
TestBean tb6 = new TestBean("name6", 0);
7777
TestBean tb7 = new TestBean("name7", 0);
7878
TestBean tb8 = new TestBean("name8", 0);
79+
TestBean tb9 = new TestBean("name9", 0);
7980
TestBean tbA = new TestBean("nameA", 0);
8081
TestBean tbB = new TestBean("nameB", 0);
8182
TestBean tbC = new TestBean("nameC", 0);
@@ -104,6 +105,8 @@ public void populate() {
104105
list.add(tbY);
105106
this.map.put("key4", list);
106107
this.map.put("key5[foo]", tb8);
108+
this.map.put("'", tb9);
109+
this.map.put("\"", tb9);
107110
this.myTestBeans = new MyTestBeans(tbZ);
108111
}
109112

spring-core/src/main/java/org/springframework/core/ResolvableType.java

Lines changed: 0 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1539,9 +1539,6 @@ static ResolvableType forType(
15391539
return new ResolvableType(type, null, typeProvider, variableResolver);
15401540
}
15411541

1542-
// Purge empty entries on access since we don't have a clean-up thread or the like.
1543-
cache.purgeUnreferencedEntries();
1544-
15451542
// Check the cache - we may have a ResolvableType which has been resolved before...
15461543
ResolvableType resultType = new ResolvableType(type, typeProvider, variableResolver);
15471544
ResolvableType cachedType = cache.get(resultType);

spring-core/src/main/java/org/springframework/util/ConcurrentReferenceHashMap.java

Lines changed: 12 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -499,10 +499,17 @@ public void clear() {
499499
}
500500

501501
/**
502-
* Remove any entries that have been garbage collected and are no longer referenced.
503-
* Under normal circumstances garbage collected entries are automatically purged as
504-
* items are added or removed from the Map. This method can be used to force a purge,
505-
* and is useful when the Map is read frequently but updated less often.
502+
* Remove any entries that have been garbage-collected and are no longer referenced.
503+
* Note that this call implies segment locking and can lead to thread contention.
504+
* <p>Under normal circumstances, garbage-collected entries are automatically purged as
505+
* items are added or removed from the Map. This method can be used to force a purge
506+
* which is useful when the Map is read frequently but hardly ever updated anymore.
507+
* <p>Note that it may be preferable to simply {@link #clear() clear} the entire cache at
508+
* certain points of the lifecycle, not just dropping unreferenced entries but even the
509+
* entire cache content: assuming that most entries in the cache won't be needed anymore
510+
* after certain processing phases, therefore rather rebuilding the cache going forward.
511+
* @since 4.1.1
512+
* @see #clear()
506513
*/
507514
public void purgeUnreferencedEntries() {
508515
for (Segment segment : this.segments) {
@@ -716,7 +723,7 @@ void restructureIfNecessary(boolean allowResize) {
716723
int currCount = this.count.get();
717724
boolean needsResize = allowResize && (currCount > 0 && currCount >= this.resizeThreshold);
718725
Reference<K, V> ref = this.referenceManager.pollForPurge();
719-
if (ref != null || (needsResize)) {
726+
if (ref != null || needsResize) {
720727
restructure(allowResize, ref);
721728
}
722729
}

0 commit comments

Comments
 (0)