提交 f55a4a1a 编写于 作者: C Chris Beams

Reduce log level for message re: missing annotation

Previously (since Spring 3.1.1) RecursiveAnnotationAttributesVisitor
logs at level WARN when ASM parsing encounters an annotation or an (enum
used within an annotation) that cannot be classloaded. This is not
necessarily indicative of an error, e.g. JSR-305 annotations such as
@Nonnull may be used only for static analysis purposes, but because
these annotations have runtime retention, they remain present in the
bytecode. Per section 9.6.1.2 of the JLS, "An annotation that is present
in the binary may or may not be available at run-time via the reflective
libraries of the Java platform."

This commit lowers the log level of these messages from warn to debug,
but leaves at warn level other messages dealing with the ability
reflectively read enum values from within annotations.

Issue: SPR-9233
上级 bcd44f37
......@@ -80,18 +80,14 @@ abstract class AbstractRecursiveAnnotationVisitor implements AnnotationVisitor {
valueToUse = enumConstant.get(null);
}
}
catch (Exception ex) {
logNonFatalException(ex);
catch (ClassNotFoundException ex) {
this.logger.debug("Failed to classload enum type while reading annotation metadata", ex);
}
catch (IllegalAccessException ex) {
this.logger.warn("Could not access enum value while reading annotation metadata", ex);
}
this.attributes.put(attributeName, valueToUse);
}
protected void logNonFatalException(Exception ex) {
this.logger.warn("Failed to classload type while reading annotation metadata. " +
"This is a non-fatal error, but certain annotation metadata may be " +
"unavailable.", ex);
}
}
......@@ -168,7 +164,9 @@ class RecursiveAnnotationAttributesVisitor extends AbstractRecursiveAnnotationVi
this.doVisitEnd(annotationClass);
}
catch (ClassNotFoundException ex) {
logNonFatalException(ex);
this.logger.debug("Failed to classload type while reading annotation " +
"metadata. This is a non-fatal error, but certain annotation " +
"metadata may be unavailable.", ex);
}
}
......
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册