Fix remaining compiler warnings
Fix remaining Java compiler warnings, mainly around missing generics or deprecated code. Also add the `-Werror` compiler option to ensure that any future warnings will fail the build. Issue: SPR-11064
This commit is contained in:
@@ -47,7 +47,7 @@ class CachedMessageProducer implements MessageProducer, QueueSender, TopicPublis
|
||||
private static final Method getDeliveryDelayMethod =
|
||||
ClassUtils.getMethodIfAvailable(MessageProducer.class, "getDeliveryDelay");
|
||||
|
||||
private static Class completionListenerClass;
|
||||
private static Class<?> completionListenerClass;
|
||||
|
||||
private static Method sendWithCompletionListenerMethod;
|
||||
|
||||
@@ -254,7 +254,7 @@ class CachedMessageProducer implements MessageProducer, QueueSender, TopicPublis
|
||||
public MessageProducer getProxyIfNecessary() {
|
||||
if (completionListenerClass != null) {
|
||||
return (MessageProducer) Proxy.newProxyInstance(CachedMessageProducer.class.getClassLoader(),
|
||||
new Class[] {MessageProducer.class, QueueSender.class, TopicPublisher.class},
|
||||
new Class<?>[] {MessageProducer.class, QueueSender.class, TopicPublisher.class},
|
||||
new Jms2MessageProducerInvocationHandler());
|
||||
}
|
||||
else {
|
||||
|
||||
@@ -250,7 +250,7 @@ public class CachingConnectionFactory extends SingleConnectionFactory {
|
||||
* @return the wrapped Session
|
||||
*/
|
||||
protected Session getCachedSessionProxy(Session target, LinkedList<Session> sessionList) {
|
||||
List<Class> classes = new ArrayList<Class>(3);
|
||||
List<Class<?>> classes = new ArrayList<Class<?>>(3);
|
||||
classes.add(SessionProxy.class);
|
||||
if (target instanceof QueueSession) {
|
||||
classes.add(QueueSession.class);
|
||||
@@ -260,7 +260,7 @@ public class CachingConnectionFactory extends SingleConnectionFactory {
|
||||
}
|
||||
return (Session) Proxy.newProxyInstance(
|
||||
SessionProxy.class.getClassLoader(),
|
||||
classes.toArray(new Class[classes.size()]),
|
||||
classes.toArray(new Class<?>[classes.size()]),
|
||||
new CachedSessionInvocationHandler(target, sessionList));
|
||||
}
|
||||
|
||||
|
||||
@@ -452,7 +452,7 @@ public class SingleConnectionFactory
|
||||
* @return the wrapped Connection
|
||||
*/
|
||||
protected Connection getSharedConnectionProxy(Connection target) {
|
||||
List<Class> classes = new ArrayList<Class>(3);
|
||||
List<Class<?>> classes = new ArrayList<Class<?>>(3);
|
||||
classes.add(Connection.class);
|
||||
if (target instanceof QueueConnection) {
|
||||
classes.add(QueueConnection.class);
|
||||
@@ -462,7 +462,7 @@ public class SingleConnectionFactory
|
||||
}
|
||||
return (Connection) Proxy.newProxyInstance(
|
||||
Connection.class.getClassLoader(),
|
||||
classes.toArray(new Class[classes.size()]),
|
||||
classes.toArray(new Class<?>[classes.size()]),
|
||||
new SharedConnectionInvocationHandler(target));
|
||||
}
|
||||
|
||||
|
||||
@@ -196,7 +196,7 @@ public class TransactionAwareConnectionFactoryProxy
|
||||
* @return the wrapped Connection
|
||||
*/
|
||||
protected Connection getTransactionAwareConnectionProxy(Connection target) {
|
||||
List<Class> classes = new ArrayList<Class>(3);
|
||||
List<Class<?>> classes = new ArrayList<Class<?>>(3);
|
||||
classes.add(Connection.class);
|
||||
if (target instanceof QueueConnection) {
|
||||
classes.add(QueueConnection.class);
|
||||
@@ -206,7 +206,7 @@ public class TransactionAwareConnectionFactoryProxy
|
||||
}
|
||||
return (Connection) Proxy.newProxyInstance(
|
||||
Connection.class.getClassLoader(),
|
||||
classes.toArray(new Class[classes.size()]),
|
||||
classes.toArray(new Class<?>[classes.size()]),
|
||||
new TransactionAwareConnectionInvocationHandler(target));
|
||||
}
|
||||
|
||||
@@ -268,7 +268,7 @@ public class TransactionAwareConnectionFactoryProxy
|
||||
}
|
||||
|
||||
private Session getCloseSuppressingSessionProxy(Session target) {
|
||||
List<Class> classes = new ArrayList<Class>(3);
|
||||
List<Class<?>> classes = new ArrayList<Class<?>>(3);
|
||||
classes.add(SessionProxy.class);
|
||||
if (target instanceof QueueSession) {
|
||||
classes.add(QueueSession.class);
|
||||
@@ -278,7 +278,7 @@ public class TransactionAwareConnectionFactoryProxy
|
||||
}
|
||||
return (Session) Proxy.newProxyInstance(
|
||||
SessionProxy.class.getClassLoader(),
|
||||
classes.toArray(new Class[classes.size()]),
|
||||
classes.toArray(new Class<?>[classes.size()]),
|
||||
new CloseSuppressingSessionInvocationHandler(target));
|
||||
}
|
||||
}
|
||||
|
||||
@@ -329,7 +329,7 @@ public class MessageListenerAdapter
|
||||
if (delegate != this) {
|
||||
if (delegate instanceof SessionAwareMessageListener) {
|
||||
if (session != null) {
|
||||
((SessionAwareMessageListener) delegate).onMessage(message, session);
|
||||
((SessionAwareMessageListener<Message>) delegate).onMessage(message, session);
|
||||
return;
|
||||
}
|
||||
else if (!(delegate instanceof MessageListener)) {
|
||||
|
||||
@@ -73,7 +73,7 @@ public class DefaultJmsActivationSpecFactory extends StandardJmsActivationSpecFa
|
||||
* "ActivationSpecImpl" in the same package as the ResourceAdapter class.
|
||||
*/
|
||||
@Override
|
||||
protected Class determineActivationSpecClass(ResourceAdapter adapter) {
|
||||
protected Class<?> determineActivationSpecClass(ResourceAdapter adapter) {
|
||||
String adapterClassName = adapter.getClass().getName();
|
||||
|
||||
if (adapterClassName.endsWith(RESOURCE_ADAPTER_SUFFIX)) {
|
||||
|
||||
@@ -50,7 +50,7 @@ import org.springframework.jms.support.destination.DestinationResolver;
|
||||
*/
|
||||
public class StandardJmsActivationSpecFactory implements JmsActivationSpecFactory {
|
||||
|
||||
private Class activationSpecClass;
|
||||
private Class<?> activationSpecClass;
|
||||
|
||||
private Map<String, String> defaultProperties;
|
||||
|
||||
@@ -61,7 +61,7 @@ public class StandardJmsActivationSpecFactory implements JmsActivationSpecFactor
|
||||
* Specify the fully-qualified ActivationSpec class name for the target
|
||||
* provider (e.g. "org.apache.activemq.ra.ActiveMQActivationSpec").
|
||||
*/
|
||||
public void setActivationSpecClass(Class activationSpecClass) {
|
||||
public void setActivationSpecClass(Class<?> activationSpecClass) {
|
||||
this.activationSpecClass = activationSpecClass;
|
||||
}
|
||||
|
||||
@@ -93,7 +93,7 @@ public class StandardJmsActivationSpecFactory implements JmsActivationSpecFactor
|
||||
|
||||
@Override
|
||||
public ActivationSpec createActivationSpec(ResourceAdapter adapter, JmsActivationSpecConfig config) {
|
||||
Class activationSpecClassToUse = this.activationSpecClass;
|
||||
Class<?> activationSpecClassToUse = this.activationSpecClass;
|
||||
if (activationSpecClassToUse == null) {
|
||||
activationSpecClassToUse = determineActivationSpecClass(adapter);
|
||||
if (activationSpecClassToUse == null) {
|
||||
@@ -118,7 +118,7 @@ public class StandardJmsActivationSpecFactory implements JmsActivationSpecFactor
|
||||
* if not determinable
|
||||
* @see #setActivationSpecClass
|
||||
*/
|
||||
protected Class determineActivationSpecClass(ResourceAdapter adapter) {
|
||||
protected Class<?> determineActivationSpecClass(ResourceAdapter adapter) {
|
||||
return null;
|
||||
}
|
||||
|
||||
|
||||
@@ -43,7 +43,7 @@ import org.springframework.util.ClassUtils;
|
||||
public class JmsInvokerProxyFactoryBean extends JmsInvokerClientInterceptor
|
||||
implements FactoryBean<Object>, BeanClassLoaderAware {
|
||||
|
||||
private Class serviceInterface;
|
||||
private Class<?> serviceInterface;
|
||||
|
||||
private ClassLoader beanClassLoader = ClassUtils.getDefaultClassLoader();
|
||||
|
||||
@@ -57,7 +57,7 @@ public class JmsInvokerProxyFactoryBean extends JmsInvokerClientInterceptor
|
||||
* is {@code null}, or if the supplied {@code serviceInterface}
|
||||
* is not an interface type
|
||||
*/
|
||||
public void setServiceInterface(Class serviceInterface) {
|
||||
public void setServiceInterface(Class<?> serviceInterface) {
|
||||
if (serviceInterface == null || !serviceInterface.isInterface()) {
|
||||
throw new IllegalArgumentException("'serviceInterface' must be an interface");
|
||||
}
|
||||
|
||||
@@ -20,6 +20,7 @@ import java.io.Serializable;
|
||||
import java.util.Enumeration;
|
||||
import java.util.HashMap;
|
||||
import java.util.Map;
|
||||
|
||||
import javax.jms.BytesMessage;
|
||||
import javax.jms.JMSException;
|
||||
import javax.jms.MapMessage;
|
||||
@@ -68,7 +69,7 @@ public class SimpleMessageConverter implements MessageConverter {
|
||||
return createMessageForByteArray((byte[]) object, session);
|
||||
}
|
||||
else if (object instanceof Map) {
|
||||
return createMessageForMap((Map) object, session);
|
||||
return createMessageForMap((Map<? ,?>) object, session);
|
||||
}
|
||||
else if (object instanceof Serializable) {
|
||||
return createMessageForSerializable(((Serializable) object), session);
|
||||
@@ -146,7 +147,7 @@ public class SimpleMessageConverter implements MessageConverter {
|
||||
*/
|
||||
protected MapMessage createMessageForMap(Map<?, ?> map, Session session) throws JMSException {
|
||||
MapMessage message = session.createMapMessage();
|
||||
for (Map.Entry entry : map.entrySet()) {
|
||||
for (Map.Entry<?, ?> entry : map.entrySet()) {
|
||||
if (!(entry.getKey() instanceof String)) {
|
||||
throw new MessageConversionException("Cannot convert non-String key of type [" +
|
||||
ObjectUtils.nullSafeClassName(entry.getKey()) + "] to JMS MapMessage entry");
|
||||
@@ -197,11 +198,12 @@ public class SimpleMessageConverter implements MessageConverter {
|
||||
* @return the resulting Map
|
||||
* @throws JMSException if thrown by JMS methods
|
||||
*/
|
||||
protected Map extractMapFromMessage(MapMessage message) throws JMSException {
|
||||
@SuppressWarnings("unchecked")
|
||||
protected Map<String, Object> extractMapFromMessage(MapMessage message) throws JMSException {
|
||||
Map<String, Object> map = new HashMap<String, Object>();
|
||||
Enumeration en = message.getMapNames();
|
||||
Enumeration<String> en = message.getMapNames();
|
||||
while (en.hasMoreElements()) {
|
||||
String key = (String) en.nextElement();
|
||||
String key = en.nextElement();
|
||||
map.put(key, message.getObject(key));
|
||||
}
|
||||
return map;
|
||||
|
||||
@@ -140,7 +140,7 @@ public class JndiDestinationResolver extends JndiLocatorSupport implements Cachi
|
||||
* {@code false} in case of a Queue
|
||||
*/
|
||||
protected void validateDestination(Destination destination, String destinationName, boolean pubSubDomain) {
|
||||
Class targetClass = Queue.class;
|
||||
Class<?> targetClass = Queue.class;
|
||||
if (pubSubDomain) {
|
||||
targetClass = Topic.class;
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user