Merge branch '6.1.x'
This commit is contained in:
@@ -58,7 +58,7 @@ class CodeWarnings {
|
||||
*/
|
||||
public CodeWarnings detectDeprecation(AnnotatedElement... elements) {
|
||||
for (AnnotatedElement element : elements) {
|
||||
register(element.getAnnotation(Deprecated.class));
|
||||
registerDeprecationIfNecessary(element);
|
||||
}
|
||||
return this;
|
||||
}
|
||||
@@ -112,6 +112,16 @@ class CodeWarnings {
|
||||
return Collections.unmodifiableSet(this.warnings);
|
||||
}
|
||||
|
||||
private void registerDeprecationIfNecessary(@Nullable AnnotatedElement element) {
|
||||
if (element == null) {
|
||||
return;
|
||||
}
|
||||
register(element.getAnnotation(Deprecated.class));
|
||||
if (element instanceof Class<?> type) {
|
||||
registerDeprecationIfNecessary(type.getEnclosingClass());
|
||||
}
|
||||
}
|
||||
|
||||
private void register(@Nullable Deprecated annotation) {
|
||||
if (annotation != null) {
|
||||
if (annotation.forRemoval()) {
|
||||
|
||||
Reference in New Issue
Block a user