Merge branch '3.3.x' into 3.4.x
Build and Deploy Snapshot / Build and Deploy Snapshot (push) Has been cancelled Details
CI / ${{ matrix.os.name}} | Java ${{ matrix.java.version}} (map[early-access:true toolchain:true version:24], map[id:${{ vars.UBUNTU_MEDIUM || 'ubuntu-latest' }} name:Linux]) (push) Has been cancelled Details
CI / ${{ matrix.os.name}} | Java ${{ matrix.java.version}} (map[early-access:true toolchain:true version:24], map[id:windows-latest name:Windows]) (push) Has been cancelled Details
CI / ${{ matrix.os.name}} | Java ${{ matrix.java.version}} (map[toolchain:false version:17], map[id:${{ vars.UBUNTU_MEDIUM || 'ubuntu-latest' }} name:Linux]) (push) Has been cancelled Details
CI / ${{ matrix.os.name}} | Java ${{ matrix.java.version}} (map[toolchain:false version:17], map[id:windows-latest name:Windows]) (push) Has been cancelled Details
CI / ${{ matrix.os.name}} | Java ${{ matrix.java.version}} (map[toolchain:false version:21], map[id:${{ vars.UBUNTU_MEDIUM || 'ubuntu-latest' }} name:Linux]) (push) Has been cancelled Details
CI / ${{ matrix.os.name}} | Java ${{ matrix.java.version}} (map[toolchain:false version:21], map[id:windows-latest name:Windows]) (push) Has been cancelled Details
CI / ${{ matrix.os.name}} | Java ${{ matrix.java.version}} (map[toolchain:false version:22], map[id:${{ vars.UBUNTU_MEDIUM || 'ubuntu-latest' }} name:Linux]) (push) Has been cancelled Details
CI / ${{ matrix.os.name}} | Java ${{ matrix.java.version}} (map[toolchain:false version:22], map[id:windows-latest name:Windows]) (push) Has been cancelled Details
CI / ${{ matrix.os.name}} | Java ${{ matrix.java.version}} (map[toolchain:true version:23], map[id:${{ vars.UBUNTU_MEDIUM || 'ubuntu-latest' }} name:Linux]) (push) Has been cancelled Details
CI / ${{ matrix.os.name}} | Java ${{ matrix.java.version}} (map[toolchain:true version:23], map[id:windows-latest name:Windows]) (push) Has been cancelled Details
Run System Tests / Java ${{ matrix.java.version}} (map[toolchain:false version:17]) (push) Has been cancelled Details
Run System Tests / Java ${{ matrix.java.version}} (map[toolchain:true version:21]) (push) Has been cancelled Details
Build and Deploy Snapshot / Trigger Docs Build (push) Has been cancelled Details
Build and Deploy Snapshot / Verify (push) Has been cancelled Details

Closes gh-45300
This commit is contained in:
Andy Wilkinson 2025-04-25 15:53:09 +01:00
commit e47d87f54a
5 changed files with 42 additions and 8 deletions

View File

@ -1,5 +1,5 @@
/*
* Copyright 2012-2023 the original author or authors.
* Copyright 2012-2025 the original author or authors.
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
@ -21,6 +21,7 @@ import java.util.List;
import org.springframework.boot.configurationmetadata.ConfigurationMetadataProperty;
import org.springframework.boot.configurationmetadata.ConfigurationMetadataRepository;
import org.springframework.boot.configurationmetadata.Deprecation.Level;
/**
* A changelog containing differences computed from two repositories of configuration
@ -32,6 +33,7 @@ import org.springframework.boot.configurationmetadata.ConfigurationMetadataRepos
* @author Stephane Nicoll
* @author Andy Wilkinson
* @author Phillip Webb
* @author Yoobin Yoon
*/
record Changelog(String oldVersionNumber, String newVersionNumber, List<Difference> differences) {
@ -54,10 +56,15 @@ record Changelog(String oldVersionNumber, String newVersionNumber, List<Differen
}
}
for (ConfigurationMetadataProperty newProperty : newMetadata.getAllProperties().values()) {
if ((!seenIds.contains(newProperty.getId())) && (!newProperty.isDeprecated())) {
if (!seenIds.contains(newProperty.getId())) {
if (newProperty.isDeprecated() && newProperty.getDeprecation().getLevel() == Level.ERROR) {
differences.add(new Difference(DifferenceType.DELETED, null, newProperty));
}
else if (!newProperty.isDeprecated()) {
differences.add(new Difference(DifferenceType.ADDED, null, newProperty));
}
}
}
return List.copyOf(differences);
}

View File

@ -1,5 +1,5 @@
/*
* Copyright 2012-2023 the original author or authors.
* Copyright 2012-2025 the original author or authors.
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
@ -29,6 +29,7 @@ import static org.assertj.core.api.Assertions.assertThat;
*
* @author Stephane Nicoll
* @author Andy Wilkinson
* @author Yoobin Yoon
*/
class ChangelogTests {
@ -38,7 +39,7 @@ class ChangelogTests {
assertThat(differences).isNotNull();
assertThat(differences.oldVersionNumber()).isEqualTo("1.0");
assertThat(differences.newVersionNumber()).isEqualTo("2.0");
assertThat(differences.differences()).hasSize(4);
assertThat(differences.differences()).hasSize(5);
List<Difference> added = differences.differences()
.stream()
.filter((difference) -> difference.type() == DifferenceType.ADDED)
@ -49,10 +50,12 @@ class ChangelogTests {
.stream()
.filter((difference) -> difference.type() == DifferenceType.DELETED)
.toList();
assertThat(deleted).hasSize(2)
assertThat(deleted).hasSize(3)
.anySatisfy((entry) -> assertProperty(entry.oldProperty(), "test.delete", String.class, "delete"))
.anySatisfy(
(entry) -> assertProperty(entry.newProperty(), "test.delete.deprecated", String.class, "delete"));
(entry) -> assertProperty(entry.newProperty(), "test.delete.deprecated", String.class, "delete"))
.anySatisfy((entry) -> assertProperty(entry.newProperty(), "test.removed.directly", String.class,
"directlyRemoved"));
List<Difference> deprecated = differences.differences()
.stream()
.filter((difference) -> difference.type() == DifferenceType.DEPRECATED)

View File

@ -26,6 +26,15 @@
"deprecation": {
"level": "warning"
}
},
{
"name": "test.delete.error",
"type": "java.lang.String",
"description": "Test delete error.",
"defaultValue": "delete",
"deprecation": {
"level": "error"
}
}
]
}

View File

@ -31,6 +31,17 @@
"replacement": "test.add",
"reason": "it was just bad"
}
},
{
"name": "test.removed.directly",
"type": "java.lang.String",
"description": "Test property removed without prior deprecation.",
"defaultValue": "directlyRemoved",
"deprecation": {
"level": "error",
"replacement": "test.new.property",
"reason": "removed in third-party library without deprecation"
}
}
]
}

View File

@ -32,4 +32,8 @@ _None_.
| `test.delete.deprecated`
| `test.add`
| it was just bad
| `test.removed.directly`
| `test.new.property`
| removed in third-party library without deprecation
|======================