diff --git a/redisson/src/main/java/org/redisson/jcache/JCacheManager.java b/redisson/src/main/java/org/redisson/jcache/JCacheManager.java index 68234b7ab..943ba65c9 100644 --- a/redisson/src/main/java/org/redisson/jcache/JCacheManager.java +++ b/redisson/src/main/java/org/redisson/jcache/JCacheManager.java @@ -177,10 +177,10 @@ public class JCacheManager implements CacheManager { checkNotClosed(); Cache cache = (Cache) getCache(cacheName, Object.class, Object.class); if (cache != null) { - if (cache.getConfiguration(CompleteConfiguration.class).getKeyType() != Object.class) { + if (!cache.getConfiguration(CompleteConfiguration.class).getKeyType().isAssignableFrom(Object.class)) { throw new IllegalArgumentException("Wrong type of key for " + cacheName); } - if (cache.getConfiguration(CompleteConfiguration.class).getValueType() != Object.class) { + if (!cache.getConfiguration(CompleteConfiguration.class).getValueType().isAssignableFrom(Object.class)) { throw new IllegalArgumentException("Wrong type of value for " + cacheName); } }