Skip to content
体验新版
项目
组织
正在加载...
登录
切换导航
打开侧边栏
带水的鱼儿
spring-framework
提交
2d1b4420
S
spring-framework
项目概览
带水的鱼儿
/
spring-framework
与 Fork 源项目一致
从无法访问的项目Fork
通知
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,发现更多精彩内容 >>
提交
2d1b4420
编写于
7月 24, 2013
作者:
J
Juergen Hoeller
浏览文件
操作
浏览文件
下载
电子邮件补丁
差异文件
OpenJDK 8 build 99: annotation discovery on bridge methods
上级
f7b7649d
变更
5
隐藏空白更改
内联
并排
Showing
5 changed file
with
16 addition
and
45 deletion
+16
-45
spring-aspects/src/main/java/org/springframework/scheduling/aspectj/AspectJAsyncConfiguration.java
...amework/scheduling/aspectj/AspectJAsyncConfiguration.java
+0
-1
spring-context/src/main/java/org/springframework/scheduling/annotation/AbstractAsyncConfiguration.java
...ork/scheduling/annotation/AbstractAsyncConfiguration.java
+0
-7
spring-context/src/main/java/org/springframework/scheduling/annotation/ProxyAsyncConfiguration.java
...mework/scheduling/annotation/ProxyAsyncConfiguration.java
+0
-1
spring-core/src/main/java/org/springframework/core/type/StandardAnnotationMetadata.java
...springframework/core/type/StandardAnnotationMetadata.java
+2
-2
spring-core/src/test/java/org/springframework/core/annotation/AnnotationUtilsTests.java
...springframework/core/annotation/AnnotationUtilsTests.java
+14
-34
未找到文件。
spring-aspects/src/main/java/org/springframework/scheduling/aspectj/AspectJAsyncConfiguration.java
浏览文件 @
2d1b4420
...
...
@@ -36,7 +36,6 @@ import org.springframework.scheduling.annotation.EnableAsync;
@Configuration
public
class
AspectJAsyncConfiguration
extends
AbstractAsyncConfiguration
{
@Override
@Bean
(
name
=
AnnotationConfigUtils
.
ASYNC_EXECUTION_ASPECT_BEAN_NAME
)
@Role
(
BeanDefinition
.
ROLE_INFRASTRUCTURE
)
public
AnnotationAsyncExecutionAspect
asyncAdvisor
()
{
...
...
spring-context/src/main/java/org/springframework/scheduling/annotation/AbstractAsyncConfiguration.java
浏览文件 @
2d1b4420
...
...
@@ -49,13 +49,6 @@ public abstract class AbstractAsyncConfiguration implements ImportAware {
importMetadata
.
getClassName
());
}
/**
* The component that will apply async execution advice to beans annotated with
* the async annotation. Subclasses will provide either a BeanPostProcessor in
* the case of proxy-based advice, or an AspectJ aspect if weaving is preferred.
*/
public
abstract
Object
asyncAdvisor
();
/**
* Collect any {@link AsyncConfigurer} beans through autowiring.
*/
...
...
spring-context/src/main/java/org/springframework/scheduling/annotation/ProxyAsyncConfiguration.java
浏览文件 @
2d1b4420
...
...
@@ -38,7 +38,6 @@ import org.springframework.util.Assert;
@Configuration
public
class
ProxyAsyncConfiguration
extends
AbstractAsyncConfiguration
{
@Override
@Bean
(
name
=
AnnotationConfigUtils
.
ASYNC_ANNOTATION_PROCESSOR_BEAN_NAME
)
@Role
(
BeanDefinition
.
ROLE_INFRASTRUCTURE
)
public
AsyncAnnotationBeanPostProcessor
asyncAdvisor
()
{
...
...
spring-core/src/main/java/org/springframework/core/type/StandardAnnotationMetadata.java
浏览文件 @
2d1b4420
...
...
@@ -141,9 +141,9 @@ public class StandardAnnotationMetadata extends StandardClassMetadata implements
Method
[]
methods
=
getIntrospectedClass
().
getDeclaredMethods
();
Set
<
MethodMetadata
>
annotatedMethods
=
new
LinkedHashSet
<
MethodMetadata
>();
for
(
Method
method
:
methods
)
{
// TODO: on OpenJDK 8 b99, bridge methods seem to be discovered as annotated as well...
if
(
AnnotatedElementUtils
.
isAnnotated
(
method
,
annotationType
))
{
annotatedMethods
.
add
(
new
StandardMethodMetadata
(
method
,
this
.
nestedAnnotationsAsMap
));
annotatedMethods
.
add
(
new
StandardMethodMetadata
(
method
,
this
.
nestedAnnotationsAsMap
));
}
}
return
annotatedMethods
;
...
...
spring-core/src/test/java/org/springframework/core/annotation/AnnotationUtilsTests.java
浏览文件 @
2d1b4420
...
...
@@ -16,15 +16,11 @@
package
org.springframework.core.annotation
;
import
static
org
.
junit
.
Assert
.*;
import
static
org
.
springframework
.
core
.
annotation
.
AnnotationUtils
.*;
import
java.lang.annotation.Annotation
;
import
java.lang.annotation.Inherited
;
import
java.lang.annotation.Retention
;
import
java.lang.annotation.RetentionPolicy
;
import
java.lang.reflect.Method
;
import
java.util.Arrays
;
import
java.util.List
;
...
...
@@ -33,9 +29,10 @@ import org.junit.Test;
import
org.springframework.core.Ordered
;
import
org.springframework.stereotype.Component
;
import
static
org
.
junit
.
Assert
.*;
import
static
org
.
springframework
.
core
.
annotation
.
AnnotationUtils
.*;
/**
* Unit tests for {@link AnnotationUtils}.
*
* @author Rod Johnson
* @author Juergen Hoeller
* @author Sam Brannen
...
...
@@ -45,8 +42,7 @@ public class AnnotationUtilsTests {
@Test
public
void
testFindMethodAnnotationOnLeaf
()
throws
SecurityException
,
NoSuchMethodException
{
final
Method
m
=
Leaf
.
class
.
getMethod
(
"annotatedOnLeaf"
,
(
Class
[])
null
);
Method
m
=
Leaf
.
class
.
getMethod
(
"annotatedOnLeaf"
,
(
Class
[])
null
);
assertNotNull
(
m
.
getAnnotation
(
Order
.
class
));
assertNotNull
(
getAnnotation
(
m
,
Order
.
class
));
assertNotNull
(
findAnnotation
(
m
,
Order
.
class
));
...
...
@@ -54,8 +50,7 @@ public class AnnotationUtilsTests {
@Test
public
void
testFindMethodAnnotationOnRoot
()
throws
SecurityException
,
NoSuchMethodException
{
final
Method
m
=
Leaf
.
class
.
getMethod
(
"annotatedOnRoot"
,
(
Class
[])
null
);
Method
m
=
Leaf
.
class
.
getMethod
(
"annotatedOnRoot"
,
(
Class
[])
null
);
assertNotNull
(
m
.
getAnnotation
(
Order
.
class
));
assertNotNull
(
getAnnotation
(
m
,
Order
.
class
));
assertNotNull
(
findAnnotation
(
m
,
Order
.
class
));
...
...
@@ -63,8 +58,7 @@ public class AnnotationUtilsTests {
@Test
public
void
testFindMethodAnnotationOnRootButOverridden
()
throws
SecurityException
,
NoSuchMethodException
{
final
Method
m
=
Leaf
.
class
.
getMethod
(
"overrideWithoutNewAnnotation"
,
(
Class
[])
null
);
Method
m
=
Leaf
.
class
.
getMethod
(
"overrideWithoutNewAnnotation"
,
(
Class
[])
null
);
assertNull
(
m
.
getAnnotation
(
Order
.
class
));
assertNull
(
getAnnotation
(
m
,
Order
.
class
));
assertNotNull
(
findAnnotation
(
m
,
Order
.
class
));
...
...
@@ -72,20 +66,18 @@ public class AnnotationUtilsTests {
@Test
public
void
testFindMethodAnnotationNotAnnotated
()
throws
SecurityException
,
NoSuchMethodException
{
final
Method
m
=
Leaf
.
class
.
getMethod
(
"notAnnotated"
,
(
Class
[])
null
);
Method
m
=
Leaf
.
class
.
getMethod
(
"notAnnotated"
,
(
Class
[])
null
);
assertNull
(
findAnnotation
(
m
,
Order
.
class
));
}
@Test
public
void
testFindMethodAnnotationOnBridgeMethod
()
throws
Exception
{
final
Method
m
=
SimpleFoo
.
class
.
getMethod
(
"something"
,
Object
.
class
);
Method
m
=
SimpleFoo
.
class
.
getMethod
(
"something"
,
Object
.
class
);
assertTrue
(
m
.
isBridge
());
assertNull
(
m
.
getAnnotation
(
Order
.
class
));
assertNull
(
getAnnotation
(
m
,
Order
.
class
));
assertNotNull
(
findAnnotation
(
m
,
Order
.
class
));
assertNull
(
m
.
getAnnotation
(
Transactional
.
class
));
// TODO: actually found on OpenJDK 8 b99!
assertNull(m.getAnnotation(Transactional.class));
assertNotNull
(
getAnnotation
(
m
,
Transactional
.
class
));
assertNotNull
(
findAnnotation
(
m
,
Transactional
.
class
));
}
...
...
@@ -101,7 +93,6 @@ public class AnnotationUtilsTests {
@Test
public
void
testFindAnnotationDeclaringClass
()
throws
Exception
{
// no class-level annotation
assertNull
(
findAnnotationDeclaringClass
(
Transactional
.
class
,
NonAnnotatedInterface
.
class
));
assertNull
(
findAnnotationDeclaringClass
(
Transactional
.
class
,
NonAnnotatedClass
.
class
));
...
...
@@ -128,7 +119,6 @@ public class AnnotationUtilsTests {
@Test
public
void
findAnnotationDeclaringClassForTypesWithSingleCandidateType
()
{
// no class-level annotation
List
<
Class
<?
extends
Annotation
>>
transactionalCandidateList
=
Arrays
.<
Class
<?
extends
Annotation
>>
asList
(
Transactional
.
class
);
assertNull
(
findAnnotationDeclaringClassForTypes
(
transactionalCandidateList
,
NonAnnotatedInterface
.
class
));
...
...
@@ -158,9 +148,7 @@ public class AnnotationUtilsTests {
@Test
public
void
findAnnotationDeclaringClassForTypesWithMultipleCandidateTypes
()
{
List
<
Class
<?
extends
Annotation
>>
candidates
=
Arrays
.<
Class
<?
extends
Annotation
>>
asList
(
Transactional
.
class
,
Order
.
class
);
List
<
Class
<?
extends
Annotation
>>
candidates
=
Arrays
.<
Class
<?
extends
Annotation
>>
asList
(
Transactional
.
class
,
Order
.
class
);
// no class-level annotation
assertNull
(
findAnnotationDeclaringClassForTypes
(
candidates
,
NonAnnotatedInterface
.
class
));
...
...
@@ -196,7 +184,6 @@ public class AnnotationUtilsTests {
@Test
public
void
testIsAnnotationDeclaredLocally
()
throws
Exception
{
// no class-level annotation
assertFalse
(
isAnnotationDeclaredLocally
(
Transactional
.
class
,
NonAnnotatedInterface
.
class
));
assertFalse
(
isAnnotationDeclaredLocally
(
Transactional
.
class
,
NonAnnotatedClass
.
class
));
...
...
@@ -216,7 +203,6 @@ public class AnnotationUtilsTests {
@Test
public
void
testIsAnnotationInherited
()
throws
Exception
{
// no class-level annotation
assertFalse
(
isAnnotationInherited
(
Transactional
.
class
,
NonAnnotatedInterface
.
class
));
assertFalse
(
isAnnotationInherited
(
Transactional
.
class
,
NonAnnotatedClass
.
class
));
...
...
@@ -239,9 +225,8 @@ public class AnnotationUtilsTests {
@Test
public
void
testGetValueFromAnnotation
()
throws
Exception
{
final
Method
method
=
SimpleFoo
.
class
.
getMethod
(
"something"
,
Object
.
class
);
final
Order
order
=
findAnnotation
(
method
,
Order
.
class
);
Method
method
=
SimpleFoo
.
class
.
getMethod
(
"something"
,
Object
.
class
);
Order
order
=
findAnnotation
(
method
,
Order
.
class
);
assertEquals
(
1
,
AnnotationUtils
.
getValue
(
order
,
AnnotationUtils
.
VALUE
));
assertEquals
(
1
,
AnnotationUtils
.
getValue
(
order
));
...
...
@@ -249,9 +234,8 @@ public class AnnotationUtilsTests {
@Test
public
void
testGetDefaultValueFromAnnotation
()
throws
Exception
{
final
Method
method
=
SimpleFoo
.
class
.
getMethod
(
"something"
,
Object
.
class
);
final
Order
order
=
findAnnotation
(
method
,
Order
.
class
);
Method
method
=
SimpleFoo
.
class
.
getMethod
(
"something"
,
Object
.
class
);
Order
order
=
findAnnotation
(
method
,
Order
.
class
);
assertEquals
(
Ordered
.
LOWEST_PRECEDENCE
,
AnnotationUtils
.
getDefaultValue
(
order
,
AnnotationUtils
.
VALUE
));
assertEquals
(
Ordered
.
LOWEST_PRECEDENCE
,
AnnotationUtils
.
getDefaultValue
(
order
));
...
...
@@ -259,14 +243,12 @@ public class AnnotationUtilsTests {
@Test
public
void
testGetDefaultValueFromAnnotationType
()
throws
Exception
{
assertEquals
(
Ordered
.
LOWEST_PRECEDENCE
,
AnnotationUtils
.
getDefaultValue
(
Order
.
class
,
AnnotationUtils
.
VALUE
));
assertEquals
(
Ordered
.
LOWEST_PRECEDENCE
,
AnnotationUtils
.
getDefaultValue
(
Order
.
class
));
}
@Test
public
void
testFindAnnotationFromInterface
()
throws
Exception
{
Method
method
=
ImplementsInterfaceWithAnnotatedMethod
.
class
.
getMethod
(
"foo"
);
Order
order
=
findAnnotation
(
method
,
Order
.
class
);
assertNotNull
(
order
);
...
...
@@ -274,7 +256,6 @@ public class AnnotationUtilsTests {
@Test
public
void
testFindAnnotationFromInterfaceOnSuper
()
throws
Exception
{
Method
method
=
SubOfImplementsInterfaceWithAnnotatedMethod
.
class
.
getMethod
(
"foo"
);
Order
order
=
findAnnotation
(
method
,
Order
.
class
);
assertNotNull
(
order
);
...
...
@@ -282,7 +263,6 @@ public class AnnotationUtilsTests {
@Test
public
void
testFindAnnotationFromInterfaceWhenSuperDoesNotImplementMethod
()
throws
Exception
{
Method
method
=
SubOfAbstractImplementsInterfaceWithAnnotatedMethod
.
class
.
getMethod
(
"foo"
);
Order
order
=
findAnnotation
(
method
,
Order
.
class
);
assertNotNull
(
order
);
...
...
编辑
预览
Markdown
is supported
0%
请重试
或
添加新附件
.
添加附件
取消
You are about to add
0
people
to the discussion. Proceed with caution.
先完成此消息的编辑!
取消
想要评论请
注册
或
登录