Skip to content

Commit 8869f76

Browse files
committed
Polish "Fix changelog generator missing directly removed properties"
See gh-45267
1 parent 30a6798 commit 8869f76

File tree

4 files changed

+16
-12
lines changed

4 files changed

+16
-12
lines changed

spring-boot-project/spring-boot-tools/spring-boot-configuration-metadata-changelog-generator/src/main/java/org/springframework/boot/configurationmetadata/changelog/Changelog.java

Lines changed: 5 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -21,7 +21,7 @@
2121

2222
import org.springframework.boot.configurationmetadata.ConfigurationMetadataProperty;
2323
import org.springframework.boot.configurationmetadata.ConfigurationMetadataRepository;
24-
import org.springframework.boot.configurationmetadata.Deprecation;
24+
import org.springframework.boot.configurationmetadata.Deprecation.Level;
2525

2626
/**
2727
* A changelog containing differences computed from two repositories of configuration
@@ -50,19 +50,14 @@ static List<Difference> computeDifferences(ConfigurationMetadataRepository oldMe
5050
String id = oldProperty.getId();
5151
seenIds.add(id);
5252
ConfigurationMetadataProperty newProperty = newMetadata.getAllProperties().get(id);
53-
if (newProperty == null) {
54-
differences.add(new Difference(DifferenceType.DELETED, oldProperty, null));
55-
}
56-
else {
57-
Difference difference = Difference.compute(oldProperty, newProperty);
58-
if (difference != null) {
59-
differences.add(difference);
60-
}
53+
Difference difference = Difference.compute(oldProperty, newProperty);
54+
if (difference != null) {
55+
differences.add(difference);
6156
}
6257
}
6358
for (ConfigurationMetadataProperty newProperty : newMetadata.getAllProperties().values()) {
6459
if (!seenIds.contains(newProperty.getId())) {
65-
if (newProperty.isDeprecated() && newProperty.getDeprecation().getLevel() == Deprecation.Level.ERROR) {
60+
if (newProperty.isDeprecated() && newProperty.getDeprecation().getLevel() == Level.ERROR) {
6661
differences.add(new Difference(DifferenceType.DELETED, null, newProperty));
6762
}
6863
else if (!newProperty.isDeprecated()) {

spring-boot-project/spring-boot-tools/spring-boot-configuration-metadata-changelog-generator/src/test/resources/sample-1.0.json

Lines changed: 9 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -26,6 +26,15 @@
2626
"deprecation": {
2727
"level": "warning"
2828
}
29+
},
30+
{
31+
"name": "test.delete.error",
32+
"type": "java.lang.String",
33+
"description": "Test delete error.",
34+
"defaultValue": "delete",
35+
"deprecation": {
36+
"level": "error"
37+
}
2938
}
3039
]
3140
}

spring-boot-project/spring-boot-tools/spring-boot-configuration-metadata-changelog-generator/src/test/resources/sample-2.0.json

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -40,7 +40,7 @@
4040
"deprecation": {
4141
"level": "error",
4242
"replacement": "test.new.property",
43-
"reason": "Removed in Upgrade 10"
43+
"reason": "removed in third-party library without deprecation"
4444
}
4545
}
4646
]

spring-boot-project/spring-boot-tools/spring-boot-configuration-metadata-changelog-generator/src/test/resources/sample.adoc

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -35,5 +35,5 @@ _None_.
3535

3636
| `test.removed.directly`
3737
| `test.new.property`
38-
| Removed in Upgrade 10
38+
| removed in third-party library without deprecation
3939
|======================

0 commit comments

Comments
 (0)