Polishing

This commit is contained in:
Juergen Hoeller
2018-07-22 19:33:40 +02:00
parent 192113de60
commit f5dd4d2c02
3 changed files with 14 additions and 13 deletions

View File

@@ -31,7 +31,6 @@ import java.util.Collection;
import java.util.HashSet;
import java.util.LinkedHashSet;
import java.util.List;
import java.util.Map;
import java.util.Set;
import java.util.TreeSet;
import java.util.concurrent.ConcurrentHashMap;
@@ -156,7 +155,7 @@ public abstract class AbstractAutowireCapableBeanFactory extends AbstractBeanFac
private final NamedThreadLocal<String> currentlyCreatedBean = new NamedThreadLocal<>("Currently created bean");
/** Cache of unfinished FactoryBean instances: FactoryBean name --> BeanWrapper */
private final Map<String, BeanWrapper> factoryBeanInstanceCache = new ConcurrentHashMap<>(16);
private final ConcurrentMap<String, BeanWrapper> factoryBeanInstanceCache = new ConcurrentHashMap<>(16);
/** Cache of filtered PropertyDescriptors: bean Class -> PropertyDescriptor array */
private final ConcurrentMap<Class<?>, PropertyDescriptor[]> filteredPropertyDescriptorsCache =

View File

@@ -1,5 +1,5 @@
/*
* Copyright 2002-2016 the original author or authors.
* Copyright 2002-2018 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.
@@ -47,7 +47,7 @@ import static org.junit.Assert.*;
/**
* Unit tests for {@link org.springframework.beans.factory.annotation.AutowiredAnnotationBeanPostProcessor}
* processing the JSR-303 {@link javax.inject.Inject} annotation.
* processing the JSR-330 {@link javax.inject.Inject} annotation.
*
* @author Juergen Hoeller
* @since 3.0
@@ -550,11 +550,9 @@ public class InjectAnnotationBeanPostProcessorTests {
}
/**
* Verifies that a dependency on a {@link org.springframework.beans.factory.FactoryBean} can be autowired via
* {@link org.springframework.beans.factory.annotation.Autowired @Inject}, specifically addressing the JIRA issue
* raised in <a
* href="http://opensource.atlassian.com/projects/spring/browse/SPR-4040"
* target="_blank">SPR-4040</a>.
* Verifies that a dependency on a {@link org.springframework.beans.factory.FactoryBean}
* can be autowired via {@link org.springframework.beans.factory.annotation.Autowired @Inject},
* specifically addressing SPR-4040.
*/
@Test
public void testBeanAutowiredWithFactoryBean() {
@@ -1315,7 +1313,7 @@ public class InjectAnnotationBeanPostProcessorTests {
public static class StringFactoryBean implements FactoryBean<String> {
@Override
public String getObject() throws Exception {
public String getObject() {
return "";
}

View File

@@ -430,7 +430,8 @@ public class ResolvableType implements Serializable {
if (this == NONE) {
return NONE;
}
if (ObjectUtils.nullSafeEquals(resolve(), type)) {
Class<?> resolved = resolve();
if (resolved == null || resolved == type) {
return this;
}
for (ResolvableType interfaceType : getInterfaces()) {
@@ -468,7 +469,7 @@ public class ResolvableType implements Serializable {
*/
public ResolvableType[] getInterfaces() {
Class<?> resolved = resolve();
if (resolved == null || ObjectUtils.isEmpty(resolved.getGenericInterfaces())) {
if (resolved == null || resolved.getGenericInterfaces().length == 0) {
return EMPTY_TYPES_ARRAY;
}
ResolvableType[] interfaces = this.interfaces;
@@ -818,7 +819,7 @@ public class ResolvableType implements Serializable {
@Nullable
private Type resolveBounds(Type[] bounds) {
if (ObjectUtils.isEmpty(bounds) || Object.class == bounds[0]) {
if (bounds.length == 0 || bounds[0] == Object.class) {
return null;
}
return bounds[0];
@@ -1638,6 +1639,9 @@ public class ResolvableType implements Serializable {
}
/**
* Internal {@link Type} used to represent an empty value.
*/
@SuppressWarnings("serial")
static class EmptyType implements Type, Serializable {