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
f2af8b30
Commit
f2af8b30
authored
Dec 16, 2014
by
Phillip Webb
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Code formatting
parent
fe5800f8
Changes
4
Hide whitespace changes
Inline
Side-by-side
Showing
4 changed files
with
26 additions
and
24 deletions
+26
-24
pom.xml
...ng-boot-tools/spring-boot-configuration-processor/pom.xml
+2
-2
ConfigurationMetadataAnnotationProcessor.java
...onprocessor/ConfigurationMetadataAnnotationProcessor.java
+5
-6
ConfigurationMetadataAnnotationProcessorTests.java
...cessor/ConfigurationMetadataAnnotationProcessorTests.java
+9
-12
LombokExplicitProperties.java
.../configurationsample/lombok/LombokExplicitProperties.java
+10
-4
No files found.
spring-boot-tools/spring-boot-configuration-processor/pom.xml
View file @
f2af8b30
...
@@ -18,12 +18,12 @@
...
@@ -18,12 +18,12 @@
<main.basedir>
${basedir}/../..
</main.basedir>
<main.basedir>
${basedir}/../..
</main.basedir>
</properties>
</properties>
<dependencies>
<dependencies>
<!--
Runs in the compiler so dependencies should stick to the bare minimum
-->
<!--
Compile (should stick to the bare minimum)
-->
<dependency>
<dependency>
<groupId>
org.json
</groupId>
<groupId>
org.json
</groupId>
<artifactId>
json
</artifactId>
<artifactId>
json
</artifactId>
</dependency>
</dependency>
<!-- Test -->
<dependency>
<dependency>
<groupId>
org.projectlombok
</groupId>
<groupId>
org.projectlombok
</groupId>
<artifactId>
lombok
</artifactId>
<artifactId>
lombok
</artifactId>
...
...
spring-boot-tools/spring-boot-configuration-processor/src/main/java/org/springframework/boot/configurationprocessor/ConfigurationMetadataAnnotationProcessor.java
View file @
f2af8b30
...
@@ -207,8 +207,7 @@ public class ConfigurationMetadataAnnotationProcessor extends AbstractProcessor
...
@@ -207,8 +207,7 @@ public class ConfigurationMetadataAnnotationProcessor extends AbstractProcessor
private
void
processLombokTypes
(
String
prefix
,
TypeElement
element
,
private
void
processLombokTypes
(
String
prefix
,
TypeElement
element
,
TypeElementMembers
members
,
Map
<
String
,
Object
>
fieldValues
)
{
TypeElementMembers
members
,
Map
<
String
,
Object
>
fieldValues
)
{
for
(
Map
.
Entry
<
String
,
VariableElement
>
entry
:
members
.
getFields
()
for
(
Map
.
Entry
<
String
,
VariableElement
>
entry
:
members
.
getFields
().
entrySet
())
{
.
entrySet
())
{
String
name
=
entry
.
getKey
();
String
name
=
entry
.
getKey
();
VariableElement
field
=
entry
.
getValue
();
VariableElement
field
=
entry
.
getValue
();
if
(!
isLombokField
(
field
,
element
))
{
if
(!
isLombokField
(
field
,
element
))
{
...
@@ -241,10 +240,10 @@ public class ConfigurationMetadataAnnotationProcessor extends AbstractProcessor
...
@@ -241,10 +240,10 @@ public class ConfigurationMetadataAnnotationProcessor extends AbstractProcessor
}
}
private
boolean
hasLombokSetter
(
VariableElement
field
,
TypeElement
element
)
{
private
boolean
hasLombokSetter
(
VariableElement
field
,
TypeElement
element
)
{
return
!
field
.
getModifiers
().
contains
(
Modifier
.
FINAL
)
&&
(
return
!
field
.
getModifiers
().
contains
(
Modifier
.
FINAL
)
hasAnnotation
(
field
,
LOMBOK_SETTER_ANNOTATION
)
&&
(
hasAnnotation
(
field
,
LOMBOK_SETTER_ANNOTATION
)
||
hasAnnotation
(
element
,
LOMBOK_SETTER_ANNOTATION
)
||
hasAnnotation
(
element
,
LOMBOK_SETTER_ANNOTATION
)
||
hasAnnotation
(
||
hasAnnotation
(
element
,
LOMBOK_DATA_ANNOTATION
));
element
,
LOMBOK_DATA_ANNOTATION
));
}
}
private
void
processNestedTypes
(
String
prefix
,
TypeElement
element
,
private
void
processNestedTypes
(
String
prefix
,
TypeElement
element
,
...
...
spring-boot-tools/spring-boot-configuration-processor/src/test/java/org/springframework/boot/configurationprocessor/ConfigurationMetadataAnnotationProcessorTests.java
View file @
f2af8b30
...
@@ -17,6 +17,7 @@
...
@@ -17,6 +17,7 @@
package
org
.
springframework
.
boot
.
configurationprocessor
;
package
org
.
springframework
.
boot
.
configurationprocessor
;
import
java.io.IOException
;
import
java.io.IOException
;
import
javax.annotation.processing.SupportedAnnotationTypes
;
import
javax.annotation.processing.SupportedAnnotationTypes
;
import
javax.annotation.processing.SupportedSourceVersion
;
import
javax.annotation.processing.SupportedSourceVersion
;
import
javax.lang.model.SourceVersion
;
import
javax.lang.model.SourceVersion
;
...
@@ -24,10 +25,9 @@ import javax.lang.model.SourceVersion;
...
@@ -24,10 +25,9 @@ import javax.lang.model.SourceVersion;
import
org.junit.Rule
;
import
org.junit.Rule
;
import
org.junit.Test
;
import
org.junit.Test
;
import
org.junit.rules.TemporaryFolder
;
import
org.junit.rules.TemporaryFolder
;
import
org.springframework.boot.configurationprocessor.metadata.ConfigurationMetadata
;
import
org.springframework.boot.configurationprocessor.metadata.ConfigurationMetadata
;
import
org.springframework.boot.configurationsample.lombok.LombokSimpleDataProperties
;
import
org.springframework.boot.configurationsample.lombok.LombokExplicitProperties
;
import
org.springframework.boot.configurationsample.lombok.LombokExplicitProperties
;
import
org.springframework.boot.configurationsample.lombok.LombokSimpleDataProperties
;
import
org.springframework.boot.configurationsample.lombok.LombokSimpleProperties
;
import
org.springframework.boot.configurationsample.lombok.LombokSimpleProperties
;
import
org.springframework.boot.configurationsample.method.EmptyTypeMethodConfig
;
import
org.springframework.boot.configurationsample.method.EmptyTypeMethodConfig
;
import
org.springframework.boot.configurationsample.method.InvalidMethodConfig
;
import
org.springframework.boot.configurationsample.method.InvalidMethodConfig
;
...
@@ -307,20 +307,17 @@ public class ConfigurationMetadataAnnotationProcessorTests {
...
@@ -307,20 +307,17 @@ public class ConfigurationMetadataAnnotationProcessorTests {
assertSimpleLombokProperties
(
metadata
,
LombokExplicitProperties
.
class
,
"explicit"
);
assertSimpleLombokProperties
(
metadata
,
LombokExplicitProperties
.
class
,
"explicit"
);
}
}
private
void
assertSimpleLombokProperties
(
ConfigurationMetadata
metadata
,
Class
<?>
source
,
String
prefix
)
{
private
void
assertSimpleLombokProperties
(
ConfigurationMetadata
metadata
,
Class
<?>
source
,
String
prefix
)
{
assertThat
(
metadata
,
containsGroup
(
prefix
).
fromSource
(
source
));
assertThat
(
metadata
,
containsGroup
(
prefix
).
fromSource
(
source
));
assertThat
(
metadata
,
not
(
containsProperty
(
prefix
+
".id"
)));
assertThat
(
metadata
,
not
(
containsProperty
(
prefix
+
".id"
)));
assertThat
(
assertThat
(
metadata
,
metadata
,
containsProperty
(
prefix
+
".name"
,
String
.
class
).
fromSource
(
source
)
containsProperty
(
prefix
+
".name"
,
String
.
class
)
.
fromSource
(
source
)
.
withDescription
(
"Name description."
));
.
withDescription
(
"Name description."
));
assertThat
(
metadata
,
containsProperty
(
prefix
+
".description"
));
assertThat
(
metadata
,
containsProperty
(
prefix
+
".description"
));
assertThat
(
metadata
,
containsProperty
(
prefix
+
".counter"
));
assertThat
(
metadata
,
containsProperty
(
prefix
+
".counter"
));
assertThat
(
metadata
,
assertThat
(
metadata
,
containsProperty
(
prefix
+
".number"
).
fromSource
(
source
)
containsProperty
(
prefix
+
".number"
).
fromSource
(
source
)
.
withDefaultValue
(
is
(
0
)).
withDeprecated
());
.
withDefaultValue
(
is
(
0
))
.
withDeprecated
());
assertThat
(
metadata
,
containsProperty
(
prefix
+
".items"
));
assertThat
(
metadata
,
containsProperty
(
prefix
+
".items"
));
assertThat
(
metadata
,
not
(
containsProperty
(
prefix
+
".ignored"
)));
assertThat
(
metadata
,
not
(
containsProperty
(
prefix
+
".ignored"
)));
}
}
...
@@ -331,7 +328,7 @@ public class ConfigurationMetadataAnnotationProcessorTests {
...
@@ -331,7 +328,7 @@ public class ConfigurationMetadataAnnotationProcessorTests {
return
processor
.
getMetadata
();
return
processor
.
getMetadata
();
}
}
@SupportedAnnotationTypes
({
"*"
})
@SupportedAnnotationTypes
({
"*"
})
@SupportedSourceVersion
(
SourceVersion
.
RELEASE_6
)
@SupportedSourceVersion
(
SourceVersion
.
RELEASE_6
)
private
static
class
TestConfigurationMetadataAnnotationProcessor
extends
private
static
class
TestConfigurationMetadataAnnotationProcessor
extends
ConfigurationMetadataAnnotationProcessor
{
ConfigurationMetadataAnnotationProcessor
{
...
...
spring-boot-tools/spring-boot-configuration-processor/src/test/java/org/springframework/boot/configurationsample/lombok/LombokExplicitProperties.java
View file @
f2af8b30
...
@@ -38,22 +38,28 @@ public class LombokExplicitProperties {
...
@@ -38,22 +38,28 @@ public class LombokExplicitProperties {
/**
/**
* Name description.
* Name description.
*/
*/
@Getter
@Setter
@Getter
@Setter
private
String
name
;
private
String
name
;
@Getter
@Setter
@Getter
@Setter
private
String
description
;
private
String
description
;
@Getter
@Setter
@Getter
@Setter
private
Integer
counter
;
private
Integer
counter
;
@Deprecated
@Getter
@Setter
@Deprecated
@Getter
@Setter
private
Integer
number
=
0
;
private
Integer
number
=
0
;
@Getter
@Getter
private
final
List
<
String
>
items
=
new
ArrayList
<
String
>();
private
final
List
<
String
>
items
=
new
ArrayList
<
String
>();
// Should be ignored if no annotation is set
// Should be ignored if no annotation is set
@SuppressWarnings
(
"unused"
)
private
String
ignored
;
private
String
ignored
;
}
}
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