From 2c2c6f8e026a9d93ec9c3f4525e01b701c5ad572 Mon Sep 17 00:00:00 2001 From: Stephane Nicoll Date: Thu, 27 Oct 2016 10:30:54 +0200 Subject: [PATCH] Fix broken build This commit fixes the direct use of Java8 API Issue: SPR-14853 --- .../cache/interceptor/CacheAspectSupport.java | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/spring-context/src/main/java/org/springframework/cache/interceptor/CacheAspectSupport.java b/spring-context/src/main/java/org/springframework/cache/interceptor/CacheAspectSupport.java index 75a7e583b2..2d1121a55c 100644 --- a/spring-context/src/main/java/org/springframework/cache/interceptor/CacheAspectSupport.java +++ b/spring-context/src/main/java/org/springframework/cache/interceptor/CacheAspectSupport.java @@ -424,9 +424,9 @@ public abstract class CacheAspectSupport extends AbstractCacheInvoker } private Object wrapCacheValue(Method method, Object cacheValue) { - if (method.getReturnType() == Optional.class && - (cacheValue == null || cacheValue.getClass() != Optional.class)) { - return Optional.ofNullable(cacheValue); + if (method.getReturnType() == javaUtilOptionalClass && + (cacheValue == null || cacheValue.getClass() != javaUtilOptionalClass)) { + return OptionalUnwrapper.wrap(cacheValue); } return cacheValue; }