Skip to content
Projects
Groups
Snippets
Help
Loading...
Help
Submit feedback
Sign in / Register
Toggle navigation
S
spring-boot
Project
Project
Details
Activity
Releases
Cycle Analytics
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Charts
Issues
0
Issues
0
List
Board
Labels
Milestones
Merge Requests
0
Merge Requests
0
CI / CD
CI / CD
Pipelines
Jobs
Schedules
Charts
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Charts
Create a new issue
Jobs
Commits
Issue Boards
Open sidebar
DEMO
spring-boot
Commits
e7eb7739
Commit
e7eb7739
authored
Oct 29, 2020
by
Andy Wilkinson
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Use overriding rather than overridden getter methods in config prop AP
Fixes gh-23966
parent
79a83353
Changes
3
Hide whitespace changes
Inline
Side-by-side
Showing
3 changed files
with
10 additions
and
5 deletions
+10
-5
TypeElementMembers.java
...ework/boot/configurationprocessor/TypeElementMembers.java
+2
-2
PropertyDescriptorResolverTests.java
...nfigurationprocessor/PropertyDescriptorResolverTests.java
+5
-1
HierarchicalPropertiesParent.java
...figurationsample/simple/HierarchicalPropertiesParent.java
+3
-2
No files found.
spring-boot-project/spring-boot-tools/spring-boot-configuration-processor/src/main/java/org/springframework/boot/configurationprocessor/TypeElementMembers.java
View file @
e7eb7739
/*
/*
* Copyright 2012-20
19
the original author or authors.
* Copyright 2012-20
20
the original author or authors.
*
*
* Licensed under the Apache License, Version 2.0 (the "License");
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* you may not use this file except in compliance with the License.
...
@@ -74,7 +74,7 @@ class TypeElementMembers {
...
@@ -74,7 +74,7 @@ class TypeElementMembers {
private
void
processMethod
(
ExecutableElement
method
)
{
private
void
processMethod
(
ExecutableElement
method
)
{
if
(
isPublic
(
method
))
{
if
(
isPublic
(
method
))
{
String
name
=
method
.
getSimpleName
().
toString
();
String
name
=
method
.
getSimpleName
().
toString
();
if
(
isGetter
(
method
)
&&
!
this
.
publicGetters
.
containsKey
(
name
))
{
if
(
isGetter
(
method
)
&&
!
this
.
publicGetters
.
containsKey
(
getAccessorName
(
name
)
))
{
this
.
publicGetters
.
put
(
getAccessorName
(
name
),
method
);
this
.
publicGetters
.
put
(
getAccessorName
(
name
),
method
);
}
}
else
if
(
isSetter
(
method
))
{
else
if
(
isSetter
(
method
))
{
...
...
spring-boot-project/spring-boot-tools/spring-boot-configuration-processor/src/test/java/org/springframework/boot/configurationprocessor/PropertyDescriptorResolverTests.java
View file @
e7eb7739
/*
/*
* Copyright 2012-20
19
the original author or authors.
* Copyright 2012-20
20
the original author or authors.
*
*
* Licensed under the Apache License, Version 2.0 (the "License");
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* you may not use this file except in compliance with the License.
...
@@ -75,6 +75,10 @@ class PropertyDescriptorResolverTests {
...
@@ -75,6 +75,10 @@ class PropertyDescriptorResolverTests {
PropertyDescriptorResolver
resolver
=
new
PropertyDescriptorResolver
(
metadataEnv
);
PropertyDescriptorResolver
resolver
=
new
PropertyDescriptorResolver
(
metadataEnv
);
assertThat
(
resolver
.
resolve
(
type
,
null
).
map
(
PropertyDescriptor:
:
getName
)).
containsExactly
(
"third"
,
assertThat
(
resolver
.
resolve
(
type
,
null
).
map
(
PropertyDescriptor:
:
getName
)).
containsExactly
(
"third"
,
"second"
,
"first"
);
"second"
,
"first"
);
assertThat
(
resolver
.
resolve
(
type
,
null
).
map
(
(
descriptor
)
->
descriptor
.
getGetter
().
getEnclosingElement
().
getSimpleName
().
toString
()))
.
containsExactly
(
"HierarchicalProperties"
,
"HierarchicalPropertiesParent"
,
"HierarchicalPropertiesParent"
);
assertThat
(
resolver
.
resolve
(
type
,
null
)
assertThat
(
resolver
.
resolve
(
type
,
null
)
.
map
((
descriptor
)
->
descriptor
.
resolveItemMetadata
(
"test"
,
metadataEnv
))
.
map
((
descriptor
)
->
descriptor
.
resolveItemMetadata
(
"test"
,
metadataEnv
))
.
map
(
ItemMetadata:
:
getDefaultValue
)).
containsExactly
(
"three"
,
"two"
,
"one"
);
.
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
View file @
e7eb7739
/*
/*
* Copyright 2012-20
19
the original author or authors.
* Copyright 2012-20
20
the original author or authors.
*
*
* Licensed under the Apache License, Version 2.0 (the "License");
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* you may not use this file except in compliance with the License.
...
@@ -33,7 +33,8 @@ public abstract class HierarchicalPropertiesParent extends HierarchicalPropertie
...
@@ -33,7 +33,8 @@ public abstract class HierarchicalPropertiesParent extends HierarchicalPropertie
this
.
second
=
second
;
this
.
second
=
second
;
}
}
// Useless override
// Overridden properties should belong to this class, not
// HierarchicalPropertiesGrandparent
@Override
@Override
public
String
getFirst
()
{
public
String
getFirst
()
{
...
...
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment