• Home
  • Line#
  • Scopes#
  • Navigate#
  • Raw
  • Download
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 @SystemApi(client = MODULE_LIBRARIES)
31 public final class EmptyArray {
EmptyArray()32     private EmptyArray() {}
33 
34     /** @hide */
35     @SystemApi(client = MODULE_LIBRARIES)
36     public static final @NonNull boolean[] BOOLEAN = new boolean[0];
37 
38     /** @hide */
39     @UnsupportedAppUsage(maxTargetSdk=VersionCodes.Q,
40             publicAlternatives="Use {@code new byte[0]} instead.")
41     @SystemApi(client = MODULE_LIBRARIES)
42     public static final @NonNull byte[] BYTE = new byte[0];
43 
44     /** @hide */
45     public static final char[] CHAR = new char[0];
46 
47     /** @hide */
48     public static final double[] DOUBLE = new double[0];
49 
50     /** @hide */
51     @SystemApi(client = MODULE_LIBRARIES)
52     public static final @NonNull float[] FLOAT = new float[0];
53 
54     /** @hide */
55     @UnsupportedAppUsage(maxTargetSdk=VersionCodes.Q,
56             publicAlternatives="Use {@code new int[0]} instead.")
57     @SystemApi(client = MODULE_LIBRARIES)
58     public static final @NonNull int[] INT = new int[0];
59 
60     /** @hide */
61     @UnsupportedAppUsage(maxTargetSdk=VersionCodes.Q,
62             publicAlternatives="Use {@code new long[0]} instead.")
63     @SystemApi(client = MODULE_LIBRARIES)
64     public static final @NonNull long[] LONG = new long[0];
65 
66     /** @hide */
67     public static final Class<?>[] CLASS = new Class[0];
68 
69     /** @hide */
70     @UnsupportedAppUsage(maxTargetSdk=VersionCodes.Q,
71             publicAlternatives="Use {@code new Object[0]} instead.")
72     @SystemApi(client = MODULE_LIBRARIES)
73     public static final @NonNull Object[] OBJECT = new Object[0];
74 
75     /** @hide */
76     @SystemApi(client = MODULE_LIBRARIES)
77     public static final @NonNull String[] STRING = new String[0];
78 
79     /** @hide */
80     public static final Throwable[] THROWABLE = new Throwable[0];
81 
82     /** @hide */
83     public static final StackTraceElement[] STACK_TRACE_ELEMENT = new StackTraceElement[0];
84 
85     /** @hide */
86     public static final java.lang.reflect.Type[] TYPE = new java.lang.reflect.Type[0];
87 
88     /** @hide */
89     public static final java.lang.reflect.TypeVariable[] TYPE_VARIABLE =
90         new java.lang.reflect.TypeVariable[0];
91 }
92