diff --git a/cache-annotations-ri/cache-annotations-ri-common/src/main/java/org/jsr107/ri/annotations/AbstractCachePutInterceptor.java b/cache-annotations-ri/cache-annotations-ri-common/src/main/java/org/jsr107/ri/annotations/AbstractCachePutInterceptor.java index 6a4153d..926b86a 100644 --- a/cache-annotations-ri/cache-annotations-ri-common/src/main/java/org/jsr107/ri/annotations/AbstractCachePutInterceptor.java +++ b/cache-annotations-ri/cache-annotations-ri-common/src/main/java/org/jsr107/ri/annotations/AbstractCachePutInterceptor.java @@ -99,19 +99,7 @@ public Object cachePut(CacheContextSource cacheContextSource, I invocation) t protected void cacheValue(final InternalCacheKeyInvocationContext cacheKeyInvocationContext, final CachePutMethodDetails methodDetails, final Object value) { - final Object cachedValue; - if (value == null) { - if (methodDetails.getCacheAnnotation().cacheNull()) { - //Null values are cached, set value to the null placeholder - cachedValue = CacheContextSource.NULL_PLACEHOLDER; - } else { - //Ignore null values - return; - } - } else { - cachedValue = value; - } - + final Object cachedValue = value; final CacheResolver cacheResolver = methodDetails.getCacheResolver(); final Cache cache = cacheResolver.resolveCache(cacheKeyInvocationContext); diff --git a/cache-annotations-ri/cache-annotations-ri-common/src/main/java/org/jsr107/ri/annotations/AbstractCacheResultInterceptor.java b/cache-annotations-ri/cache-annotations-ri-common/src/main/java/org/jsr107/ri/annotations/AbstractCacheResultInterceptor.java index 07dd176..b3c73ba 100644 --- a/cache-annotations-ri/cache-annotations-ri-common/src/main/java/org/jsr107/ri/annotations/AbstractCacheResultInterceptor.java +++ b/cache-annotations-ri/cache-annotations-ri-common/src/main/java/org/jsr107/ri/annotations/AbstractCacheResultInterceptor.java @@ -69,9 +69,7 @@ public final Object cacheResult(CacheContextSource cacheContextSource, I invo if (!cacheResultAnnotation.skipGet()) { //Look in cache for existing data result = cache.get(cacheKey); - if (cacheResultAnnotation.cacheNull() && CacheContextSource.NULL_PLACEHOLDER.equals(result)) { - return null; - } else if (result != null) { + if (result != null) { //Cache hit, return result return result; } @@ -87,8 +85,6 @@ public final Object cacheResult(CacheContextSource cacheContextSource, I invo //Cache non-null result if (result != null) { cache.put(cacheKey, result); - } else if (cacheResultAnnotation.cacheNull()) { - cache.put(cacheKey, CacheContextSource.NULL_PLACEHOLDER); } return result; diff --git a/cache-annotations-ri/cache-annotations-ri-common/src/main/java/org/jsr107/ri/annotations/CacheContextSource.java b/cache-annotations-ri/cache-annotations-ri-common/src/main/java/org/jsr107/ri/annotations/CacheContextSource.java index 9a5ef30..402e1ef 100644 --- a/cache-annotations-ri/cache-annotations-ri-common/src/main/java/org/jsr107/ri/annotations/CacheContextSource.java +++ b/cache-annotations-ri/cache-annotations-ri-common/src/main/java/org/jsr107/ri/annotations/CacheContextSource.java @@ -29,10 +29,6 @@ * @since 1.0 */ public interface CacheContextSource { - /** - * Placeholder used for caching a null value - */ - NullPlaceholder NULL_PLACEHOLDER = NullPlaceholder.INSTANCE; /** * Get information about an invocation annotated {@link javax.cache.annotation.CacheResult}, @@ -64,15 +60,4 @@ public interface CacheContextSource { */ StaticCacheInvocationContext getMethodDetails(Method method, Class targetClass); - - /** - * Used to cache null values, there should never be more than the single INSTANCE - */ - public enum NullPlaceholder { - /** - * Null Placeholder for use with {@link javax.cache.annotation.CachePut} and - * {@link javax.cache.annotation.CacheResult} - */ - INSTANCE; - } }