You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@commons.apache.org by tv...@apache.org on 2021/04/18 09:35:37 UTC

[commons-jcs] branch master updated: JCS-218 - Redundant operation:

This is an automated email from the ASF dual-hosted git repository.

tv pushed a commit to branch master
in repository https://gitbox.apache.org/repos/asf/commons-jcs.git


The following commit(s) were added to refs/heads/master by this push:
     new df75c27  JCS-218 - Redundant operation:
     new adb284a  Merge pull request #60 from arturobernalg/feature/JCS-218
df75c27 is described below

commit df75c278033b2036feb06241fda57da738142919
Author: Arturo Bernal <ar...@gmail.com>
AuthorDate: Tue Apr 13 20:11:48 2021 +0200

    JCS-218 - Redundant operation:
    
    * Remove redundant String operation
    * Remove redundant type cast
    * Redundant type arguments
---
 .../apache/commons/jcs3/auxiliary/disk/jdbc/JDBCDiskCache.java   | 2 +-
 .../commons/jcs3/engine/control/CompositeCacheConfigurator.java  | 2 +-
 .../org/apache/commons/jcs3/utils/config/OptionConverter.java    | 2 +-
 .../java/org/apache/commons/jcs3/jcache/ExpiryAwareCache.java    | 3 +--
 .../src/main/java/org/apache/commons/jcs3/jcache/JCSCache.java   | 9 ++++-----
 5 files changed, 8 insertions(+), 10 deletions(-)

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 @@ public class JDBCDiskCache<K, V>
     @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 @@ public class CompositeCacheConfigurator
 
         // 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 @@ public class OptionConverter
                 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 java.util.Map;
 
 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 @@ public class ExpiryAwareCache<A, B> extends CompositeCache<A, B>
         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.CacheManager;
 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 @@ public class JCSCache<K, V> implements Cache<K, V>
             {
                 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 @@ public class JCSCache<K, V> implements Cache<K, V>
         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 @@ public class JCSCache<K, V> implements Cache<K, V>
         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)