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
81efd225
Commit
81efd225
authored
Jun 14, 2017
by
Stephane Nicoll
Browse files
Options
Browse Files
Download
Plain Diff
Merge branch '1.5.x'
parents
c5d44cda
acda4f90
Changes
6
Hide whitespace changes
Inline
Side-by-side
Showing
6 changed files
with
52 additions
and
6 deletions
+52
-6
ConfigurationMetadata.java
...onfigurationprocessor/metadata/ConfigurationMetadata.java
+3
-0
ItemDeprecation.java
...boot/configurationprocessor/metadata/ItemDeprecation.java
+22
-3
JsonConverter.java
...k/boot/configurationprocessor/metadata/JsonConverter.java
+3
-0
JsonMarshaller.java
.../boot/configurationprocessor/metadata/JsonMarshaller.java
+1
-0
ConfigurationMetadataAnnotationProcessorTests.java
...cessor/ConfigurationMetadataAnnotationProcessorTests.java
+17
-2
Metadata.java
...mework/boot/configurationprocessor/metadata/Metadata.java
+6
-1
No files found.
spring-boot-tools/spring-boot-configuration-processor/src/main/java/org/springframework/boot/configurationprocessor/metadata/ConfigurationMetadata.java
View file @
81efd225
...
...
@@ -124,6 +124,9 @@ public class ConfigurationMetadata {
if
(
deprecation
.
getReplacement
()
!=
null
)
{
matchingDeprecation
.
setReplacement
(
deprecation
.
getReplacement
());
}
if
(
deprecation
.
getLevel
()
!=
null
)
{
matchingDeprecation
.
setLevel
(
deprecation
.
getLevel
());
}
}
}
}
...
...
spring-boot-tools/spring-boot-configuration-processor/src/main/java/org/springframework/boot/configurationprocessor/metadata/ItemDeprecation.java
View file @
81efd225
/*
* Copyright 2012-201
5
the original author or authors.
* Copyright 2012-201
7
the original author or authors.
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
...
...
@@ -28,12 +28,20 @@ public class ItemDeprecation {
private
String
replacement
;
private
String
level
;
public
ItemDeprecation
()
{
this
(
null
,
null
);
}
public
ItemDeprecation
(
String
reason
,
String
replacement
)
{
this
(
reason
,
replacement
,
null
);
}
public
ItemDeprecation
(
String
reason
,
String
replacement
,
String
level
)
{
this
.
reason
=
reason
;
this
.
replacement
=
replacement
;
this
.
level
=
level
;
}
public
String
getReason
()
{
...
...
@@ -52,10 +60,19 @@ public class ItemDeprecation {
this
.
replacement
=
replacement
;
}
public
String
getLevel
()
{
return
this
.
level
;
}
public
void
setLevel
(
String
level
)
{
this
.
level
=
level
;
}
@Override
public
String
toString
()
{
return
"ItemDeprecation{"
+
"reason='"
+
this
.
reason
+
'\''
+
", "
+
"replacement='"
+
this
.
replacement
+
'\''
+
'}'
;
+
"replacement='"
+
this
.
replacement
+
'\''
+
", "
+
"level='"
+
this
.
level
+
'\''
+
'}'
;
}
@Override
...
...
@@ -68,13 +85,15 @@ public class ItemDeprecation {
}
ItemDeprecation
other
=
(
ItemDeprecation
)
o
;
return
nullSafeEquals
(
this
.
reason
,
other
.
reason
)
&&
nullSafeEquals
(
this
.
replacement
,
other
.
replacement
);
&&
nullSafeEquals
(
this
.
replacement
,
other
.
replacement
)
&&
nullSafeEquals
(
this
.
level
,
other
.
level
);
}
@Override
public
int
hashCode
()
{
int
result
=
nullSafeHashCode
(
this
.
reason
);
result
=
31
*
result
+
nullSafeHashCode
(
this
.
replacement
);
result
=
31
*
result
+
nullSafeHashCode
(
this
.
level
);
return
result
;
}
...
...
spring-boot-tools/spring-boot-configuration-processor/src/main/java/org/springframework/boot/configurationprocessor/metadata/JsonConverter.java
View file @
81efd225
...
...
@@ -67,6 +67,9 @@ class JsonConverter {
if
(
deprecation
!=
null
)
{
jsonObject
.
put
(
"deprecated"
,
true
);
// backward compatibility
JSONObject
deprecationJsonObject
=
new
JSONObject
();
if
(
deprecation
.
getLevel
()
!=
null
)
{
deprecationJsonObject
.
put
(
"level"
,
deprecation
.
getLevel
());
}
if
(
deprecation
.
getReason
()
!=
null
)
{
deprecationJsonObject
.
put
(
"reason"
,
deprecation
.
getReason
());
}
...
...
spring-boot-tools/spring-boot-configuration-processor/src/main/java/org/springframework/boot/configurationprocessor/metadata/JsonMarshaller.java
View file @
81efd225
...
...
@@ -108,6 +108,7 @@ public class JsonMarshaller {
if
(
object
.
has
(
"deprecation"
))
{
JSONObject
deprecationJsonObject
=
object
.
getJSONObject
(
"deprecation"
);
ItemDeprecation
deprecation
=
new
ItemDeprecation
();
deprecation
.
setLevel
(
deprecationJsonObject
.
optString
(
"level"
,
null
));
deprecation
.
setReason
(
deprecationJsonObject
.
optString
(
"reason"
,
null
));
deprecation
.
setReplacement
(
deprecationJsonObject
.
optString
(
"replacement"
,
null
));
...
...
spring-boot-tools/spring-boot-configuration-processor/src/test/java/org/springframework/boot/configurationprocessor/ConfigurationMetadataAnnotationProcessorTests.java
View file @
81efd225
...
...
@@ -557,13 +557,15 @@ public class ConfigurationMetadataAnnotationProcessorTests {
public
void
mergeExistingPropertyDeprecation
()
throws
Exception
{
ItemMetadata
property
=
ItemMetadata
.
newProperty
(
"simple"
,
"comparator"
,
null
,
null
,
null
,
null
,
null
,
new
ItemDeprecation
(
"Don't use this."
,
"simple.complex-comparator"
));
new
ItemDeprecation
(
"Don't use this."
,
"simple.complex-comparator"
,
"error"
));
writeAdditionalMetadata
(
property
);
ConfigurationMetadata
metadata
=
compile
(
SimpleProperties
.
class
);
assertThat
(
metadata
)
.
has
(
Metadata
.
withProperty
(
"simple.comparator"
,
"java.util.Comparator<?>"
)
.
fromSource
(
SimpleProperties
.
class
)
.
withDeprecation
(
"Don't use this."
,
"simple.complex-comparator"
));
.
withDeprecation
(
"Don't use this."
,
"simple.complex-comparator"
,
"error"
));
assertThat
(
metadata
.
getItems
()).
hasSize
(
4
);
}
...
...
@@ -581,6 +583,19 @@ public class ConfigurationMetadataAnnotationProcessorTests {
assertThat
(
metadata
.
getItems
()).
hasSize
(
3
);
}
@Test
public
void
mergeExistingPropertyDeprecationOverrideLevel
()
throws
Exception
{
ItemMetadata
property
=
ItemMetadata
.
newProperty
(
"singledeprecated"
,
"name"
,
null
,
null
,
null
,
null
,
null
,
new
ItemDeprecation
(
null
,
null
,
"error"
));
writeAdditionalMetadata
(
property
);
ConfigurationMetadata
metadata
=
compile
(
DeprecatedSingleProperty
.
class
);
assertThat
(
metadata
).
has
(
Metadata
.
withProperty
(
"singledeprecated.name"
,
String
.
class
.
getName
())
.
fromSource
(
DeprecatedSingleProperty
.
class
)
.
withDeprecation
(
"renamed"
,
"singledeprecated.new-name"
,
"error"
));
assertThat
(
metadata
.
getItems
()).
hasSize
(
3
);
}
@Test
public
void
mergeOfInvalidAdditionalMetadata
()
throws
IOException
{
File
additionalMetadataFile
=
createAdditionalMetadataFile
();
...
...
spring-boot-tools/spring-boot-configuration-processor/src/test/java/org/springframework/boot/configurationprocessor/metadata/Metadata.java
View file @
81efd225
...
...
@@ -198,9 +198,14 @@ public final class Metadata {
}
public
MetadataItemCondition
withDeprecation
(
String
reason
,
String
replacement
)
{
return
withDeprecation
(
reason
,
replacement
,
null
);
}
public
MetadataItemCondition
withDeprecation
(
String
reason
,
String
replacement
,
String
level
)
{
return
new
MetadataItemCondition
(
this
.
itemType
,
this
.
name
,
this
.
type
,
this
.
sourceType
,
this
.
sourceMethod
,
this
.
description
,
this
.
defaultValue
,
new
ItemDeprecation
(
reason
,
replacement
));
this
.
defaultValue
,
new
ItemDeprecation
(
reason
,
replacement
,
level
));
}
public
MetadataItemCondition
withNoDeprecation
()
{
...
...
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