Nullability refinements on private and static methods
Based on IntelliJ IDEA 2017.3 introspection results. Issue: SPR-15756
This commit is contained in:
@@ -205,7 +205,7 @@ public class BeanWrapperImpl extends AbstractNestablePropertyAccessor implements
|
||||
* @throws TypeMismatchException if type conversion failed
|
||||
*/
|
||||
@Nullable
|
||||
public Object convertForProperty(Object value, String propertyName) throws TypeMismatchException {
|
||||
public Object convertForProperty(@Nullable Object value, String propertyName) throws TypeMismatchException {
|
||||
CachedIntrospectionResults cachedIntrospectionResults = getCachedIntrospectionResults();
|
||||
PropertyDescriptor pd = cachedIntrospectionResults.getPropertyDescriptor(propertyName);
|
||||
if (pd == null) {
|
||||
|
||||
@@ -541,6 +541,7 @@ public class PropertyEditorRegistrySupport implements PropertyEditorRegistry {
|
||||
return this.registeredType;
|
||||
}
|
||||
|
||||
@Nullable
|
||||
private PropertyEditor getPropertyEditor(@Nullable Class<?> requiredType) {
|
||||
// Special case: If no required type specified, which usually only happens for
|
||||
// Collection elements, or required type is not assignable to registered type,
|
||||
|
||||
@@ -97,7 +97,7 @@ public class PropertyValue extends BeanMetadataAttributeAccessor implements Seri
|
||||
* @param original the PropertyValue to link to (never {@code null})
|
||||
* @param newValue the new value to apply
|
||||
*/
|
||||
public PropertyValue(PropertyValue original, Object newValue) {
|
||||
public PropertyValue(PropertyValue original, @Nullable Object newValue) {
|
||||
Assert.notNull(original, "Original must not be null");
|
||||
this.name = original.getName();
|
||||
this.value = newValue;
|
||||
@@ -172,7 +172,7 @@ public class PropertyValue extends BeanMetadataAttributeAccessor implements Seri
|
||||
* Set the converted value of the constructor argument,
|
||||
* after processed type conversion.
|
||||
*/
|
||||
public synchronized void setConvertedValue(Object value) {
|
||||
public synchronized void setConvertedValue(@Nullable Object value) {
|
||||
this.converted = true;
|
||||
this.convertedValue = value;
|
||||
}
|
||||
|
||||
@@ -459,21 +459,18 @@ public class GroovyBeanDefinitionReader extends AbstractBeanDefinitionReader imp
|
||||
boolean hasClosureArgument = (args[args.length - 1] instanceof Closure);
|
||||
if (args[0] instanceof Class) {
|
||||
Class<?> beanClass = (Class<?>) args[0];
|
||||
if (args.length >= 1) {
|
||||
if (hasClosureArgument) {
|
||||
if (args.length - 1 != 1) {
|
||||
this.currentBeanDefinition = new GroovyBeanDefinitionWrapper(
|
||||
beanName, beanClass, resolveConstructorArguments(args, 1, args.length - 1));
|
||||
}
|
||||
else {
|
||||
this.currentBeanDefinition = new GroovyBeanDefinitionWrapper(beanName, beanClass);
|
||||
}
|
||||
}
|
||||
else {
|
||||
if (hasClosureArgument) {
|
||||
if (args.length - 1 != 1) {
|
||||
this.currentBeanDefinition = new GroovyBeanDefinitionWrapper(
|
||||
beanName, beanClass, resolveConstructorArguments(args, 1, args.length));
|
||||
beanName, beanClass, resolveConstructorArguments(args, 1, args.length - 1));
|
||||
}
|
||||
|
||||
else {
|
||||
this.currentBeanDefinition = new GroovyBeanDefinitionWrapper(beanName, beanClass);
|
||||
}
|
||||
}
|
||||
else {
|
||||
this.currentBeanDefinition = new GroovyBeanDefinitionWrapper(
|
||||
beanName, beanClass, resolveConstructorArguments(args, 1, args.length));
|
||||
}
|
||||
}
|
||||
else if (args[0] instanceof RuntimeBeanReference) {
|
||||
|
||||
@@ -1556,7 +1556,7 @@ public abstract class AbstractAutowireCapableBeanFactory extends AbstractBeanFac
|
||||
* @param pvs the new property values
|
||||
*/
|
||||
protected void applyPropertyValues(String beanName, BeanDefinition mbd, BeanWrapper bw, PropertyValues pvs) {
|
||||
if (pvs == null || pvs.isEmpty()) {
|
||||
if (pvs.isEmpty()) {
|
||||
return;
|
||||
}
|
||||
|
||||
@@ -1649,7 +1649,9 @@ public abstract class AbstractAutowireCapableBeanFactory extends AbstractBeanFac
|
||||
* Convert the given value for the specified target property.
|
||||
*/
|
||||
@Nullable
|
||||
private Object convertForProperty(Object value, String propertyName, BeanWrapper bw, TypeConverter converter) {
|
||||
private Object convertForProperty(
|
||||
@Nullable Object value, String propertyName, BeanWrapper bw, TypeConverter converter) {
|
||||
|
||||
if (converter instanceof BeanWrapperImpl) {
|
||||
return ((BeanWrapperImpl) converter).convertForProperty(value, propertyName);
|
||||
}
|
||||
|
||||
@@ -145,7 +145,6 @@ abstract class AutowireUtils {
|
||||
* @param requiredType the type to assign the result to
|
||||
* @return the resolved value
|
||||
*/
|
||||
@Nullable
|
||||
public static Object resolveAutowiringValue(Object autowiringValue, Class<?> requiredType) {
|
||||
if (autowiringValue instanceof ObjectFactory && !requiredType.isInstance(autowiringValue)) {
|
||||
ObjectFactory<?> factory = (ObjectFactory<?>) autowiringValue;
|
||||
|
||||
@@ -93,6 +93,7 @@ public final class ParserContext {
|
||||
return this.readerContext.extractSource(sourceCandidate);
|
||||
}
|
||||
|
||||
@Nullable
|
||||
public CompositeComponentDefinition getContainingComponent() {
|
||||
return (!this.containingComponents.isEmpty() ?
|
||||
(CompositeComponentDefinition) this.containingComponents.lastElement() : null);
|
||||
|
||||
Reference in New Issue
Block a user