jsr107 / jsr107spec

JSR107 Cache Specification
Apache License 2.0
413 stars 164 forks source link

Cache.getName(String): unuseful signature #339

Closed cruftex closed 8 years ago

cruftex commented 8 years ago

The method produces only meaningful results if the cache is not typed. The JavaDoc says:

   * Implementations must check if key and value types were configured
   * for the requested {@link Cache}. If either the keyType or valueType of the
   * configured {@link Cache} were specified (other than <code>Object.class</code>)
   * an {@link IllegalArgumentException} will be thrown.

The signature of the method is:

<K, V> Cache<K, V> getCache(String cacheName);

It should be:

Cache getCache(String cacheName);

Maybe this is possible to fix for 1.1?! I am not quite sure....

Side note: There is a another problem with the semantic definition. The cache manager iterates the cache names. There is a chicken and egg problem. If you do not know the proper types, it is not possible to retrieve a cache. If you have a cache, you can retrieve the configured types by cache.getConfiguration().

cruftex commented 8 years ago

Dropping this one in favor of #340. If we change the semantic of getCache(name) the method signature is useful as it is now.