Add missing @Nullable annotations on parameters

Issue: SPR-15540
This commit is contained in:
Sebastien Deleuze
2017-05-31 12:37:54 +02:00
parent ad2c0f8410
commit b47d713e14
380 changed files with 1085 additions and 732 deletions

View File

@@ -19,6 +19,7 @@ package org.springframework.transaction.interceptor;
import java.io.Serializable;
import java.lang.reflect.Method;
import org.springframework.lang.Nullable;
import org.springframework.util.Assert;
/**
@@ -53,7 +54,8 @@ public class CompositeTransactionAttributeSource implements TransactionAttribute
@Override
public TransactionAttribute getTransactionAttribute(Method method, Class<?> targetClass) {
@Nullable
public TransactionAttribute getTransactionAttribute(Method method, @Nullable Class<?> targetClass) {
for (TransactionAttributeSource tas : this.transactionAttributeSources) {
TransactionAttribute ta = tas.getTransactionAttribute(method, targetClass);
if (ta != null) {

View File

@@ -19,6 +19,7 @@ package org.springframework.transaction.interceptor;
import java.io.Serializable;
import java.lang.reflect.Method;
import org.springframework.lang.Nullable;
import org.springframework.util.ClassUtils;
import org.springframework.util.ObjectUtils;
@@ -52,7 +53,7 @@ public class MatchAlwaysTransactionAttributeSource implements TransactionAttribu
@Override
public TransactionAttribute getTransactionAttribute(Method method, Class<?> targetClass) {
public TransactionAttribute getTransactionAttribute(Method method, @Nullable Class<?> targetClass) {
return (method == null || ClassUtils.isUserLevelMethod(method) ? this.transactionAttribute : null);
}

View File

@@ -27,6 +27,7 @@ import org.apache.commons.logging.LogFactory;
import org.springframework.beans.factory.BeanClassLoaderAware;
import org.springframework.beans.factory.InitializingBean;
import org.springframework.lang.Nullable;
import org.springframework.util.Assert;
import org.springframework.util.ClassUtils;
import org.springframework.util.ObjectUtils;
@@ -82,7 +83,7 @@ public class MethodMapTransactionAttributeSource
}
@Override
public void setBeanClassLoader(ClassLoader beanClassLoader) {
public void setBeanClassLoader(@Nullable ClassLoader beanClassLoader) {
this.beanClassLoader = beanClassLoader;
}
@@ -207,7 +208,7 @@ public class MethodMapTransactionAttributeSource
@Override
public TransactionAttribute getTransactionAttribute(Method method, Class<?> targetClass) {
public TransactionAttribute getTransactionAttribute(Method method, @Nullable Class<?> targetClass) {
if (this.eagerlyInitialized) {
return this.transactionAttributeMap.get(method);
}

View File

@@ -26,6 +26,7 @@ import java.util.Properties;
import org.apache.commons.logging.Log;
import org.apache.commons.logging.LogFactory;
import org.springframework.lang.Nullable;
import org.springframework.util.ClassUtils;
import org.springframework.util.ObjectUtils;
import org.springframework.util.PatternMatchUtils;
@@ -100,7 +101,7 @@ public class NameMatchTransactionAttributeSource implements TransactionAttribute
@Override
public TransactionAttribute getTransactionAttribute(Method method, Class<?> targetClass) {
public TransactionAttribute getTransactionAttribute(Method method, @Nullable Class<?> targetClass) {
if (!ClassUtils.isUserLevelMethod(method)) {
return null;
}

View File

@@ -34,7 +34,7 @@ import org.springframework.util.ObjectUtils;
abstract class TransactionAttributeSourcePointcut extends StaticMethodMatcherPointcut implements Serializable {
@Override
public boolean matches(Method method, Class<?> targetClass) {
public boolean matches(Method method, @Nullable Class<?> targetClass) {
if (TransactionalProxy.class.isAssignableFrom(targetClass)) {
return false;
}

View File

@@ -1200,7 +1200,7 @@ public class JtaTransactionManager extends AbstractPlatformTransactionManager
//---------------------------------------------------------------------
@Override
public Transaction createTransaction(String name, int timeout) throws NotSupportedException, SystemException {
public Transaction createTransaction(@Nullable String name, int timeout) throws NotSupportedException, SystemException {
TransactionManager tm = getTransactionManager();
Assert.state(tm != null, "No JTA TransactionManager available");
if (timeout >= 0) {

View File

@@ -21,6 +21,7 @@ import javax.transaction.SystemException;
import javax.transaction.Transaction;
import javax.transaction.TransactionManager;
import org.springframework.lang.Nullable;
import org.springframework.util.Assert;
/**
@@ -51,7 +52,7 @@ public class SimpleTransactionFactory implements TransactionFactory {
@Override
public Transaction createTransaction(String name, int timeout) throws NotSupportedException, SystemException {
public Transaction createTransaction(@Nullable String name, int timeout) throws NotSupportedException, SystemException {
if (timeout >= 0) {
this.transactionManager.setTransactionTimeout(timeout);
}

View File

@@ -26,6 +26,7 @@ import javax.transaction.Transaction;
import javax.transaction.TransactionManager;
import javax.transaction.UserTransaction;
import org.springframework.lang.Nullable;
import org.springframework.transaction.TransactionDefinition;
import org.springframework.transaction.TransactionSystemException;
@@ -301,7 +302,7 @@ public class WebLogicJtaTransactionManager extends JtaTransactionManager {
}
@Override
public Transaction createTransaction(String name, int timeout) throws NotSupportedException, SystemException {
public Transaction createTransaction(@Nullable String name, int timeout) throws NotSupportedException, SystemException {
if (this.weblogicUserTransactionAvailable && name != null) {
try {
if (timeout >= 0) {

View File

@@ -334,7 +334,7 @@ public abstract class AbstractPlatformTransactionManager implements PlatformTran
* @see #doBegin
*/
@Override
public final TransactionStatus getTransaction(TransactionDefinition definition) throws TransactionException {
public final TransactionStatus getTransaction(@Nullable TransactionDefinition definition) throws TransactionException {
Object transaction = doGetTransaction();
// Cache debug flag to avoid repeated checks.