1 /*
2  * Copyright (c) 1997, 2013, Oracle and/or its affiliates. All rights reserved.
3  * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
4  *
5  * This code is free software; you can redistribute it and/or modify it
6  * under the terms of the GNU General Public License version 2 only, as
7  * published by the Free Software Foundation.  Oracle designates this
8  * particular file as subject to the "Classpath" exception as provided
9  * by Oracle in the LICENSE file that accompanied this code.
10  *
11  * This code is distributed in the hope that it will be useful, but WITHOUT
12  * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
13  * FITNESS FOR A PARTICULAR PURPOSE.  See the GNU General Public License
14  * version 2 for more details (a copy is included in the LICENSE file that
15  * accompanied this code).
16  *
17  * You should have received a copy of the GNU General Public License version
18  * 2 along with this work; if not, write to the Free Software Foundation,
19  * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
20  *
21  * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
22  * or visit www.oracle.com if you need additional information or have any
23  * questions.
24  */
25 
26 package java.lang;
27 
28 import dalvik.annotation.compat.UnsupportedAppUsage;
29 
30 @SuppressWarnings({"unchecked", "deprecation", "all"})
31 public class ThreadLocal<T> {
32 
ThreadLocal()33     public ThreadLocal() {
34         throw new RuntimeException("Stub!");
35     }
36 
nextHashCode()37     private static int nextHashCode() {
38         throw new RuntimeException("Stub!");
39     }
40 
initialValue()41     protected T initialValue() {
42         throw new RuntimeException("Stub!");
43     }
44 
withInitial( java.util.function.Supplier<? extends S> supplier)45     public static <S> java.lang.ThreadLocal<S> withInitial(
46             java.util.function.Supplier<? extends S> supplier) {
47         throw new RuntimeException("Stub!");
48     }
49 
get()50     public T get() {
51         throw new RuntimeException("Stub!");
52     }
53 
setInitialValue()54     private T setInitialValue() {
55         throw new RuntimeException("Stub!");
56     }
57 
set(T value)58     public void set(T value) {
59         throw new RuntimeException("Stub!");
60     }
61 
remove()62     public void remove() {
63         throw new RuntimeException("Stub!");
64     }
65 
66     @UnsupportedAppUsage
getMap(java.lang.Thread t)67     java.lang.ThreadLocal.ThreadLocalMap getMap(java.lang.Thread t) {
68         throw new RuntimeException("Stub!");
69     }
70 
createMap(java.lang.Thread t, T firstValue)71     void createMap(java.lang.Thread t, T firstValue) {
72         throw new RuntimeException("Stub!");
73     }
74 
createInheritedMap( java.lang.ThreadLocal.ThreadLocalMap parentMap)75     static java.lang.ThreadLocal.ThreadLocalMap createInheritedMap(
76             java.lang.ThreadLocal.ThreadLocalMap parentMap) {
77         throw new RuntimeException("Stub!");
78     }
79 
childValue(T parentValue)80     T childValue(T parentValue) {
81         throw new RuntimeException("Stub!");
82     }
83 
84     private static final int HASH_INCREMENT = 1640531527; // 0x61c88647
85 
86     private static java.util.concurrent.atomic.AtomicInteger nextHashCode;
87 
88     private final int threadLocalHashCode;
89 
90     {
91         threadLocalHashCode = 0;
92     }
93 
94     @SuppressWarnings({"unchecked", "deprecation", "all"})
95     static final class SuppliedThreadLocal<T> extends java.lang.ThreadLocal<T> {
96 
SuppliedThreadLocal(java.util.function.Supplier<? extends T> supplier)97         SuppliedThreadLocal(java.util.function.Supplier<? extends T> supplier) {
98             throw new RuntimeException("Stub!");
99         }
100 
initialValue()101         protected T initialValue() {
102             throw new RuntimeException("Stub!");
103         }
104 
105         private final java.util.function.Supplier<? extends T> supplier;
106 
107         {
108             supplier = null;
109         }
110     }
111 
112     @SuppressWarnings({"unchecked", "deprecation", "all"})
113     static class ThreadLocalMap {
114 
ThreadLocalMap(java.lang.ThreadLocal<?> firstKey, java.lang.Object firstValue)115         ThreadLocalMap(java.lang.ThreadLocal<?> firstKey, java.lang.Object firstValue) {
116             throw new RuntimeException("Stub!");
117         }
118 
ThreadLocalMap(java.lang.ThreadLocal.ThreadLocalMap parentMap)119         private ThreadLocalMap(java.lang.ThreadLocal.ThreadLocalMap parentMap) {
120             throw new RuntimeException("Stub!");
121         }
122 
setThreshold(int len)123         private void setThreshold(int len) {
124             throw new RuntimeException("Stub!");
125         }
126 
nextIndex(int i, int len)127         private static int nextIndex(int i, int len) {
128             throw new RuntimeException("Stub!");
129         }
130 
prevIndex(int i, int len)131         private static int prevIndex(int i, int len) {
132             throw new RuntimeException("Stub!");
133         }
134 
getEntry(java.lang.ThreadLocal<?> key)135         private java.lang.ThreadLocal.ThreadLocalMap.Entry getEntry(java.lang.ThreadLocal<?> key) {
136             throw new RuntimeException("Stub!");
137         }
138 
getEntryAfterMiss( java.lang.ThreadLocal<?> key, int i, java.lang.ThreadLocal.ThreadLocalMap.Entry e)139         private java.lang.ThreadLocal.ThreadLocalMap.Entry getEntryAfterMiss(
140                 java.lang.ThreadLocal<?> key, int i, java.lang.ThreadLocal.ThreadLocalMap.Entry e) {
141             throw new RuntimeException("Stub!");
142         }
143 
set(java.lang.ThreadLocal<?> key, java.lang.Object value)144         private void set(java.lang.ThreadLocal<?> key, java.lang.Object value) {
145             throw new RuntimeException("Stub!");
146         }
147 
remove(java.lang.ThreadLocal<?> key)148         private void remove(java.lang.ThreadLocal<?> key) {
149             throw new RuntimeException("Stub!");
150         }
151 
replaceStaleEntry( java.lang.ThreadLocal<?> key, java.lang.Object value, int staleSlot)152         private void replaceStaleEntry(
153                 java.lang.ThreadLocal<?> key, java.lang.Object value, int staleSlot) {
154             throw new RuntimeException("Stub!");
155         }
156 
expungeStaleEntry(int staleSlot)157         private int expungeStaleEntry(int staleSlot) {
158             throw new RuntimeException("Stub!");
159         }
160 
cleanSomeSlots(int i, int n)161         private boolean cleanSomeSlots(int i, int n) {
162             throw new RuntimeException("Stub!");
163         }
164 
rehash()165         private void rehash() {
166             throw new RuntimeException("Stub!");
167         }
168 
resize()169         private void resize() {
170             throw new RuntimeException("Stub!");
171         }
172 
expungeStaleEntries()173         private void expungeStaleEntries() {
174             throw new RuntimeException("Stub!");
175         }
176 
177         private static final int INITIAL_CAPACITY = 16; // 0x10
178 
179         private int size = 0; // 0x0
180 
181         private java.lang.ThreadLocal.ThreadLocalMap.Entry[] table;
182 
183         private int threshold;
184 
185         @SuppressWarnings({"unchecked", "deprecation", "all"})
186         static class Entry extends java.lang.ref.WeakReference<java.lang.ThreadLocal<?>> {
187 
Entry(java.lang.ThreadLocal<?> k, java.lang.Object v)188             Entry(java.lang.ThreadLocal<?> k, java.lang.Object v) {
189                 super(null);
190                 throw new RuntimeException("Stub!");
191             }
192 
193             java.lang.Object value;
194         }
195     }
196 }
197