code warnings removed

pull/831/head
Nikita 8 years ago
parent 933bf1525a
commit 5edf70a450

@ -118,11 +118,11 @@ public class AccessorInterceptor {
RObject rObject = objectBuilder.createObject(((RLiveObject) me).getLiveObjectId(), me.getClass().getSuperclass(), arg.getClass(), fieldName); RObject rObject = objectBuilder.createObject(((RLiveObject) me).getLiveObjectId(), me.getClass().getSuperclass(), arg.getClass(), fieldName);
if (arg != null) { if (arg != null) {
if (rObject instanceof Collection) { if (rObject instanceof Collection) {
Collection c = (Collection) rObject; Collection<?> c = (Collection<?>) rObject;
c.clear(); c.clear();
c.addAll((Collection) arg); c.addAll((Collection) arg);
} else { } else {
Map m = (Map) rObject; Map<?, ?> m = (Map<?, ?>) rObject;
m.clear(); m.clear();
m.putAll((Map) arg); m.putAll((Map) arg);
} }

@ -15,15 +15,16 @@
*/ */
package org.redisson.liveobject.core; package org.redisson.liveobject.core;
import java.lang.reflect.InvocationTargetException;
import java.lang.reflect.Method; import java.lang.reflect.Method;
import org.redisson.api.RMap;
import org.redisson.liveobject.misc.ClassUtils;
import net.bytebuddy.implementation.bind.annotation.AllArguments; import net.bytebuddy.implementation.bind.annotation.AllArguments;
import net.bytebuddy.implementation.bind.annotation.FieldValue; import net.bytebuddy.implementation.bind.annotation.FieldValue;
import net.bytebuddy.implementation.bind.annotation.Origin; import net.bytebuddy.implementation.bind.annotation.Origin;
import net.bytebuddy.implementation.bind.annotation.RuntimeType; import net.bytebuddy.implementation.bind.annotation.RuntimeType;
import net.bytebuddy.implementation.bind.annotation.This; import net.bytebuddy.implementation.bind.annotation.This;
import org.redisson.api.RMap;
import org.redisson.liveobject.misc.ClassUtils;
/** /**
* *
@ -36,7 +37,7 @@ public class FieldAccessorInterceptor {
@Origin Method method, @Origin Method method,
@AllArguments Object[] args, @AllArguments Object[] args,
@This Object me, @This Object me,
@FieldValue("liveObjectLiveMap") RMap map @FieldValue("liveObjectLiveMap") RMap<?, ?> map
) throws Exception { ) throws Exception {
if (args.length >= 1 && String.class.isAssignableFrom(args[0].getClass())) { if (args.length >= 1 && String.class.isAssignableFrom(args[0].getClass())) {
String name = ((String) args[0]).substring(0, 1).toUpperCase() + ((String) args[0]).substring(1); String name = ((String) args[0]).substring(0, 1).toUpperCase() + ((String) args[0]).substring(1);

@ -50,13 +50,13 @@ public class LiveObjectInterceptor {
private final RedissonClient redisson; private final RedissonClient redisson;
private final CodecProvider codecProvider; private final CodecProvider codecProvider;
private final Class originalClass; private final Class<?> originalClass;
private final String idFieldName; private final String idFieldName;
private final Class idFieldType; private final Class<?> idFieldType;
private final NamingScheme namingScheme; private final NamingScheme namingScheme;
private final Class<? extends Codec> codecClass; private final Class<? extends Codec> codecClass;
public LiveObjectInterceptor(RedissonClient redisson, CodecProvider codecProvider, Class entityClass, String idFieldName) { public LiveObjectInterceptor(RedissonClient redisson, CodecProvider codecProvider, Class<?> entityClass, String idFieldName) {
this.redisson = redisson; this.redisson = redisson;
this.codecProvider = codecProvider; this.codecProvider = codecProvider;
this.originalClass = entityClass; this.originalClass = entityClass;
@ -79,7 +79,7 @@ public class LiveObjectInterceptor {
@FieldValue("liveObjectId") Object id, @FieldValue("liveObjectId") Object id,
@FieldProxy("liveObjectId") Setter idSetter, @FieldProxy("liveObjectId") Setter idSetter,
@FieldProxy("liveObjectId") Getter idGetter, @FieldProxy("liveObjectId") Getter idGetter,
@FieldValue("liveObjectLiveMap") RMap map, @FieldValue("liveObjectLiveMap") RMap<?, ?> map,
@FieldProxy("liveObjectLiveMap") Setter mapSetter, @FieldProxy("liveObjectLiveMap") Setter mapSetter,
@FieldProxy("liveObjectLiveMap") Getter mapGetter @FieldProxy("liveObjectLiveMap") Getter mapGetter
) throws Exception { ) throws Exception {

@ -34,9 +34,9 @@ public class RExpirableInterceptor {
public static Object intercept( public static Object intercept(
@Origin Method method, @Origin Method method,
@AllArguments Object[] args, @AllArguments Object[] args,
@FieldValue("liveObjectLiveMap") RMap map @FieldValue("liveObjectLiveMap") RMap<?, ?> map
) throws Exception { ) throws Exception {
Class[] cls = new Class[args.length]; Class<?>[] cls = new Class[args.length];
for (int i = 0; i < args.length; i++) { for (int i = 0; i < args.length; i++) {
cls[i] = args[i].getClass(); cls[i] = args[i].getClass();
} }

@ -33,9 +33,9 @@ public class RMapInterceptor {
public static Object intercept( public static Object intercept(
@Origin Method method, @Origin Method method,
@AllArguments Object[] args, @AllArguments Object[] args,
@FieldValue("liveObjectLiveMap") RMap map @FieldValue("liveObjectLiveMap") RMap<?, ?> map
) throws Exception { ) throws Exception {
Class[] cls = new Class[args.length]; Class<?>[] cls = new Class[args.length];
for (int i = 0; i < args.length; i++) { for (int i = 0; i < args.length; i++) {
cls[i] = args[i].getClass(); cls[i] = args[i].getClass();
} }

@ -32,7 +32,7 @@ public class RObjectInterceptor {
public static Object intercept( public static Object intercept(
@Origin Method method, @Origin Method method,
@AllArguments Object[] args, @AllArguments Object[] args,
@FieldValue("liveObjectLiveMap") RMap map @FieldValue("liveObjectLiveMap") RMap<?, ?> map
) throws Exception { ) throws Exception {
throw new UnsupportedOperationException("Please use RLiveObjectService instance for this type of functions"); throw new UnsupportedOperationException("Please use RLiveObjectService instance for this type of functions");
} }

@ -16,7 +16,6 @@
package org.redisson.liveobject.core; package org.redisson.liveobject.core;
import java.lang.reflect.Field; import java.lang.reflect.Field;
import java.util.Collection;
import java.util.Deque; import java.util.Deque;
import java.util.LinkedHashMap; import java.util.LinkedHashMap;
import java.util.List; import java.util.List;
@ -123,7 +122,7 @@ public class RedissonObjectBuilder {
return codecProvider.getCodec(anno, rEntity, rObjectClass, fieldName); return codecProvider.getCodec(anno, rEntity, rObjectClass, fieldName);
} else { } else {
REntity anno = rEntity.getAnnotation(REntity.class); REntity anno = rEntity.getAnnotation(REntity.class);
return codecProvider.getCodec(anno, (Class) rEntity); return codecProvider.getCodec(anno, (Class<?>) rEntity);
} }
} }

@ -105,7 +105,7 @@ public class ClassUtils {
* *
* @return Method object * @return Method object
*/ */
public static Method searchForMethod(Class type, String name, Class[] parms) { public static Method searchForMethod(Class<?> type, String name, Class<?>[] parms) {
try { try {
return type.getMethod(name, parms); return type.getMethod(name, parms);
} catch (NoSuchMethodException e) {} } catch (NoSuchMethodException e) {}
@ -116,7 +116,7 @@ public class ClassUtils {
continue; continue;
} }
Class[] types = methods[i].getParameterTypes(); Class<?>[] types = methods[i].getParameterTypes();
// Does it have the same number of arguments that we're looking for. // Does it have the same number of arguments that we're looking for.
if (types.length != parms.length) { if (types.length != parms.length) {
continue; continue;
@ -130,7 +130,7 @@ public class ClassUtils {
return null; return null;
} }
private static boolean areTypesCompatible(Class[] targets, Class[] sources) { private static boolean areTypesCompatible(Class<?>[] targets, Class<?>[] sources) {
if (targets.length != sources.length) { if (targets.length != sources.length) {
return false; return false;
} }

@ -24,7 +24,7 @@ import org.redisson.api.annotation.RId;
* @param <A> RId annotation to resolve * @param <A> RId annotation to resolve
* @param <V> Value type * @param <V> Value type
*/ */
public interface RIdResolver<A extends RId, V> extends Resolver<Class, A, V>{ public interface RIdResolver<A extends RId, V> extends Resolver<Class<?>, A, V>{
/** /**
* RLiveObjectService instantiate the class and invokes this method to get * RLiveObjectService instantiate the class and invokes this method to get
@ -35,6 +35,6 @@ public interface RIdResolver<A extends RId, V> extends Resolver<Class, A, V>{
* @param redisson instance * @param redisson instance
* @return resolved RId field value. * @return resolved RId field value.
*/ */
public V resolve(Class cls, A annotation, String idFieldName, RedissonClient redisson); public V resolve(Class<?> cls, A annotation, String idFieldName, RedissonClient redisson);
} }

@ -29,7 +29,7 @@ public class UUIDGenerator implements RIdResolver<RId, String>{
public static final UUIDGenerator INSTANCE = new UUIDGenerator(); public static final UUIDGenerator INSTANCE = new UUIDGenerator();
@Override @Override
public String resolve(Class value, RId id, String idFieldName, RedissonClient redisson) { public String resolve(Class<?> value, RId id, String idFieldName, RedissonClient redisson) {
return UUID.randomUUID().toString(); return UUID.randomUUID().toString();
} }

Loading…
Cancel
Save