Skip to content
体验新版
项目
组织
正在加载...
登录
切换导航
打开侧边栏
爱吃血肠
spring-framework
提交
b36c9f9f
S
spring-framework
项目概览
爱吃血肠
/
spring-framework
通知
1
Star
0
Fork
0
代码
文件
提交
分支
Tags
贡献者
分支图
Diff
Issue
0
列表
看板
标记
里程碑
合并请求
0
Wiki
0
Wiki
分析
仓库
DevOps
项目成员
Pages
S
spring-framework
项目概览
项目概览
详情
发布
仓库
仓库
文件
提交
分支
标签
贡献者
分支图
比较
Issue
0
Issue
0
列表
看板
标记
里程碑
合并请求
0
合并请求
0
Pages
分析
分析
仓库分析
DevOps
Wiki
0
Wiki
成员
成员
收起侧边栏
关闭侧边栏
动态
分支图
创建新Issue
提交
Issue看板
体验新版 GitCode,发现更多精彩内容 >>
提交
b36c9f9f
编写于
6月 19, 2015
作者:
S
Sam Brannen
浏览文件
操作
浏览文件
下载
电子邮件补丁
差异文件
Polish introspection failure handling in AnnotationUtils
上级
23547a72
变更
1
隐藏空白更改
内联
并排
Showing
1 changed file
with
14 addition
and
20 deletion
+14
-20
spring-core/src/main/java/org/springframework/core/annotation/AnnotationUtils.java
.../org/springframework/core/annotation/AnnotationUtils.java
+14
-20
未找到文件。
spring-core/src/main/java/org/springframework/core/annotation/AnnotationUtils.java
浏览文件 @
b36c9f9f
...
@@ -150,10 +150,9 @@ public abstract class AnnotationUtils {
...
@@ -150,10 +150,9 @@ public abstract class AnnotationUtils {
return
synthesizeAnnotation
(
annotatedElement
.
getAnnotation
(
annotationType
),
annotatedElement
);
return
synthesizeAnnotation
(
annotatedElement
.
getAnnotation
(
annotationType
),
annotatedElement
);
}
}
catch
(
Exception
ex
)
{
catch
(
Exception
ex
)
{
// Assuming nested Class values not resolvable within annotation attributes...
handleIntrospectionFailure
(
annotatedElement
,
ex
);
handleIntrospectionFailure
(
annotatedElement
,
ex
);
return
null
;
}
}
return
null
;
}
}
/**
/**
...
@@ -182,10 +181,9 @@ public abstract class AnnotationUtils {
...
@@ -182,10 +181,9 @@ public abstract class AnnotationUtils {
return
synthesizeAnnotation
(
annotation
,
annotatedElement
);
return
synthesizeAnnotation
(
annotation
,
annotatedElement
);
}
}
catch
(
Exception
ex
)
{
catch
(
Exception
ex
)
{
// Assuming nested Class values not resolvable within annotation attributes...
handleIntrospectionFailure
(
annotatedElement
,
ex
);
handleIntrospectionFailure
(
annotatedElement
,
ex
);
return
null
;
}
}
return
null
;
}
}
/**
/**
...
@@ -222,7 +220,6 @@ public abstract class AnnotationUtils {
...
@@ -222,7 +220,6 @@ public abstract class AnnotationUtils {
return
annotatedElement
.
getAnnotations
();
return
annotatedElement
.
getAnnotations
();
}
}
catch
(
Exception
ex
)
{
catch
(
Exception
ex
)
{
// Assuming nested Class values not resolvable within annotation attributes...
handleIntrospectionFailure
(
annotatedElement
,
ex
);
handleIntrospectionFailure
(
annotatedElement
,
ex
);
}
}
return
null
;
return
null
;
...
@@ -245,7 +242,6 @@ public abstract class AnnotationUtils {
...
@@ -245,7 +242,6 @@ public abstract class AnnotationUtils {
return
BridgeMethodResolver
.
findBridgedMethod
(
method
).
getAnnotations
();
return
BridgeMethodResolver
.
findBridgedMethod
(
method
).
getAnnotations
();
}
}
catch
(
Exception
ex
)
{
catch
(
Exception
ex
)
{
// Assuming nested Class values not resolvable within annotation attributes...
handleIntrospectionFailure
(
method
,
ex
);
handleIntrospectionFailure
(
method
,
ex
);
}
}
return
null
;
return
null
;
...
@@ -301,7 +297,6 @@ public abstract class AnnotationUtils {
...
@@ -301,7 +297,6 @@ public abstract class AnnotationUtils {
}
}
}
}
catch
(
Exception
ex
)
{
catch
(
Exception
ex
)
{
// Assuming nested Class values not resolvable within annotation attributes...
handleIntrospectionFailure
(
annotatedElement
,
ex
);
handleIntrospectionFailure
(
annotatedElement
,
ex
);
}
}
return
Collections
.
emptySet
();
return
Collections
.
emptySet
();
...
@@ -360,7 +355,6 @@ public abstract class AnnotationUtils {
...
@@ -360,7 +355,6 @@ public abstract class AnnotationUtils {
}
}
}
}
catch
(
Exception
ex
)
{
catch
(
Exception
ex
)
{
// Assuming nested Class values not resolvable within annotation attributes...
handleIntrospectionFailure
(
annotatedElement
,
ex
);
handleIntrospectionFailure
(
annotatedElement
,
ex
);
}
}
return
null
;
return
null
;
...
@@ -454,7 +448,6 @@ public abstract class AnnotationUtils {
...
@@ -454,7 +448,6 @@ public abstract class AnnotationUtils {
}
}
}
}
catch
(
Exception
ex
)
{
catch
(
Exception
ex
)
{
// Assuming nested Class values not resolvable within annotation attributes...
handleIntrospectionFailure
(
ifcMethod
,
ex
);
handleIntrospectionFailure
(
ifcMethod
,
ex
);
}
}
}
}
...
@@ -527,7 +520,6 @@ public abstract class AnnotationUtils {
...
@@ -527,7 +520,6 @@ public abstract class AnnotationUtils {
}
}
}
}
catch
(
Exception
ex
)
{
catch
(
Exception
ex
)
{
// Assuming nested Class values not resolvable within annotation attributes...
handleIntrospectionFailure
(
clazz
,
ex
);
handleIntrospectionFailure
(
clazz
,
ex
);
return
null
;
return
null
;
}
}
...
@@ -645,7 +637,6 @@ public abstract class AnnotationUtils {
...
@@ -645,7 +637,6 @@ public abstract class AnnotationUtils {
}
}
}
}
catch
(
Exception
ex
)
{
catch
(
Exception
ex
)
{
// Assuming nested Class values not resolvable within annotation attributes...
handleIntrospectionFailure
(
clazz
,
ex
);
handleIntrospectionFailure
(
clazz
,
ex
);
}
}
return
false
;
return
false
;
...
@@ -1532,8 +1523,11 @@ public abstract class AnnotationUtils {
...
@@ -1532,8 +1523,11 @@ public abstract class AnnotationUtils {
* it will simply be thrown, allowing it to propagate to the caller, and
* it will simply be thrown, allowing it to propagate to the caller, and
* nothing will be logged.
* nothing will be logged.
* <p>Otherwise, this method logs an introspection failure (in particular
* <p>Otherwise, this method logs an introspection failure (in particular
* {@code TypeNotPresentExceptions}) — before moving on, pretending
* {@code TypeNotPresentExceptions}) before moving on, assuming nested
* there were no annotations on this specific element.
* Class values were not resolvable within annotation attributes and
* thereby effectively pretending there were no annotations on the specified
* element.
*
* @param element the element that we tried to introspect annotations on
* @param element the element that we tried to introspect annotations on
* @param ex the exception that we encountered
* @param ex the exception that we encountered
* @see #rethrowAnnotationConfigurationException
* @see #rethrowAnnotationConfigurationException
...
@@ -1547,16 +1541,16 @@ public abstract class AnnotationUtils {
...
@@ -1547,16 +1541,16 @@ public abstract class AnnotationUtils {
loggerToUse
=
LogFactory
.
getLog
(
AnnotationUtils
.
class
);
loggerToUse
=
LogFactory
.
getLog
(
AnnotationUtils
.
class
);
logger
=
loggerToUse
;
logger
=
loggerToUse
;
}
}
if
(
element
instanceof
Class
&&
Annotation
.
class
.
isAssignableFrom
((
Class
<?>)
element
))
{
if
(
(
element
instanceof
Class
)
&&
Annotation
.
class
.
isAssignableFrom
((
Class
<?>)
element
))
{
// Meta-annotation lookup on an annotation type
// Meta-annotation lookup on an annotation type
if
(
logger
.
isDebugEnabled
())
{
if
(
logger
ToUse
.
isDebugEnabled
())
{
logger
.
debug
(
"Failed to introspect meta-annotations on ["
+
element
+
"]: "
+
ex
);
logger
ToUse
.
debug
(
"Failed to introspect meta-annotations on ["
+
element
+
"]: "
+
ex
);
}
}
}
}
else
{
else
{
// Direct annotation lookup on regular Class, Method, Field
// Direct annotation lookup on regular Class, Method, Field
if
(
loggerToUse
.
isInfoEnabled
())
{
if
(
loggerToUse
.
isInfoEnabled
())
{
logger
.
info
(
"Failed to introspect annotations on ["
+
element
+
"]: "
+
ex
);
logger
ToUse
.
info
(
"Failed to introspect annotations on ["
+
element
+
"]: "
+
ex
);
}
}
}
}
}
}
...
@@ -1653,10 +1647,10 @@ public abstract class AnnotationUtils {
...
@@ -1653,10 +1647,10 @@ public abstract class AnnotationUtils {
return
synthesizedAnnotations
;
return
synthesizedAnnotations
;
}
}
catch
(
Exception
ex
)
{
catch
(
Exception
ex
)
{
rethrowAnnotationConfigurationException
(
ex
);
handleIntrospectionFailure
(
element
,
ex
);
// Unable to read value from repeating annotation container -> ignore it.
return
Collections
.
emptyList
();
}
}
// Unable to read value from repeating annotation container -> ignore it.
return
Collections
.
emptyList
();
}
}
}
}
...
...
编辑
预览
Markdown
is supported
0%
请重试
或
添加新附件
.
添加附件
取消
You are about to add
0
people
to the discussion. Proceed with caution.
先完成此消息的编辑!
取消
想要评论请
注册
或
登录