diff --git a/cats/cats-core/src/main/java/com/netflix/spinnaker/cats/provider/DefaultProviderCache.java b/cats/cats-core/src/main/java/com/netflix/spinnaker/cats/provider/DefaultProviderCache.java index 55d636b45c7..28080d9f3b3 100644 --- a/cats/cats-core/src/main/java/com/netflix/spinnaker/cats/provider/DefaultProviderCache.java +++ b/cats/cats-core/src/main/java/com/netflix/spinnaker/cats/provider/DefaultProviderCache.java @@ -133,9 +133,9 @@ public void putCacheResult(String sourceAgentType, Collection authoritat Map> evictions = new HashMap<>(); for (String type : allTypes) { - final Collection previousSet; + final Set previousSet; if (authoritativeTypes.contains(type)) { - previousSet = new HashSet<>(getExistingSourceIdentifiers(type, sourceAgentType)); + previousSet = getExistingSourceIdentifiers(type, sourceAgentType); } else { previousSet = new HashSet<>(); } @@ -193,7 +193,7 @@ private Collection buildResponse(Collection source) { return Collections.unmodifiableCollection(response); } - private Collection getExistingSourceIdentifiers(String type, String sourceAgentType) { + private Set getExistingSourceIdentifiers(String type, String sourceAgentType) { CacheData all = backingStore.get(type, ALL_ID); if (all == null) { return new HashSet<>(); @@ -202,7 +202,7 @@ private Collection getExistingSourceIdentifiers(String type, String sour if (relationship == null) { return new HashSet<>(); } - return relationship; + return relationship instanceof Set ? (Set) relationship : new HashSet<>(relationship); } private void cacheDataType(String type, String sourceAgentType, Collection items) { diff --git a/cats/cats-redis/src/main/java/com/netflix/spinnaker/cats/redis/cache/AbstractRedisCache.java b/cats/cats-redis/src/main/java/com/netflix/spinnaker/cats/redis/cache/AbstractRedisCache.java index 47c5e64aa46..13db2e26235 100644 --- a/cats/cats-redis/src/main/java/com/netflix/spinnaker/cats/redis/cache/AbstractRedisCache.java +++ b/cats/cats-redis/src/main/java/com/netflix/spinnaker/cats/redis/cache/AbstractRedisCache.java @@ -37,7 +37,7 @@ public abstract class AbstractRedisCache implements WriteableCache { protected static final TypeReference> ATTRIBUTES = new TypeReference>() { }; - protected static final TypeReference> RELATIONSHIPS = new TypeReference>() { + protected static final TypeReference> RELATIONSHIPS = new TypeReference>() { }; private final Logger log = LoggerFactory.getLogger(getClass());