Skip to content
体验新版
项目
组织
正在加载...
登录
切换导航
打开侧边栏
爱吃血肠
spring-framework
提交
d3a0a8e0
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,体验更适合开发者的 AI 搜索 >>
提交
d3a0a8e0
编写于
3月 22, 2018
作者:
C
Christoph Dreis
提交者:
Juergen Hoeller
3月 22, 2018
浏览文件
操作
浏览文件
下载
电子邮件补丁
差异文件
Use Collection.removeIf() where possible (#1747)
Use Collection.removeIf() where possible Issue: SPR-16622
上级
e0de9126
变更
7
隐藏空白更改
内联
并排
Showing
7 changed file
with
19 addition
and
67 deletion
+19
-67
spring-aop/src/main/java/org/springframework/aop/framework/autoproxy/target/AbstractBeanFactoryBasedTargetSourceCreator.java
...y/target/AbstractBeanFactoryBasedTargetSourceCreator.java
+3
-8
spring-beans/src/main/java/org/springframework/beans/CachedIntrospectionResults.java
...org/springframework/beans/CachedIntrospectionResults.java
+6
-19
spring-beans/src/main/java/org/springframework/beans/factory/support/AbstractBeanFactory.java
...gframework/beans/factory/support/AbstractBeanFactory.java
+1
-7
spring-context/src/main/java/org/springframework/scripting/support/ScriptFactoryPostProcessor.java
...amework/scripting/support/ScriptFactoryPostProcessor.java
+3
-8
spring-messaging/src/main/java/org/springframework/messaging/simp/user/MultiServerUserRegistry.java
...ramework/messaging/simp/user/MultiServerUserRegistry.java
+2
-9
spring-webflux/src/main/java/org/springframework/web/reactive/result/condition/ConsumesRequestCondition.java
...b/reactive/result/condition/ConsumesRequestCondition.java
+2
-8
spring-webflux/src/main/java/org/springframework/web/reactive/result/condition/ProducesRequestCondition.java
...b/reactive/result/condition/ProducesRequestCondition.java
+2
-8
未找到文件。
spring-aop/src/main/java/org/springframework/aop/framework/autoproxy/target/AbstractBeanFactoryBasedTargetSourceCreator.java
浏览文件 @
d3a0a8e0
/*
* Copyright 2002-201
6
the original author or authors.
* Copyright 2002-201
8
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.
...
...
@@ -17,7 +17,6 @@
package
org.springframework.aop.framework.autoproxy.target
;
import
java.util.HashMap
;
import
java.util.Iterator
;
import
java.util.Map
;
import
org.apache.commons.logging.Log
;
...
...
@@ -31,7 +30,6 @@ import org.springframework.beans.factory.BeanFactory;
import
org.springframework.beans.factory.BeanFactoryAware
;
import
org.springframework.beans.factory.DisposableBean
;
import
org.springframework.beans.factory.config.BeanDefinition
;
import
org.springframework.beans.factory.config.BeanPostProcessor
;
import
org.springframework.beans.factory.config.ConfigurableBeanFactory
;
import
org.springframework.beans.factory.support.DefaultListableBeanFactory
;
import
org.springframework.beans.factory.support.GenericBeanDefinition
;
...
...
@@ -150,11 +148,8 @@ public abstract class AbstractBeanFactoryBasedTargetSourceCreator
// Filter out BeanPostProcessors that are part of the AOP infrastructure,
// since those are only meant to apply to beans defined in the original factory.
for
(
Iterator
<
BeanPostProcessor
>
it
=
internalBeanFactory
.
getBeanPostProcessors
().
iterator
();
it
.
hasNext
();)
{
if
(
it
.
next
()
instanceof
AopInfrastructureBean
)
{
it
.
remove
();
}
}
internalBeanFactory
.
getBeanPostProcessors
().
removeIf
(
beanPostProcessor
->
beanPostProcessor
instanceof
AopInfrastructureBean
);
return
internalBeanFactory
;
}
...
...
spring-beans/src/main/java/org/springframework/beans/CachedIntrospectionResults.java
浏览文件 @
d3a0a8e0
...
...
@@ -21,7 +21,6 @@ import java.beans.IntrospectionException;
import
java.beans.Introspector
;
import
java.beans.PropertyDescriptor
;
import
java.util.Collections
;
import
java.util.Iterator
;
import
java.util.LinkedHashMap
;
import
java.util.List
;
import
java.util.Map
;
...
...
@@ -150,24 +149,12 @@ public class CachedIntrospectionResults {
* @param classLoader the ClassLoader to clear the cache for
*/
public
static
void
clearClassLoader
(
@Nullable
ClassLoader
classLoader
)
{
for
(
Iterator
<
ClassLoader
>
it
=
acceptedClassLoaders
.
iterator
();
it
.
hasNext
();)
{
ClassLoader
registeredLoader
=
it
.
next
();
if
(
isUnderneathClassLoader
(
registeredLoader
,
classLoader
))
{
it
.
remove
();
}
}
for
(
Iterator
<
Class
<?>>
it
=
strongClassCache
.
keySet
().
iterator
();
it
.
hasNext
();)
{
Class
<?>
beanClass
=
it
.
next
();
if
(
isUnderneathClassLoader
(
beanClass
.
getClassLoader
(),
classLoader
))
{
it
.
remove
();
}
}
for
(
Iterator
<
Class
<?>>
it
=
softClassCache
.
keySet
().
iterator
();
it
.
hasNext
();)
{
Class
<?>
beanClass
=
it
.
next
();
if
(
isUnderneathClassLoader
(
beanClass
.
getClassLoader
(),
classLoader
))
{
it
.
remove
();
}
}
acceptedClassLoaders
.
removeIf
(
registeredLoader
->
isUnderneathClassLoader
(
registeredLoader
,
classLoader
));
strongClassCache
.
keySet
().
removeIf
(
beanClass
->
isUnderneathClassLoader
(
beanClass
.
getClassLoader
(),
classLoader
));
softClassCache
.
keySet
().
removeIf
(
beanClass
->
isUnderneathClassLoader
(
beanClass
.
getClassLoader
(),
classLoader
));
}
/**
...
...
spring-beans/src/main/java/org/springframework/beans/factory/support/AbstractBeanFactory.java
浏览文件 @
d3a0a8e0
...
...
@@ -27,7 +27,6 @@ import java.util.Arrays;
import
java.util.Collections
;
import
java.util.HashMap
;
import
java.util.HashSet
;
import
java.util.Iterator
;
import
java.util.LinkedHashMap
;
import
java.util.LinkedHashSet
;
import
java.util.LinkedList
;
...
...
@@ -1338,12 +1337,7 @@ public abstract class AbstractBeanFactory extends FactoryBeanRegistrySupport imp
* @since 4.2
*/
public
void
clearMetadataCache
()
{
Iterator
<
String
>
mergedBeans
=
this
.
mergedBeanDefinitions
.
keySet
().
iterator
();
while
(
mergedBeans
.
hasNext
())
{
if
(!
isBeanEligibleForMetadataCaching
(
mergedBeans
.
next
()))
{
mergedBeans
.
remove
();
}
}
this
.
mergedBeanDefinitions
.
keySet
().
removeIf
(
bean
->
!
isBeanEligibleForMetadataCaching
(
bean
));
}
/**
...
...
spring-context/src/main/java/org/springframework/scripting/support/ScriptFactoryPostProcessor.java
浏览文件 @
d3a0a8e0
/*
* Copyright 2002-201
7
the original author or authors.
* Copyright 2002-201
8
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.
...
...
@@ -17,7 +17,6 @@
package
org.springframework.scripting.support
;
import
java.util.HashMap
;
import
java.util.Iterator
;
import
java.util.Map
;
import
org.apache.commons.logging.Log
;
...
...
@@ -39,7 +38,6 @@ import org.springframework.beans.factory.BeanFactoryAware;
import
org.springframework.beans.factory.DisposableBean
;
import
org.springframework.beans.factory.FactoryBean
;
import
org.springframework.beans.factory.config.BeanDefinition
;
import
org.springframework.beans.factory.config.BeanPostProcessor
;
import
org.springframework.beans.factory.config.ConfigurableBeanFactory
;
import
org.springframework.beans.factory.config.InstantiationAwareBeanPostProcessorAdapter
;
import
org.springframework.beans.factory.support.AbstractBeanDefinition
;
...
...
@@ -225,11 +223,8 @@ public class ScriptFactoryPostProcessor extends InstantiationAwareBeanPostProces
// Filter out BeanPostProcessors that are part of the AOP infrastructure,
// since those are only meant to apply to beans defined in the original factory.
for
(
Iterator
<
BeanPostProcessor
>
it
=
this
.
scriptBeanFactory
.
getBeanPostProcessors
().
iterator
();
it
.
hasNext
();)
{
if
(
it
.
next
()
instanceof
AopInfrastructureBean
)
{
it
.
remove
();
}
}
this
.
scriptBeanFactory
.
getBeanPostProcessors
().
removeIf
(
beanPostProcessor
->
beanPostProcessor
instanceof
AopInfrastructureBean
);
}
@Override
...
...
spring-messaging/src/main/java/org/springframework/messaging/simp/user/MultiServerUserRegistry.java
浏览文件 @
d3a0a8e0
/*
* Copyright 2002-201
7
the original author or authors.
* Copyright 2002-201
8
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.
...
...
@@ -21,7 +21,6 @@ import java.net.UnknownHostException;
import
java.util.Collections
;
import
java.util.HashMap
;
import
java.util.HashSet
;
import
java.util.Iterator
;
import
java.util.Map
;
import
java.util.Set
;
import
java.util.UUID
;
...
...
@@ -175,13 +174,7 @@ public class MultiServerUserRegistry implements SimpUserRegistry, SmartApplicati
void
purgeExpiredRegistries
()
{
long
now
=
System
.
currentTimeMillis
();
Iterator
<
Map
.
Entry
<
String
,
UserRegistrySnapshot
>>
iterator
=
this
.
remoteRegistries
.
entrySet
().
iterator
();
while
(
iterator
.
hasNext
())
{
Map
.
Entry
<
String
,
UserRegistrySnapshot
>
entry
=
iterator
.
next
();
if
(
entry
.
getValue
().
isExpired
(
now
))
{
iterator
.
remove
();
}
}
this
.
remoteRegistries
.
entrySet
().
removeIf
(
entry
->
entry
.
getValue
().
isExpired
(
now
));
}
...
...
spring-webflux/src/main/java/org/springframework/web/reactive/result/condition/ConsumesRequestCondition.java
浏览文件 @
d3a0a8e0
/*
* Copyright 2002-201
6
the original author or authors.
* Copyright 2002-201
8
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.
...
...
@@ -19,7 +19,6 @@ package org.springframework.web.reactive.result.condition;
import
java.util.ArrayList
;
import
java.util.Collection
;
import
java.util.Collections
;
import
java.util.Iterator
;
import
java.util.LinkedHashSet
;
import
java.util.List
;
import
java.util.Set
;
...
...
@@ -168,12 +167,7 @@ public final class ConsumesRequestCondition extends AbstractRequestCondition<Con
return
this
;
}
Set
<
ConsumeMediaTypeExpression
>
result
=
new
LinkedHashSet
<>(
expressions
);
for
(
Iterator
<
ConsumeMediaTypeExpression
>
iterator
=
result
.
iterator
();
iterator
.
hasNext
();)
{
ConsumeMediaTypeExpression
expression
=
iterator
.
next
();
if
(!
expression
.
match
(
exchange
))
{
iterator
.
remove
();
}
}
result
.
removeIf
(
expression
->
!
expression
.
match
(
exchange
));
return
(
result
.
isEmpty
())
?
null
:
new
ConsumesRequestCondition
(
result
);
}
...
...
spring-webflux/src/main/java/org/springframework/web/reactive/result/condition/ProducesRequestCondition.java
浏览文件 @
d3a0a8e0
/*
* Copyright 2002-201
6
the original author or authors.
* Copyright 2002-201
8
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.
...
...
@@ -19,7 +19,6 @@ package org.springframework.web.reactive.result.condition;
import
java.util.ArrayList
;
import
java.util.Collection
;
import
java.util.Collections
;
import
java.util.Iterator
;
import
java.util.LinkedHashSet
;
import
java.util.List
;
import
java.util.Set
;
...
...
@@ -192,12 +191,7 @@ public final class ProducesRequestCondition extends AbstractRequestCondition<Pro
return
this
;
}
Set
<
ProduceMediaTypeExpression
>
result
=
new
LinkedHashSet
<>(
expressions
);
for
(
Iterator
<
ProduceMediaTypeExpression
>
iterator
=
result
.
iterator
();
iterator
.
hasNext
();)
{
ProduceMediaTypeExpression
expression
=
iterator
.
next
();
if
(!
expression
.
match
(
exchange
))
{
iterator
.
remove
();
}
}
result
.
removeIf
(
expression
->
!
expression
.
match
(
exchange
));
return
(
result
.
isEmpty
())
?
null
:
new
ProducesRequestCondition
(
result
,
this
.
contentTypeResolver
);
}
...
...
编辑
预览
Markdown
is supported
0%
请重试
或
添加新附件
.
添加附件
取消
You are about to add
0
people
to the discussion. Proceed with caution.
先完成此消息的编辑!
取消
想要评论请
注册
或
登录