Sitelet https://github.com/jsr107/RI/commit/757ff0eb85cd4df832e82aa42c72353a8225d59a
Skip to content

Commit 757ff0e

Browse files
committed
Closes #340 Enable cache retrieval from CacheManager.getCache() where runtime type enforcement is enabled.
1 parent 8483349 commit 757ff0e

1 file changed

Lines changed: 1 addition & 18 deletions

File tree

‎cache-ri-impl/src/main/java/org/jsr107/ri/RICacheManager.java‎

Lines changed: 1 addition & 18 deletions
Original file line numberDiff line numberDiff line change
@@ -241,24 +241,7 @@ public Cache getCache(String cacheName) {
241241
throw new IllegalStateException();
242242
}
243243
synchronized (caches) {
244-
RICache cache = caches.get(cacheName);
245-
246-
if (cache == null) {
247-
return null;
248-
} else {
249-
Configuration configuration = cache.getConfiguration(CompleteConfiguration.class);
250-
251-
if (configuration.getKeyType().equals(Object.class) &&
252-
configuration.getValueType().equals(Object.class)) {
253-
return cache;
254-
} else {
255-
throw new IllegalArgumentException("Cache " + cacheName + " was " +
256-
"defined with specific types Cache<" +
257-
configuration.getKeyType() + ", " + configuration.getValueType() + "> " +
258-
"in which case CacheManager.getCache(String, Class, Class) must be used");
259-
}
260-
261-
}
244+
return caches.get(cacheName);
262245
}
263246
}
264247

0 commit comments

Comments
 (0)