Polish: Lambdas should be replaced with method references

This commit is contained in:
igor-suhorukov
2018-02-10 02:43:13 +03:00
committed by Juergen Hoeller
parent d3a1d44864
commit 6ea0af3540
9 changed files with 15 additions and 14 deletions

View File

@@ -744,8 +744,8 @@ public class DefaultListableBeanFactory extends AbstractAutowireCapableBeanFacto
final FactoryBean<?> factory = (FactoryBean<?>) bean;
boolean isEagerInit;
if (System.getSecurityManager() != null && factory instanceof SmartFactoryBean) {
isEagerInit = AccessController.doPrivileged((PrivilegedAction<Boolean>) () ->
((SmartFactoryBean<?>) factory).isEagerInit(),
isEagerInit = AccessController.doPrivileged((PrivilegedAction<Boolean>)
((SmartFactoryBean<?>) factory)::isEagerInit,
getAccessControlContext());
}
else {

View File

@@ -57,8 +57,8 @@ public abstract class FactoryBeanRegistrySupport extends DefaultSingletonBeanReg
protected Class<?> getTypeForFactoryBean(final FactoryBean<?> factoryBean) {
try {
if (System.getSecurityManager() != null) {
return AccessController.doPrivileged((PrivilegedAction<Class<?>>) () ->
factoryBean.getObjectType(), getAccessControlContext());
return AccessController.doPrivileged((PrivilegedAction<Class<?>>)
factoryBean::getObjectType, getAccessControlContext());
}
else {
return factoryBean.getObjectType();
@@ -151,8 +151,7 @@ public abstract class FactoryBeanRegistrySupport extends DefaultSingletonBeanReg
if (System.getSecurityManager() != null) {
AccessControlContext acc = getAccessControlContext();
try {
object = AccessController.doPrivileged((PrivilegedExceptionAction<Object>) () ->
factory.getObject(), acc);
object = AccessController.doPrivileged((PrivilegedExceptionAction<Object>) factory::getObject, acc);
}
catch (PrivilegedActionException pae) {
throw pae.getException();

View File

@@ -72,7 +72,7 @@ public class SimpleInstantiationStrategy implements InstantiationStrategy {
try {
if (System.getSecurityManager() != null) {
constructorToUse = AccessController.doPrivileged(
(PrivilegedExceptionAction<Constructor<?>>) () -> clazz.getDeclaredConstructor());
(PrivilegedExceptionAction<Constructor<?>>) clazz::getDeclaredConstructor);
}
else {
constructorToUse = clazz.getDeclaredConstructor();