Backport selected refinements from the nullability efforts

Issue: SPR-15656
This commit is contained in:
Juergen Hoeller
2017-09-27 00:09:58 +02:00
parent 18a3322d2f
commit 9fdc4404a5
194 changed files with 1236 additions and 1218 deletions

View File

@@ -1,5 +1,5 @@
/*
* Copyright 2002-2015 the original author or authors.
* Copyright 2002-2017 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.
@@ -110,8 +110,7 @@ public class JCacheCache extends AbstractValueAdaptingCache {
@SuppressWarnings("unchecked")
@Override
public T process(MutableEntry<Object, Object> entry, Object... arguments)
throws EntryProcessorException {
public T process(MutableEntry<Object, Object> entry, Object... arguments) throws EntryProcessorException {
Callable<T> valueLoader = (Callable<T>) arguments[0];
if (entry.exists()) {
return (T) fromStoreValue(entry.getValue());

View File

@@ -94,7 +94,7 @@ public class JCacheAspectSupport extends AbstractCacheInvoker implements Initial
protected Object execute(CacheOperationInvoker invoker, Object target, Method method, Object[] args) {
// Check whether aspect is enabled to cope with cases where the AJ is pulled in automatically
if (this.initialized) {
Class<?> targetClass = getTargetClass(target);
Class<?> targetClass = AopProxyUtils.ultimateTargetClass(target);
JCacheOperation<?> operation = getCacheOperationSource().getCacheOperation(method, targetClass);
if (operation != null) {
CacheOperationInvocationContext<?> context =
@@ -114,14 +114,6 @@ public class JCacheAspectSupport extends AbstractCacheInvoker implements Initial
(JCacheOperation<Annotation>) operation, target, args);
}
private Class<?> getTargetClass(Object target) {
Class<?> targetClass = AopProxyUtils.ultimateTargetClass(target);
if (targetClass == null && target != null) {
targetClass = target.getClass();
}
return targetClass;
}
@SuppressWarnings("unchecked")
private Object execute(CacheOperationInvocationContext<?> context, CacheOperationInvoker invoker) {
CacheOperationInvoker adapter = new CacheOperationInvokerAdapter(invoker);

View File

@@ -1,5 +1,5 @@
/*
* Copyright 2002-2005 the original author or authors.
* Copyright 2002-2017 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.
@@ -35,26 +35,26 @@ import java.util.Date;
*/
public interface MailMessage {
public void setFrom(String from) throws MailParseException;
void setFrom(String from) throws MailParseException;
public void setReplyTo(String replyTo) throws MailParseException;
void setReplyTo(String replyTo) throws MailParseException;
public void setTo(String to) throws MailParseException;
void setTo(String to) throws MailParseException;
public void setTo(String[] to) throws MailParseException;
void setTo(String[] to) throws MailParseException;
public void setCc(String cc) throws MailParseException;
void setCc(String cc) throws MailParseException;
public void setCc(String[] cc) throws MailParseException;
void setCc(String[] cc) throws MailParseException;
public void setBcc(String bcc) throws MailParseException;
void setBcc(String bcc) throws MailParseException;
public void setBcc(String[] bcc) throws MailParseException;
void setBcc(String[] bcc) throws MailParseException;
public void setSentDate(Date sentDate) throws MailParseException;
void setSentDate(Date sentDate) throws MailParseException;
public void setSubject(String subject) throws MailParseException;
void setSubject(String subject) throws MailParseException;
public void setText(String text) throws MailParseException;
void setText(String text) throws MailParseException;
}

View File

@@ -1,5 +1,5 @@
/*
* Copyright 2002-2012 the original author or authors.
* Copyright 2002-2017 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.
@@ -68,10 +68,9 @@ public class SimpleMailMessage implements MailMessage, Serializable {
/**
* Copy constructor for creating a new {@code SimpleMailMessage} from the state
* of an existing {@code SimpleMailMessage} instance.
* @throws IllegalArgumentException if the supplied message is {@code null}
*/
public SimpleMailMessage(SimpleMailMessage original) {
Assert.notNull(original, "The 'original' message argument cannot be null");
Assert.notNull(original, "'original' message argument must not be null");
this.from = original.getFrom();
this.replyTo = original.getReplyTo();
if (original.getTo() != null) {
@@ -104,7 +103,7 @@ public class SimpleMailMessage implements MailMessage, Serializable {
}
public String getReplyTo() {
return replyTo;
return this.replyTo;
}
@Override
@@ -132,7 +131,7 @@ public class SimpleMailMessage implements MailMessage, Serializable {
}
public String[] getCc() {
return cc;
return this.cc;
}
@Override
@@ -146,7 +145,7 @@ public class SimpleMailMessage implements MailMessage, Serializable {
}
public String[] getBcc() {
return bcc;
return this.bcc;
}
@Override
@@ -155,7 +154,7 @@ public class SimpleMailMessage implements MailMessage, Serializable {
}
public Date getSentDate() {
return sentDate;
return this.sentDate;
}
@Override