Skip to content

Commit 5642dc6

Browse files
committed
Merge branch '2.3.x'
Closes gh-23970
2 parents f0558bb + 70d9602 commit 5642dc6

File tree

3 files changed

+9
-4
lines changed

3 files changed

+9
-4
lines changed

spring-boot-project/spring-boot-tools/spring-boot-configuration-processor/src/main/java/org/springframework/boot/configurationprocessor/TypeElementMembers.java

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
/*
2-
* Copyright 2012-2019 the original author or authors.
2+
* Copyright 2012-2020 the original author or authors.
33
*
44
* Licensed under the Apache License, Version 2.0 (the "License");
55
* you may not use this file except in compliance with the License.
@@ -74,7 +74,7 @@ private void process(TypeElement element) {
7474
private void processMethod(ExecutableElement method) {
7575
if (isPublic(method)) {
7676
String name = method.getSimpleName().toString();
77-
if (isGetter(method) && !this.publicGetters.containsKey(name)) {
77+
if (isGetter(method) && !this.publicGetters.containsKey(getAccessorName(name))) {
7878
this.publicGetters.put(getAccessorName(name), method);
7979
}
8080
else if (isSetter(method)) {

spring-boot-project/spring-boot-tools/spring-boot-configuration-processor/src/test/java/org/springframework/boot/configurationprocessor/PropertyDescriptorResolverTests.java

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -76,6 +76,10 @@ void propertiesWithJavaBeanHierarchicalProperties() throws IOException {
7676
PropertyDescriptorResolver resolver = new PropertyDescriptorResolver(metadataEnv);
7777
assertThat(resolver.resolve(type, null).map(PropertyDescriptor::getName)).containsExactly("third",
7878
"second", "first");
79+
assertThat(resolver.resolve(type, null).map(
80+
(descriptor) -> descriptor.getGetter().getEnclosingElement().getSimpleName().toString()))
81+
.containsExactly("HierarchicalProperties", "HierarchicalPropertiesParent",
82+
"HierarchicalPropertiesParent");
7983
assertThat(resolver.resolve(type, null)
8084
.map((descriptor) -> descriptor.resolveItemMetadata("test", metadataEnv))
8185
.map(ItemMetadata::getDefaultValue)).containsExactly("three", "two", "one");

spring-boot-project/spring-boot-tools/spring-boot-configuration-processor/src/test/java/org/springframework/boot/configurationsample/simple/HierarchicalPropertiesParent.java

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
/*
2-
* Copyright 2012-2019 the original author or authors.
2+
* Copyright 2012-2020 the original author or authors.
33
*
44
* Licensed under the Apache License, Version 2.0 (the "License");
55
* you may not use this file except in compliance with the License.
@@ -33,7 +33,8 @@ public void setSecond(String second) {
3333
this.second = second;
3434
}
3535

36-
// Useless override
36+
// Overridden properties should belong to this class, not
37+
// HierarchicalPropertiesGrandparent
3738

3839
@Override
3940
public String getFirst() {

0 commit comments

Comments
 (0)