Merge branch '4.0.x'

Closes gh-49061
This commit is contained in:
Phillip Webb
2026-02-04 18:08:16 -08:00
3 changed files with 22 additions and 2 deletions
@@ -272,8 +272,9 @@ class TypeUtils {
char lastChar = '.';
for (int i = 0; i < javadoc.length(); i++) {
char ch = javadoc.charAt(i);
boolean repeatedSpace = ch == ' ' && lastChar == ' ';
if (ch != '\r' && ch != '\n' && !repeatedSpace) {
ch = (ch == '\r' || ch == '\n') ? ' ' : ch;
boolean repeatedSpace = (ch == ' ' && lastChar == ' ');
if (!repeatedSpace) {
result.append(ch);
lastChar = ch;
}
@@ -234,6 +234,9 @@ class ConfigurationMetadataAnnotationProcessorTests extends AbstractMetadataGene
.fromSource(DescriptionProperties.class)
.withDescription(
"This is a lengthy description that spans across multiple lines to showcase that the line separators are cleaned automatically."));
assertThat(metadata).has(Metadata.withProperty("description.multi-line-whitespace", String.class)
.fromSource(DescriptionProperties.class)
.withDescription("This is an example of a description with unusual whitespace after a new line."));
}
@Test
@@ -37,6 +37,14 @@ public class DescriptionProperties {
*/
private String multiLine;
// @formatter:off
/**
* This is an example of a description
*with unusual whitespace after a new line.
*/
private String multiLineWhitespace;
// @formatter:on
public String getSimple() {
return this.simple;
}
@@ -53,4 +61,12 @@ public class DescriptionProperties {
this.multiLine = multiLine;
}
public String getMultiLineWhitespace() {
return this.multiLineWhitespace;
}
public void setMultiLineWhitespace(String multiLineWhitespace) {
this.multiLineWhitespace = multiLineWhitespace;
}
}