Nullability fine-tuning based on IntelliJ IDEA 2018.3 inspection

Issue: SPR-15540
This commit is contained in:
Juergen Hoeller
2018-11-22 16:12:38 +01:00
parent b1b28d4641
commit bf272b0b21
14 changed files with 66 additions and 66 deletions

View File

@@ -314,6 +314,7 @@ class ExtendedBeanInfo implements BeanInfo {
}
@Override
@Nullable
public Class<?> getPropertyType() {
if (this.propertyType == null) {
try {
@@ -425,6 +426,7 @@ class ExtendedBeanInfo implements BeanInfo {
}
@Override
@Nullable
public Class<?> getPropertyType() {
if (this.propertyType == null) {
try {
@@ -460,6 +462,7 @@ class ExtendedBeanInfo implements BeanInfo {
}
@Override
@Nullable
public Class<?> getIndexedPropertyType() {
if (this.indexedPropertyType == null) {
try {

View File

@@ -196,7 +196,7 @@ class ConstructorResolver {
for (Constructor<?> candidate : candidates) {
Class<?>[] paramTypes = candidate.getParameterTypes();
if (constructorToUse != null && argsToUse.length > paramTypes.length) {
if (constructorToUse != null && argsToUse != null && argsToUse.length > paramTypes.length) {
// Already found greedy constructor that can be satisfied ->
// do not look any further, there are only less greedy constructors left.
break;
@@ -276,11 +276,12 @@ class ConstructorResolver {
ambiguousConstructors);
}
if (explicitArgs == null) {
if (explicitArgs == null && argsHolderToUse != null) {
argsHolderToUse.storeCache(mbd, constructorToUse);
}
}
Assert.state(argsToUse != null, "Unresolved constructor arguments");
bw.setBeanInstance(instantiate(beanName, mbd, constructorToUse, argsToUse));
return bw;
}
@@ -602,12 +603,13 @@ class ConstructorResolver {
}
}
Assert.state(argsToUse != null, "Unresolved factory method arguments");
bw.setBeanInstance(instantiate(beanName, mbd, factoryBean, factoryMethodToUse, argsToUse));
return bw;
}
private Object instantiate(
String beanName, RootBeanDefinition mbd, Object factoryBean, Method factoryMethod, Object[] args) {
private Object instantiate(String beanName, RootBeanDefinition mbd,
@Nullable Object factoryBean, Method factoryMethod, Object[] args) {
try {
if (System.getSecurityManager() != null) {