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 import java.lang.annotation.Annotation; 26 27 /** 28 * Empty array is immutable. Use a shared empty array to avoid allocation. 29 * 30 * @hide 31 */ 32 @SystemApi(client = MODULE_LIBRARIES) 33 public final class EmptyArray { EmptyArray()34 private EmptyArray() {} 35 36 /** @hide */ 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 @SystemApi(client = MODULE_LIBRARIES) 44 public static final @NonNull byte[] BYTE = new byte[0]; 45 46 /** @hide */ 47 public static final char[] CHAR = new char[0]; 48 49 /** @hide */ 50 public static final double[] DOUBLE = new double[0]; 51 52 /** @hide */ 53 @SystemApi(client = MODULE_LIBRARIES) 54 public static final @NonNull float[] FLOAT = new float[0]; 55 56 /** @hide */ 57 @UnsupportedAppUsage(maxTargetSdk=VersionCodes.Q, 58 publicAlternatives="Use {@code new int[0]} instead.") 59 @SystemApi(client = MODULE_LIBRARIES) 60 public static final @NonNull int[] INT = new int[0]; 61 62 /** @hide */ 63 @UnsupportedAppUsage(maxTargetSdk=VersionCodes.Q, 64 publicAlternatives="Use {@code new long[0]} instead.") 65 @SystemApi(client = MODULE_LIBRARIES) 66 public static final @NonNull long[] LONG = new long[0]; 67 68 /** @hide */ 69 public static final Class<?>[] CLASS = new Class[0]; 70 71 /** @hide */ 72 @UnsupportedAppUsage(maxTargetSdk=VersionCodes.Q, 73 publicAlternatives="Use {@code new Object[0]} instead.") 74 @SystemApi(client = MODULE_LIBRARIES) 75 public static final @NonNull Object[] OBJECT = new Object[0]; 76 77 /** @hide */ 78 @SystemApi(client = MODULE_LIBRARIES) 79 public static final @NonNull String[] STRING = new String[0]; 80 81 /** @hide */ 82 public static final Throwable[] THROWABLE = new Throwable[0]; 83 84 /** @hide */ 85 public static final StackTraceElement[] STACK_TRACE_ELEMENT = new StackTraceElement[0]; 86 87 /** @hide */ 88 public static final java.lang.reflect.Type[] TYPE = new java.lang.reflect.Type[0]; 89 90 /** @hide */ 91 public static final java.lang.reflect.TypeVariable[] TYPE_VARIABLE = 92 new java.lang.reflect.TypeVariable[0]; 93 /** @hide */ 94 public static final Annotation[] ANNOTATION = new Annotation[0]; 95 } 96