Polish "Fix changelog generator missing directly removed properties"

See gh-45267
This commit is contained in:
Andy Wilkinson
2025-04-25 15:48:54 +01:00
parent 30a679872c
commit 8869f769c1
4 changed files with 16 additions and 12 deletions

View File

@@ -21,7 +21,7 @@ import java.util.List;
import org.springframework.boot.configurationmetadata.ConfigurationMetadataProperty;
import org.springframework.boot.configurationmetadata.ConfigurationMetadataRepository;
import org.springframework.boot.configurationmetadata.Deprecation;
import org.springframework.boot.configurationmetadata.Deprecation.Level;
/**
* A changelog containing differences computed from two repositories of configuration
@@ -50,19 +50,14 @@ record Changelog(String oldVersionNumber, String newVersionNumber, List<Differen
String id = oldProperty.getId();
seenIds.add(id);
ConfigurationMetadataProperty newProperty = newMetadata.getAllProperties().get(id);
if (newProperty == null) {
differences.add(new Difference(DifferenceType.DELETED, oldProperty, null));
}
else {
Difference difference = Difference.compute(oldProperty, newProperty);
if (difference != null) {
differences.add(difference);
}
Difference difference = Difference.compute(oldProperty, newProperty);
if (difference != null) {
differences.add(difference);
}
}
for (ConfigurationMetadataProperty newProperty : newMetadata.getAllProperties().values()) {
if (!seenIds.contains(newProperty.getId())) {
if (newProperty.isDeprecated() && newProperty.getDeprecation().getLevel() == Deprecation.Level.ERROR) {
if (newProperty.isDeprecated() && newProperty.getDeprecation().getLevel() == Level.ERROR) {
differences.add(new Difference(DifferenceType.DELETED, null, newProperty));
}
else if (!newProperty.isDeprecated()) {

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

@@ -40,7 +40,7 @@
"deprecation": {
"level": "error",
"replacement": "test.new.property",
"reason": "Removed in Upgrade 10"
"reason": "removed in third-party library without deprecation"
}
}
]

View File

@@ -35,5 +35,5 @@ _None_.
| `test.removed.directly`
| `test.new.property`
| Removed in Upgrade 10
| removed in third-party library without deprecation
|======================