Fix types on AdvancedCacheLoader to be friendlier for loader
implementors
-------------------------------------------------------------------------
Key: ISPN-4506
URL:
https://issues.jboss.org/browse/ISPN-4506
Project: Infinispan
Issue Type: Bug
Security Level: Public(Everyone can see)
Components: Loaders and Stores
Reporter: William Burns
Assignee: William Burns
Currently AdvancedCacheLoader has the following method
{code}
void process(KeyFilter<? super K> filter, CacheLoaderTask<? super K, ? super
V> task, Executor executor, boolean fetchValue, boolean fetchMetadata);
{code}
The issue is that the CacheLoaderTask doesn't use the lower bound wildcard types
directly. Instead it has an argument of MarshalledEntry<K, V> which means the
lower bounds are applied to this Entry. Unfortunately the JVM compiler cannot do lower
bounds properly on a nested type like this so it can cause issues when passing this as an
argument.
Instead we should change the process method to have strong types for the CacheLoaderTask
which would allow for implementors to easily implement this. This does lose the ability
to pass super types for the CacheLoaderTask types, however this is unlikely to be used
often and can easily be worked around while maintaining type safety. On the inverse the
implementors of AdvancedCacheLoader have to resort to raw types to get it to compile.