1 /* 2 * Copyright (C) 2018 The Android Open Source Project 3 * 4 * Licensed under the Apache License, Version 2.0 (the "License"); 5 * you may not use this file except in compliance with the License. 6 * You may obtain a copy of the License at 7 * 8 * http://www.apache.org/licenses/LICENSE-2.0 9 * 10 * Unless required by applicable law or agreed to in writing, software 11 * distributed under the License is distributed on an "AS IS" BASIS, 12 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 13 * See the License for the specific language governing permissions and 14 * limitations under the License. 15 */ 16 17 package sun.security.util; 18 19 import android.compat.annotation.UnsupportedAppUsage; 20 21 @SuppressWarnings({"unchecked", "deprecation", "all"}) 22 class MemoryCache<K, V> extends sun.security.util.Cache<K, V> { 23 MemoryCache(boolean soft, int maxSize)24 public MemoryCache(boolean soft, int maxSize) { 25 throw new RuntimeException("Stub!"); 26 } 27 MemoryCache(boolean soft, int maxSize, int lifetime)28 public MemoryCache(boolean soft, int maxSize, int lifetime) { 29 throw new RuntimeException("Stub!"); 30 } 31 emptyQueue()32 private void emptyQueue() { 33 throw new RuntimeException("Stub!"); 34 } 35 expungeExpiredEntries()36 private void expungeExpiredEntries() { 37 throw new RuntimeException("Stub!"); 38 } 39 size()40 public synchronized int size() { 41 throw new RuntimeException("Stub!"); 42 } 43 clear()44 public synchronized void clear() { 45 throw new RuntimeException("Stub!"); 46 } 47 put(K key, V value)48 public synchronized void put(K key, V value) { 49 throw new RuntimeException("Stub!"); 50 } 51 get(java.lang.Object key)52 public synchronized V get(java.lang.Object key) { 53 throw new RuntimeException("Stub!"); 54 } 55 remove(java.lang.Object key)56 public synchronized void remove(java.lang.Object key) { 57 throw new RuntimeException("Stub!"); 58 } 59 setCapacity(int size)60 public synchronized void setCapacity(int size) { 61 throw new RuntimeException("Stub!"); 62 } 63 setTimeout(int timeout)64 public synchronized void setTimeout(int timeout) { 65 throw new RuntimeException("Stub!"); 66 } 67 accept(sun.security.util.Cache.CacheVisitor<K, V> visitor)68 public synchronized void accept(sun.security.util.Cache.CacheVisitor<K, V> visitor) { 69 throw new RuntimeException("Stub!"); 70 } 71 getCachedEntries()72 private java.util.Map<K, V> getCachedEntries() { 73 throw new RuntimeException("Stub!"); 74 } 75 newEntry( K key, V value, long expirationTime, java.lang.ref.ReferenceQueue<V> queue)76 protected sun.security.util.MemoryCache.CacheEntry<K, V> newEntry( 77 K key, V value, long expirationTime, java.lang.ref.ReferenceQueue<V> queue) { 78 throw new RuntimeException("Stub!"); 79 } 80 81 private static final boolean DEBUG = false; 82 83 private static final float LOAD_FACTOR = 0.75f; 84 85 private final java.util.Map<K, sun.security.util.MemoryCache.CacheEntry<K, V>> cacheMap; 86 87 { 88 cacheMap = null; 89 } 90 91 private long lifetime; 92 93 private int maxSize; 94 95 private final java.lang.ref.ReferenceQueue<V> queue; 96 97 { 98 queue = null; 99 } 100 101 @SuppressWarnings({"unchecked", "deprecation", "all"}) 102 private static interface CacheEntry<K, V> { 103 isValid(long currentTime)104 public boolean isValid(long currentTime); 105 invalidate()106 public void invalidate(); 107 getKey()108 public K getKey(); 109 getValue()110 public V getValue(); 111 } 112 113 @SuppressWarnings({"unchecked", "deprecation", "all"}) 114 private static class HardCacheEntry<K, V> 115 implements sun.security.util.MemoryCache.CacheEntry<K, V> { 116 117 @UnsupportedAppUsage HardCacheEntry(K key, V value, long expirationTime)118 HardCacheEntry(K key, V value, long expirationTime) { 119 throw new RuntimeException("Stub!"); 120 } 121 getKey()122 public K getKey() { 123 throw new RuntimeException("Stub!"); 124 } 125 getValue()126 public V getValue() { 127 throw new RuntimeException("Stub!"); 128 } 129 isValid(long currentTime)130 public boolean isValid(long currentTime) { 131 throw new RuntimeException("Stub!"); 132 } 133 invalidate()134 public void invalidate() { 135 throw new RuntimeException("Stub!"); 136 } 137 138 private long expirationTime; 139 140 private K key; 141 142 private V value; 143 } 144 145 @SuppressWarnings({"unchecked", "deprecation", "all"}) 146 private static class SoftCacheEntry<K, V> extends java.lang.ref.SoftReference<V> 147 implements sun.security.util.MemoryCache.CacheEntry<K, V> { 148 149 @UnsupportedAppUsage SoftCacheEntry(K key, V value, long expirationTime, java.lang.ref.ReferenceQueue<V> queue)150 SoftCacheEntry(K key, V value, long expirationTime, java.lang.ref.ReferenceQueue<V> queue) { 151 super(null); 152 throw new RuntimeException("Stub!"); 153 } 154 getKey()155 public K getKey() { 156 throw new RuntimeException("Stub!"); 157 } 158 getValue()159 public V getValue() { 160 throw new RuntimeException("Stub!"); 161 } 162 isValid(long currentTime)163 public boolean isValid(long currentTime) { 164 throw new RuntimeException("Stub!"); 165 } 166 invalidate()167 public void invalidate() { 168 throw new RuntimeException("Stub!"); 169 } 170 171 private long expirationTime; 172 173 private K key; 174 } 175 } 176