diff --git a/build.gradle b/build.gradle index 17b60a13f..13bf948aa 100644 --- a/build.gradle +++ b/build.gradle @@ -26,6 +26,7 @@ apply plugin: 'bundlor' apply plugin: 'javadocHotfix' [compileJava, compileTestJava]*.options*.compilerArgs = ["-Xlint:-serial"] +[compileJava, compileTestJava]*.options*.compilerArgs = ["-Xlint:-serial", "-Xlint:deprecation"] // Common dependencies dependencies { diff --git a/src/main/java/org/springframework/data/redis/connection/srp/SrpUtils.java b/src/main/java/org/springframework/data/redis/connection/srp/SrpUtils.java index 450eaa9ea..1693ab692 100644 --- a/src/main/java/org/springframework/data/redis/connection/srp/SrpUtils.java +++ b/src/main/java/org/springframework/data/redis/connection/srp/SrpUtils.java @@ -16,6 +16,23 @@ package org.springframework.data.redis.connection.srp; +import com.google.common.base.Charsets; +import org.springframework.dao.DataAccessException; +import org.springframework.data.redis.RedisSystemException; +import org.springframework.data.redis.connection.DefaultTuple; +import org.springframework.data.redis.connection.RedisListCommands.Position; +import org.springframework.data.redis.connection.RedisStringCommands.BitOperation; +import org.springframework.data.redis.connection.RedisZSetCommands.Tuple; +import org.springframework.data.redis.connection.ReturnType; +import org.springframework.data.redis.connection.SortParameters; +import org.springframework.util.Assert; +import redis.client.RedisException; +import redis.reply.BulkReply; +import redis.reply.IntegerReply; +import redis.reply.MultiBulkReply; +import redis.reply.Reply; +import redis.reply.StatusReply; + import java.io.StringReader; import java.util.ArrayList; import java.util.Arrays; @@ -26,26 +43,6 @@ import java.util.Map; import java.util.Properties; import java.util.Set; -import org.springframework.dao.DataAccessException; -import org.springframework.data.redis.RedisSystemException; -import org.springframework.data.redis.connection.DefaultTuple; -import org.springframework.data.redis.connection.ReturnType; -import org.springframework.data.redis.connection.RedisListCommands.Position; -import org.springframework.data.redis.connection.RedisStringCommands.BitOperation; -import org.springframework.data.redis.connection.RedisZSetCommands.Tuple; -import org.springframework.data.redis.connection.jedis.JedisUtils; -import org.springframework.data.redis.connection.SortParameters; -import org.springframework.util.Assert; - -import redis.client.RedisException; -import redis.reply.BulkReply; -import redis.reply.IntegerReply; -import redis.reply.MultiBulkReply; -import redis.reply.Reply; -import redis.reply.StatusReply; - -import com.google.common.base.Charsets; - /** * Helper class featuring methods for SRedis connection handling, providing support for exception translation. * diff --git a/src/main/java/org/springframework/data/redis/hash/JacksonHashMapper.java b/src/main/java/org/springframework/data/redis/hash/JacksonHashMapper.java index 8e0281652..cf98e0a01 100644 --- a/src/main/java/org/springframework/data/redis/hash/JacksonHashMapper.java +++ b/src/main/java/org/springframework/data/redis/hash/JacksonHashMapper.java @@ -1,5 +1,5 @@ /* - * Copyright 2011-2013 the original author or authors. + * Copyright 2011-2014 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. @@ -15,22 +15,23 @@ */ package org.springframework.data.redis.hash; -import java.util.Map; - import org.codehaus.jackson.map.ObjectMapper; import org.codehaus.jackson.map.type.TypeFactory; import org.codehaus.jackson.type.JavaType; +import java.util.Map; + /** * Mapper based on Jackson library. Supports nested properties (rich objects). * * @author Costin Leau + * @author Thomas Darimont */ public class JacksonHashMapper implements HashMapper { private final ObjectMapper mapper; private final JavaType userType; - private final JavaType mapType = TypeFactory.mapType(Map.class, String.class, Object.class); + private final JavaType mapType = TypeFactory.defaultInstance().constructMapType(Map.class, String.class, Object.class); public JacksonHashMapper(Class type) { this(type, new ObjectMapper()); @@ -38,7 +39,7 @@ public class JacksonHashMapper implements HashMapper { public JacksonHashMapper(Class type, ObjectMapper mapper) { this.mapper = mapper; - this.userType = TypeFactory.type(type); + this.userType = TypeFactory.defaultInstance().constructType(type); } @SuppressWarnings("unchecked") diff --git a/src/main/java/org/springframework/data/redis/serializer/JacksonJsonRedisSerializer.java b/src/main/java/org/springframework/data/redis/serializer/JacksonJsonRedisSerializer.java index 88dc5e4b2..cb59e1c5a 100644 --- a/src/main/java/org/springframework/data/redis/serializer/JacksonJsonRedisSerializer.java +++ b/src/main/java/org/springframework/data/redis/serializer/JacksonJsonRedisSerializer.java @@ -1,5 +1,5 @@ /* - * Copyright 2011-2013 the original author or authors. + * Copyright 2011-2014 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. @@ -15,13 +15,13 @@ */ package org.springframework.data.redis.serializer; -import java.nio.charset.Charset; - import org.codehaus.jackson.map.ObjectMapper; import org.codehaus.jackson.map.type.TypeFactory; import org.codehaus.jackson.type.JavaType; import org.springframework.util.Assert; +import java.nio.charset.Charset; + /** * {@link RedisSerializer} that can read and write JSON using Jackson's {@link ObjectMapper}. * @@ -30,6 +30,7 @@ import org.springframework.util.Assert; * Note:Null objects are serialized as empty arrays and vice versa. * * @author Costin Leau + * @author Thomas Darimont */ public class JacksonJsonRedisSerializer implements RedisSerializer { @@ -40,7 +41,7 @@ public class JacksonJsonRedisSerializer implements RedisSerializer { private ObjectMapper objectMapper = new ObjectMapper(); public JacksonJsonRedisSerializer(Class type) { - this.javaType = TypeFactory.type(type); + this.javaType = TypeFactory.defaultInstance().constructType(type); } @SuppressWarnings("unchecked") @@ -100,6 +101,6 @@ public class JacksonJsonRedisSerializer implements RedisSerializer { * @return the java type */ protected JavaType getJavaType(Class clazz) { - return TypeFactory.type(clazz); + return TypeFactory.defaultInstance().constructType(clazz); } } \ No newline at end of file diff --git a/src/test/java/org/springframework/data/redis/connection/srp/SrpUtilsTests.java b/src/test/java/org/springframework/data/redis/connection/srp/SrpUtilsTests.java index 29a335795..501adf19e 100644 --- a/src/test/java/org/springframework/data/redis/connection/srp/SrpUtilsTests.java +++ b/src/test/java/org/springframework/data/redis/connection/srp/SrpUtilsTests.java @@ -1,5 +1,5 @@ /* - * Copyright 2011-2013 the original author or authors. + * Copyright 2011-2014 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. @@ -15,21 +15,25 @@ */ package org.springframework.data.redis.connection.srp; -import java.util.ArrayList; -import java.util.List; -import static org.junit.Assert.assertArrayEquals; -import static org.junit.Assert.assertEquals; - import org.junit.Test; import org.springframework.data.redis.connection.DefaultSortParameters; import org.springframework.data.redis.connection.SortParameters; +import java.util.ArrayList; +import java.util.List; + +import static org.junit.Assert.assertArrayEquals; +import static org.junit.Assert.assertEquals; + /** * Unit test of {@link SrpUtils} * * @author Jennifer Hickey + * @author Thomas Darimont * + * Suppressed deprecation warnings since SrpUtils is deprecated. */ +@SuppressWarnings("deprecation") public class SrpUtilsTests { @Test