Merge pull request #60 from arturobernalg/feature/JCS-218
JCS-218 - Redundant operation:
diff --git a/commons-jcs-core/src/main/java/org/apache/commons/jcs3/auxiliary/disk/jdbc/JDBCDiskCache.java b/commons-jcs-core/src/main/java/org/apache/commons/jcs3/auxiliary/disk/jdbc/JDBCDiskCache.java
index cc426dc..c1db9ed 100644
--- a/commons-jcs-core/src/main/java/org/apache/commons/jcs3/auxiliary/disk/jdbc/JDBCDiskCache.java
+++ b/commons-jcs-core/src/main/java/org/apache/commons/jcs3/auxiliary/disk/jdbc/JDBCDiskCache.java
@@ -635,7 +635,7 @@
@Override
public void processDispose()
{
- final ICacheEvent<K> cacheEvent = createICacheEvent( getCacheName(), (K)null, ICacheEventLogger.DISPOSE_EVENT );
+ final ICacheEvent<K> cacheEvent = createICacheEvent( getCacheName(), null, ICacheEventLogger.DISPOSE_EVENT );
try
{
diff --git a/commons-jcs-core/src/main/java/org/apache/commons/jcs3/engine/control/CompositeCacheConfigurator.java b/commons-jcs-core/src/main/java/org/apache/commons/jcs3/engine/control/CompositeCacheConfigurator.java
index d913088..7cc7169 100644
--- a/commons-jcs-core/src/main/java/org/apache/commons/jcs3/engine/control/CompositeCacheConfigurator.java
+++ b/commons-jcs-core/src/main/java/org/apache/commons/jcs3/engine/control/CompositeCacheConfigurator.java
@@ -389,7 +389,7 @@
// GET CACHE
@SuppressWarnings("unchecked") // Common map for all caches
- AuxiliaryCache<K, V> auxCache = (AuxiliaryCache<K, V>) ccm.getAuxiliaryCache(auxName, regName);
+ AuxiliaryCache<K, V> auxCache = ccm.getAuxiliaryCache(auxName, regName);
if (auxCache == null)
{
diff --git a/commons-jcs-core/src/main/java/org/apache/commons/jcs3/utils/config/OptionConverter.java b/commons-jcs-core/src/main/java/org/apache/commons/jcs3/utils/config/OptionConverter.java
index 816271f..1f3b44b 100644
--- a/commons-jcs-core/src/main/java/org/apache/commons/jcs3/utils/config/OptionConverter.java
+++ b/commons-jcs-core/src/main/java/org/apache/commons/jcs3/utils/config/OptionConverter.java
@@ -396,7 +396,7 @@
sbuf.append( val.substring( i ) );
return sbuf.toString();
}
- sbuf.append( val.substring( i, j ) );
+ sbuf.append(val, i, j);
k = val.indexOf( DELIM_STOP, j );
if ( k == -1 )
{
diff --git a/commons-jcs-jcache/src/main/java/org/apache/commons/jcs3/jcache/ExpiryAwareCache.java b/commons-jcs-jcache/src/main/java/org/apache/commons/jcs3/jcache/ExpiryAwareCache.java
index 9bb02ca..dfb00f5 100644
--- a/commons-jcs-jcache/src/main/java/org/apache/commons/jcs3/jcache/ExpiryAwareCache.java
+++ b/commons-jcs-jcache/src/main/java/org/apache/commons/jcs3/jcache/ExpiryAwareCache.java
@@ -23,7 +23,6 @@
import javax.cache.Cache;
import javax.cache.configuration.CacheEntryListenerConfiguration;
-import javax.cache.event.CacheEntryEvent;
import javax.cache.event.EventType;
import org.apache.commons.jcs3.engine.behavior.ICacheElement;
@@ -48,7 +47,7 @@
super.doExpires(element);
for (final JCSListener<A, B> listener : listeners.values())
{
- listener.onExpired(Collections.<CacheEntryEvent<? extends A, ? extends B>>singletonList(new JCSCacheEntryEvent<>(
+ listener.onExpired(Collections.singletonList(new JCSCacheEntryEvent<>(
cacheRef, EventType.REMOVED, null, element.getKey(), element.getVal())));
}
}
diff --git a/commons-jcs-jcache/src/main/java/org/apache/commons/jcs3/jcache/JCSCache.java b/commons-jcs-jcache/src/main/java/org/apache/commons/jcs3/jcache/JCSCache.java
index 45c1283..b0541e7 100644
--- a/commons-jcs-jcache/src/main/java/org/apache/commons/jcs3/jcache/JCSCache.java
+++ b/commons-jcs-jcache/src/main/java/org/apache/commons/jcs3/jcache/JCSCache.java
@@ -41,7 +41,6 @@
import javax.cache.configuration.CacheEntryListenerConfiguration;
import javax.cache.configuration.Configuration;
import javax.cache.configuration.Factory;
-import javax.cache.event.CacheEntryEvent;
import javax.cache.event.EventType;
import javax.cache.expiry.Duration;
import javax.cache.expiry.EternalExpiryPolicy;
@@ -382,12 +381,12 @@
{
if (created)
{
- listener.onCreated(Collections.<CacheEntryEvent<? extends K, ? extends V>>singletonList(new JCSCacheEntryEvent<>(this,
+ listener.onCreated(Collections.singletonList(new JCSCacheEntryEvent<>(this,
EventType.CREATED, null, key, value)));
}
else
{
- listener.onUpdated(Collections.<CacheEntryEvent<? extends K, ? extends V>>singletonList(new JCSCacheEntryEvent<>(this,
+ listener.onUpdated(Collections.singletonList(new JCSCacheEntryEvent<>(this,
EventType.UPDATED, old, key, value)));
}
}
@@ -418,7 +417,7 @@
delegate.remove(cacheKey);
for (final JCSListener<K, V> listener : listeners.values())
{
- listener.onExpired(Collections.<CacheEntryEvent<? extends K, ? extends V>>singletonList(new JCSCacheEntryEvent<>(this,
+ listener.onExpired(Collections.singletonList(new JCSCacheEntryEvent<>(this,
EventType.REMOVED, null, cacheKey, elt.getVal())));
}
}
@@ -476,7 +475,7 @@
final boolean remove = v != null;
for (final JCSListener<K, V> listener : listeners.values())
{
- listener.onRemoved(Collections.<CacheEntryEvent<? extends K, ? extends V>>singletonList(new JCSCacheEntryEvent<>(this,
+ listener.onRemoved(Collections.singletonList(new JCSCacheEntryEvent<>(this,
EventType.REMOVED, null, key, value)));
}
if (remove && statisticsEnabled)