Skip to content
体验新版
项目
组织
正在加载...
登录
切换导航
打开侧边栏
爱吃血肠
spring-framework
提交
a2d40f3f
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,发现更多精彩内容 >>
提交
a2d40f3f
编写于
1月 04, 2014
作者:
J
Juergen Hoeller
浏览文件
操作
浏览文件
下载
电子邮件补丁
差异文件
Polishing
上级
0de307bb
变更
4
隐藏空白更改
内联
并排
Showing
4 changed file
with
20 addition
and
27 deletion
+20
-27
spring-aop/src/main/java/org/springframework/aop/framework/CglibAopProxy.java
...java/org/springframework/aop/framework/CglibAopProxy.java
+10
-13
spring-aop/src/main/java/org/springframework/aop/framework/ObjenesisCglibAopProxy.java
...springframework/aop/framework/ObjenesisCglibAopProxy.java
+4
-5
spring-aop/src/main/java/org/springframework/aop/support/AbstractRegexpMethodPointcut.java
...ngframework/aop/support/AbstractRegexpMethodPointcut.java
+4
-4
spring-aop/src/main/java/org/springframework/aop/support/ComposablePointcut.java
...a/org/springframework/aop/support/ComposablePointcut.java
+2
-5
未找到文件。
spring-aop/src/main/java/org/springframework/aop/framework/CglibAopProxy.java
浏览文件 @
a2d40f3f
...
...
@@ -219,12 +219,11 @@ class CglibAopProxy implements AopProxy, Serializable {
}
protected
Object
createProxyClassAndInstance
(
Enhancer
enhancer
,
Callback
[]
callbacks
)
{
enhancer
.
setInterceptDuringConstruction
(
false
);
enhancer
.
setCallbacks
(
callbacks
);
return
this
.
constructorArgs
==
null
?
enhancer
.
create
()
:
enhancer
.
create
(
this
.
constructorArgTypes
,
this
.
constructorArgs
);
return
(
this
.
constructorArgs
!=
null
?
enhancer
.
create
(
this
.
constructorArgTypes
,
this
.
constructorArgs
)
:
enhancer
.
create
()
);
}
/**
...
...
@@ -314,8 +313,7 @@ class CglibAopProxy implements AopProxy, Serializable {
Callback
[]
fixedCallbacks
=
new
Callback
[
methods
.
length
];
this
.
fixedInterceptorMap
=
new
HashMap
<
String
,
Integer
>(
methods
.
length
);
// TODO: small memory optimisation here (can skip creation for
// methods with no advice)
// TODO: small memory optimisation here (can skip creation for methods with no advice)
for
(
int
x
=
0
;
x
<
methods
.
length
;
x
++)
{
List
<
Object
>
chain
=
this
.
advised
.
getInterceptorsAndDynamicInterceptionAdvice
(
methods
[
x
],
rootClass
);
fixedCallbacks
[
x
]
=
new
FixedChainStaticTargetInterceptor
(
...
...
@@ -342,16 +340,15 @@ class CglibAopProxy implements AopProxy, Serializable {
*/
private
static
Object
processReturnType
(
Object
proxy
,
Object
target
,
Method
method
,
Object
retVal
)
{
// Massage return value if necessary
if
(
retVal
!=
null
&&
retVal
==
target
&&
!
RawTargetAccess
.
class
.
isAssignableFrom
(
method
.
getDeclaringClass
()))
{
// Special case: it returned "this".
// Note that we can't help if the target sets a reference
// to itself in another returned object.
if
(
retVal
!=
null
&&
retVal
==
target
&&
!
RawTargetAccess
.
class
.
isAssignableFrom
(
method
.
getDeclaringClass
()))
{
// Special case: it returned "this". Note that we can't help
// if the target sets a reference to itself in another returned object.
retVal
=
proxy
;
}
Class
<?>
returnType
=
method
.
getReturnType
();
if
(
retVal
==
null
&&
returnType
!=
Void
.
TYPE
&&
returnType
.
isPrimitive
())
{
throw
new
AopInvocationException
(
"Null return value from advice does not match primitive return type for: "
+
method
);
throw
new
AopInvocationException
(
"Null return value from advice does not match primitive return type for: "
+
method
);
}
return
retVal
;
}
...
...
@@ -864,7 +861,7 @@ class CglibAopProxy implements AopProxy, Serializable {
@Override
public
boolean
equals
(
Object
other
)
{
if
(
other
==
this
)
{
if
(
this
==
other
)
{
return
true
;
}
if
(!(
other
instanceof
ProxyCallbackFilter
))
{
...
...
spring-aop/src/main/java/org/springframework/aop/framework/ObjenesisCglibAopProxy.java
浏览文件 @
a2d40f3f
...
...
@@ -16,9 +16,9 @@
package
org.springframework.aop.framework
;
import
org.apache.commons.logging.Log
;
import
org.apache.commons.logging.LogFactory
;
import
org.springframework.cglib.proxy.Callback
;
import
org.springframework.cglib.proxy.Enhancer
;
import
org.springframework.cglib.proxy.Factory
;
...
...
@@ -54,15 +54,14 @@ class ObjenesisCglibAopProxy extends CglibAopProxy {
@SuppressWarnings
(
"unchecked"
)
protected
Object
createProxyClassAndInstance
(
Enhancer
enhancer
,
Callback
[]
callbacks
)
{
try
{
Factory
factory
=
(
Factory
)
objenesis
.
newInstance
(
enhancer
.
createClass
());
Factory
factory
=
(
Factory
)
this
.
objenesis
.
newInstance
(
enhancer
.
createClass
());
factory
.
setCallbacks
(
callbacks
);
return
factory
;
}
catch
(
ObjenesisException
ex
)
{
// Fallback to
Cglib
on unsupported JVMs
// Fallback to
regular proxy construction
on unsupported JVMs
if
(
logger
.
isDebugEnabled
())
{
logger
.
debug
(
"Unable to instantiate proxy using Objenesis, falling back "
+
"to regular proxy construction"
,
ex
);
logger
.
debug
(
"Unable to instantiate proxy using Objenesis, falling back to regular proxy construction"
,
ex
);
}
return
super
.
createProxyClassAndInstance
(
enhancer
,
callbacks
);
}
...
...
spring-aop/src/main/java/org/springframework/aop/support/AbstractRegexpMethodPointcut.java
浏览文件 @
a2d40f3f
...
...
@@ -64,7 +64,7 @@ public abstract class AbstractRegexpMethodPointcut extends StaticMethodMatcherPo
* @see #setPatterns
*/
public
void
setPattern
(
String
pattern
)
{
setPatterns
(
new
String
[]
{
pattern
}
);
setPatterns
(
pattern
);
}
/**
...
...
@@ -72,7 +72,7 @@ public abstract class AbstractRegexpMethodPointcut extends StaticMethodMatcherPo
* Matching will be the union of all these; if any match,
* the pointcut matches.
*/
public
void
setPatterns
(
String
[]
patterns
)
{
public
void
setPatterns
(
String
...
patterns
)
{
Assert
.
notEmpty
(
patterns
,
"'patterns' must not be empty"
);
this
.
patterns
=
new
String
[
patterns
.
length
];
for
(
int
i
=
0
;
i
<
patterns
.
length
;
i
++)
{
...
...
@@ -94,7 +94,7 @@ public abstract class AbstractRegexpMethodPointcut extends StaticMethodMatcherPo
* @see #setExcludedPatterns
*/
public
void
setExcludedPattern
(
String
excludedPattern
)
{
setExcludedPatterns
(
new
String
[]
{
excludedPattern
}
);
setExcludedPatterns
(
excludedPattern
);
}
/**
...
...
@@ -102,7 +102,7 @@ public abstract class AbstractRegexpMethodPointcut extends StaticMethodMatcherPo
* Matching will be the union of all these; if any match,
* the pointcut matches.
*/
public
void
setExcludedPatterns
(
String
[]
excludedPatterns
)
{
public
void
setExcludedPatterns
(
String
...
excludedPatterns
)
{
Assert
.
notEmpty
(
excludedPatterns
,
"'excludedPatterns' must not be empty"
);
this
.
excludedPatterns
=
new
String
[
excludedPatterns
.
length
];
for
(
int
i
=
0
;
i
<
excludedPatterns
.
length
;
i
++)
{
...
...
spring-aop/src/main/java/org/springframework/aop/support/ComposablePointcut.java
浏览文件 @
a2d40f3f
/*
* Copyright 2002-201
2
the original author or authors.
* Copyright 2002-201
3
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.
...
...
@@ -180,7 +180,6 @@ public class ComposablePointcut implements Pointcut, Serializable {
return
this
.
methodMatcher
;
}
@Override
public
boolean
equals
(
Object
other
)
{
if
(
this
==
other
)
{
...
...
@@ -189,7 +188,6 @@ public class ComposablePointcut implements Pointcut, Serializable {
if
(!(
other
instanceof
ComposablePointcut
))
{
return
false
;
}
ComposablePointcut
that
=
(
ComposablePointcut
)
other
;
return
ObjectUtils
.
nullSafeEquals
(
that
.
classFilter
,
this
.
classFilter
)
&&
ObjectUtils
.
nullSafeEquals
(
that
.
methodMatcher
,
this
.
methodMatcher
);
...
...
@@ -209,8 +207,7 @@ public class ComposablePointcut implements Pointcut, Serializable {
@Override
public
String
toString
()
{
return
"ComposablePointcut: ClassFilter ["
+
this
.
classFilter
+
"], MethodMatcher ["
+
this
.
methodMatcher
+
"]"
;
return
"ComposablePointcut: "
+
this
.
classFilter
+
", "
+
this
.
methodMatcher
;
}
}
编辑
预览
Markdown
is supported
0%
请重试
或
添加新附件
.
添加附件
取消
You are about to add
0
people
to the discussion. Proceed with caution.
先完成此消息的编辑!
取消
想要评论请
注册
或
登录