Last analyzed d6ca518 2 days ago
Default analysis branch is
Currently analyzing run
Serializable class with non-serializable superclass and no default constructor detected JAVA-E1034
Bug risk
8 days ago3 months old
BoundedLocalAsyncLoadingCache is serializable but its superclass is not serializable and does not define a default constructor
4521
4522  /* --------------- Async Loading Cache --------------- */
4523
4524  static final class BoundedLocalAsyncLoadingCache<K, V>4525      extends LocalAsyncLoadingCache<K, V> implements Serializable {4526    private static final long serialVersionUID = 1;45274528    final BoundedLocalCache<K, CompletableFuture<V>> cache;4529    final boolean isWeighted;45304531    @Nullable ConcurrentMap<K, CompletableFuture<V>> mapView;4532    @Nullable Policy<K, V> policy;45334534    @SuppressWarnings("unchecked")4535    BoundedLocalAsyncLoadingCache(Caffeine<K, V> builder, AsyncCacheLoader<? super K, V> loader) {4536      super(loader);4537      isWeighted = builder.isWeighted();4538      cache = (BoundedLocalCache<K, CompletableFuture<V>>) LocalCacheFactory4539          .newBoundedLocalCache(builder, loader, /* async */ true);4540    }45414542    @Override4543    public BoundedLocalCache<K, CompletableFuture<V>> cache() {4544      return cache;4545    }45464547    @Override4548    public ConcurrentMap<K, CompletableFuture<V>> asMap() {4549      return (mapView == null) ? (mapView = new AsyncAsMapView<>(this)) : mapView;4550    }45514552    @Override4553    public Policy<K, V> policy() {4554      if (policy == null) {4555        @SuppressWarnings("unchecked")4556        BoundedLocalCache<K, V> castCache = (BoundedLocalCache<K, V>) cache;4557        Function<CompletableFuture<V>, V> transformer = Async::getIfReady;4558        @SuppressWarnings("unchecked")4559        Function<V, V> castTransformer = (Function<V, V>) transformer;4560        policy = new BoundedPolicy<>(castCache, castTransformer, isWeighted);4561      }4562      return policy;4563    }45644565    @SuppressWarnings("UnusedVariable")4566    private void readObject(ObjectInputStream stream) throws InvalidObjectException {4567      throw new InvalidObjectException("Proxy required");4568    }45694570    private Object writeReplace() {4571      return makeSerializationProxy(cache);4572    }4573  }4574}
4575
4576/** The namespace for field padding through inheritance. */