Uploaded image for project: 'Infinispan'
  1. Infinispan
  2. ISPN-4506

Fix types on AdvancedCacheLoader to be friendlier for loader implementors

XMLWordPrintable

      Currently AdvancedCacheLoader has the following method

      void process(KeyFilter<? super K> filter, CacheLoaderTask<? super K, ? super V> task, Executor executor, boolean fetchValue, boolean fetchMetadata);
      

      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.

              wburns@redhat.com Will Burns
              wburns@redhat.com Will Burns
              Votes:
              0 Vote for this issue
              Watchers:
              2 Start watching this issue

                Created:
                Updated:
                Resolved: