Skip to content

Commit c249d95

Browse files
committed
Omit properties deprecated at error level from new appendix
Closes gh-47622
1 parent 92e61fd commit c249d95

File tree

2 files changed

+11
-3
lines changed

2 files changed

+11
-3
lines changed

buildSrc/src/main/java/org/springframework/boot/build/context/properties/ConfigurationProperty.java

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -97,7 +97,7 @@ static ConfigurationProperty fromJsonProperties(Map<String, Object> property) {
9797
Deprecation.fromJsonProperties(deprecation));
9898
}
9999

100-
record Deprecation(String reason, String replacement, String since) {
100+
record Deprecation(String reason, String replacement, String since, String level) {
101101

102102
static Deprecation fromJsonProperties(Map<String, Object> property) {
103103
if (property == null) {
@@ -106,7 +106,8 @@ static Deprecation fromJsonProperties(Map<String, Object> property) {
106106
String reason = (String) property.get("reason");
107107
String replacement = (String) property.get("replacement");
108108
String since = (String) property.get("since");
109-
return new Deprecation(reason, replacement, since);
109+
String level = (String) property.get("level");
110+
return new Deprecation(reason, replacement, since, level);
110111
}
111112

112113
}

buildSrc/src/main/java/org/springframework/boot/build/context/properties/Snippets.java

Lines changed: 8 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -30,6 +30,8 @@
3030

3131
import org.gradle.api.file.FileCollection;
3232

33+
import org.springframework.boot.build.context.properties.ConfigurationProperty.Deprecation;
34+
3335
/**
3436
* Configuration properties snippets.
3537
*
@@ -118,7 +120,12 @@ String findXref(String name) {
118120
}
119121

120122
private boolean shouldAdd(ConfigurationProperty property) {
121-
return (property == null || property.isDeprecated() == this.deprecated);
123+
return (property == null || (property.isDeprecated() == this.deprecated && !deprecatedAtErrorLevel(property)));
124+
}
125+
126+
private boolean deprecatedAtErrorLevel(ConfigurationProperty property) {
127+
Deprecation deprecation = property.getDeprecation();
128+
return deprecation != null && "error".equals(deprecation.level());
122129
}
123130

124131
private Asciidoc getAsciidoc(Snippet snippet, Table table) {

0 commit comments

Comments
 (0)