/** * Returns the value associated with {@code key} in this cache, first creating that value if * necessary. No observable state associated with this cache is modified until loading completes. * * @param key for which to retrieve cached value. * @return cached value associated with the key. */ @SuppressWarnings("unchecked") public V get(final K key) { final V value = mCache.get(key); final ReferenceCountedProxy<K, V> proxy = new ReferenceCountedProxy<>(value, key, mCache, mTrackProxies); if (mTrackProxies) { ResourceTracker.get().registerResource(proxy); } return (V) Proxy.newProxyInstance(value.getClass().getClassLoader(), mIface, proxy); }