1 /*
2  * Copyright (C) 2010 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 libcore.util;
18 
19 import static android.annotation.SystemApi.Client.MODULE_LIBRARIES;
20 
21 import android.annotation.SystemApi;
22 import android.compat.annotation.UnsupportedAppUsage;
23 import dalvik.annotation.compat.VersionCodes;
24 
25 /**
26  * Empty array is immutable. Use a shared empty array to avoid allocation.
27  *
28  * @hide
29  */
30 @libcore.api.CorePlatformApi(status = libcore.api.CorePlatformApi.Status.STABLE)
31 @SystemApi(client = MODULE_LIBRARIES)
32 public final class EmptyArray {
EmptyArray()33     private EmptyArray() {}
34 
35     /** @hide */
36     @libcore.api.CorePlatformApi(status = libcore.api.CorePlatformApi.Status.STABLE)
37     @SystemApi(client = MODULE_LIBRARIES)
38     public static final @NonNull boolean[] BOOLEAN = new boolean[0];
39 
40     /** @hide */
41     @UnsupportedAppUsage(maxTargetSdk=VersionCodes.Q,
42             publicAlternatives="Use {@code new byte[0]} instead.")
43     @libcore.api.CorePlatformApi(status = libcore.api.CorePlatformApi.Status.STABLE)
44     @SystemApi(client = MODULE_LIBRARIES)
45     public static final @NonNull byte[] BYTE = new byte[0];
46 
47     /** @hide */
48     public static final char[] CHAR = new char[0];
49 
50     /** @hide */
51     public static final double[] DOUBLE = new double[0];
52 
53     /** @hide */
54     @libcore.api.CorePlatformApi(status = libcore.api.CorePlatformApi.Status.STABLE)
55     @SystemApi(client = MODULE_LIBRARIES)
56     public static final @NonNull float[] FLOAT = new float[0];
57 
58     /** @hide */
59     @UnsupportedAppUsage(maxTargetSdk=VersionCodes.Q,
60             publicAlternatives="Use {@code new int[0]} instead.")
61     @libcore.api.CorePlatformApi(status = libcore.api.CorePlatformApi.Status.STABLE)
62     @SystemApi(client = MODULE_LIBRARIES)
63     public static final @NonNull int[] INT = new int[0];
64 
65     /** @hide */
66     @UnsupportedAppUsage(maxTargetSdk=VersionCodes.Q,
67             publicAlternatives="Use {@code new long[0]} instead.")
68     @libcore.api.CorePlatformApi(status = libcore.api.CorePlatformApi.Status.STABLE)
69     @SystemApi(client = MODULE_LIBRARIES)
70     public static final @NonNull long[] LONG = new long[0];
71 
72     /** @hide */
73     public static final Class<?>[] CLASS = new Class[0];
74 
75     /** @hide */
76     @UnsupportedAppUsage(maxTargetSdk=VersionCodes.Q,
77             publicAlternatives="Use {@code new Object[0]} instead.")
78     @libcore.api.CorePlatformApi(status = libcore.api.CorePlatformApi.Status.STABLE)
79     @SystemApi(client = MODULE_LIBRARIES)
80     public static final @NonNull Object[] OBJECT = new Object[0];
81 
82     /** @hide */
83     @libcore.api.CorePlatformApi(status = libcore.api.CorePlatformApi.Status.STABLE)
84     @SystemApi(client = MODULE_LIBRARIES)
85     public static final @NonNull String[] STRING = new String[0];
86 
87     /** @hide */
88     public static final Throwable[] THROWABLE = new Throwable[0];
89 
90     /** @hide */
91     public static final StackTraceElement[] STACK_TRACE_ELEMENT = new StackTraceElement[0];
92 
93     /** @hide */
94     public static final java.lang.reflect.Type[] TYPE = new java.lang.reflect.Type[0];
95 
96     /** @hide */
97     public static final java.lang.reflect.TypeVariable[] TYPE_VARIABLE =
98         new java.lang.reflect.TypeVariable[0];
99 }
100