Skip to content

Commit 656d1f7

Browse files
committed
CacheService: move default method impl to iface
1 parent 2366080 commit 656d1f7

File tree

2 files changed

+7
-11
lines changed

2 files changed

+7
-11
lines changed

src/main/java/org/scijava/cache/CacheService.java

Lines changed: 7 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -63,5 +63,11 @@ public interface CacheService extends SciJavaService {
6363
* of the value loader.
6464
* @throws ExecutionException
6565
*/
66-
<V> V get(Object key, Callable<V> valueLoader) throws ExecutionException;
66+
@SuppressWarnings("unchecked")
67+
default <V> V get(final Object key, final Callable<V> valueLoader)
68+
throws ExecutionException
69+
{
70+
return (V)get(key);
71+
}
72+
6773
}

src/main/java/org/scijava/cache/DefaultCacheService.java

Lines changed: 0 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -33,8 +33,6 @@
3333

3434
import java.util.Map;
3535
import java.util.WeakHashMap;
36-
import java.util.concurrent.Callable;
37-
import java.util.concurrent.ExecutionException;
3836

3937
import org.scijava.Priority;
4038
import org.scijava.plugin.Plugin;
@@ -61,14 +59,6 @@ public Object get(final Object key) {
6159
return map.get(key);
6260
}
6361

64-
@SuppressWarnings("unchecked")
65-
@Override
66-
public <V> V get(final Object key, final Callable<V> valueLoader)
67-
throws ExecutionException
68-
{
69-
return (V)get(key);
70-
}
71-
7262
// -- Service Methods --
7363

7464
@Override

0 commit comments

Comments
 (0)