blob: a4b7996ce4529b69cc626c3f2ae19e4662088f70 [file] [log] [blame]
//
// Copyright (C) 2017 The Android Open Source Project
//
// Licensed under the Apache License, Version 2.0 (the "License");
// you may not use this file except in compliance with the License.
// You may obtain a copy of the License at
//
// http://www.apache.org/licenses/LICENSE-2.0
//
// Unless required by applicable law or agreed to in writing, software
// distributed under the License is distributed on an "AS IS" BASIS,
// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
// See the License for the specific language governing permissions and
// limitations under the License.
// This file specifies additional annotations that are applied to libcore
// code before generating android stubs and documentation. This data
// is human-maintained and is based on jdk annotations shipped in Android
// Studio.
// If this file is changed, please update libcore/annotated_java_files.bp file by running:
// libcore/annotations/generate_annotated_java_files.py libcore/annotations/ojluni.jaif > libcore/annotated_java_files.bp
//
// For arrray syntax, please see https://checkerframework.org/jsr308/specification/java-annotation-design.html#array-syntax
// @Nullable String @NonNull[] <- Non-null array of nullable strings can be expressed as:
//
// type: @libcore.util.NonNull
// inner-type 0, 0: @libcore.util.Nullable
package libcore.util:
annotation @NonNull: @java.lang.annotation.Retention(value=SOURCE) @java.lang.annotation.Target(value={TYPE_USE})
int from
int to
annotation @Nullable: @java.lang.annotation.Retention(value=SOURCE) @java.lang.annotation.Target(value={TYPE_USE})
int from
int to
package java.lang:
class CharSequence:
// Always returns a string instance
method toString()Ljava/lang/String;:
return: @libcore.util.NonNull
class Enum:
// Always returns an instance or throws
method valueOf(Ljava/lang/Class;Ljava/lang/String;)Ljava/lang/Enum;:
return: @libcore.util.NonNull
class Iterable:
// Always returns an instance
method iterator()Ljava/util/Iterator;:
return: @libcore.util.NonNull
class String:
method <init>(Ljava/lang/String;)V:
parameter #0:
type: @libcore.util.NonNull
return:
method <init>([C)V:
parameter #0:
type: @libcore.util.NonNull
return:
method <init>([CII)V:
parameter #0:
type: @libcore.util.NonNull
return:
method <init>([III)V:
parameter #0:
type: @libcore.util.NonNull
return:
method <init>([BIII)V:
parameter #0:
type: @libcore.util.NonNull
return:
method <init>([BI)V:
parameter #0:
type: @libcore.util.NonNull
return:
method <init>([BIILjava/lang/String;)V:
parameter #0:
type: @libcore.util.NonNull
parameter #3:
type: @libcore.util.NonNull
return:
method <init>([BIILjava/nio/charset/Charset;)V:
parameter #0:
type: @libcore.util.NonNull
parameter #3:
type: @libcore.util.NonNull
return:
method <init>([BLjava/lang/String;)V:
parameter #0:
type: @libcore.util.NonNull
parameter #1:
type: @libcore.util.NonNull
return:
method <init>([BLjava/nio/charset/Charset;)V:
parameter #0:
type: @libcore.util.NonNull
parameter #1:
type: @libcore.util.NonNull
return:
method <init>([BII)V:
parameter #0:
type: @libcore.util.NonNull
return:
method <init>([B)V:
parameter #0:
type: @libcore.util.NonNull
return:
method <init>(Ljava/lang/StringBuffer;)V:
parameter #0:
type: @libcore.util.NonNull
return:
method <init>(Ljava/lang/StringBuilder;)V:
parameter #0:
type: @libcore.util.NonNull
return:
method <init>(II[C)V:
parameter #2:
type: @libcore.util.NonNull
return:
method getChars(II[CI)V:
parameter #2:
type: @libcore.util.NonNull
return:
// Always returns a string instance
method toString()Ljava/lang/String;:
return: @libcore.util.NonNull
method getBytes(II[BI)V:
parameter #2:
type: @libcore.util.NonNull
// Empty array in worst case
method getBytes(Ljava/lang/String;)[B:
parameter #0:
type: @libcore.util.NonNull
return: @libcore.util.NonNull
// Empty array in worst case
method getBytes(Ljava/nio/charset/Charset;)[B:
parameter #0:
type: @libcore.util.NonNull
return: @libcore.util.NonNull
// Empty array in worst case (or throws)
method getBytes(Ljava/lang/String;)[B:
parameter #0:
type: @libcore.util.NonNull
return: @libcore.util.NonNull
// Empty array in worst case
method getBytes()[B:
return: @libcore.util.NonNull
method equals(Ljava/lang/Object;)Z:
parameter #0:
type: @libcore.util.Nullable
// Empty array in worst case
method toCharArray()[C:
return: @libcore.util.NonNull
// Empty char sequence in worst case
method subSequence(II)Ljava/lang/CharSequence;:
return: @libcore.util.NonNull
// Always returns a string instance
method concat(Ljava/lang/String;)Ljava/lang/String;:
parameter #0:
type: @libcore.util.NonNull
return: @libcore.util.NonNull
// Always returns a string instance
method copyValueOf([CII)Ljava/lang/String;:
parameter #0:
type: @libcore.util.NonNull
return: @libcore.util.NonNull
// Always returns a string instance
method copyValueOf([C)Ljava/lang/String;:
parameter #0:
type: @libcore.util.NonNull
return: @libcore.util.NonNull
// Always returns a string instance
method intern()Ljava/lang/String;:
return: @libcore.util.NonNull
// Always returns a string instance
method replace(CC)Ljava/lang/String;:
return: @libcore.util.NonNull
// Always returns a string instance
method substring(I)Ljava/lang/String;:
return: @libcore.util.NonNull
// Always returns a string instance
method substring(II)Ljava/lang/String;:
return: @libcore.util.NonNull
// Always returns a string instance
method toLowerCase(Ljava/util/Locale;)Ljava/lang/String;:
parameter #0:
type: @libcore.util.NonNull
return: @libcore.util.NonNull
// Always returns a string instance
method toLowerCase()Ljava/lang/String;:
return: @libcore.util.NonNull
// Always returns a string instance
method toUpperCase(Ljava/util/Locale;)Ljava/lang/String;:
parameter #0:
type: @libcore.util.NonNull
return: @libcore.util.NonNull
// Always returns a string instance
method toUpperCase()Ljava/lang/String;:
return: @libcore.util.NonNull
// Always returns a string instance
method trim()Ljava/lang/String;:
return: @libcore.util.NonNull
// Always returns a string instance
method valueOf(Z)Ljava/lang/String;:
return: @libcore.util.NonNull
// Always returns a string instance
method valueOf(C)Ljava/lang/String;:
return: @libcore.util.NonNull
// Always returns a string instance
method valueOf(I)Ljava/lang/String;:
return: @libcore.util.NonNull
// Always returns a string instance
method valueOf(J)Ljava/lang/String;:
return: @libcore.util.NonNull
// Always returns a string instance
method valueOf(F)Ljava/lang/String;:
return: @libcore.util.NonNull
// Always returns a string instance
method valueOf(D)Ljava/lang/String;:
return: @libcore.util.NonNull
// Always returns a string instance
method valueOf(Ljava/lang/Object;)Ljava/lang/String;:
parameter #0:
type: @libcore.util.Nullable
return:@libcore.util.NonNull
// Always returns a string instance
method valueOf([C)Ljava/lang/String;:
parameter #0:
type: @libcore.util.NonNull
return: @libcore.util.NonNull
// Always returns a string instance
method valueOf([CII)Ljava/lang/String;:
parameter #0:
type: @libcore.util.NonNull
return: @libcore.util.NonNull
// Always returns a string instance
method split(Ljava/lang/String;I)[Ljava/lang/String;:
return: @libcore.util.NonNull
inner-type 0, 0: @libcore.util.NonNull
parameter #0:
type: @libcore.util.NonNull
// Always returns a string instance
method split(Ljava/lang/String;)[Ljava/lang/String;:
return: @libcore.util.NonNull
inner-type 0, 0: @libcore.util.NonNull
parameter #0:
type: @libcore.util.NonNull
// Always returns a string instance
method join(Ljava/lang/CharSequence;[Ljava/lang/CharSequence;)Ljava/lang/String;:
return: @libcore.util.NonNull
parameter #0:
type: @libcore.util.NonNull
parameter #1:
type: @libcore.util.NonNull
inner-type 0, 0: @libcore.util.Nullable
// Always returns a string instance
method join(Ljava/lang/CharSequence;Ljava/lang/Iterable;)Ljava/lang/String;:
parameter #0:
type: @libcore.util.NonNull
parameter #1:
type: @libcore.util.NonNull
inner-type 3, 0, 2, 0: @libcore.util.Nullable
return: @libcore.util.NonNull
// Always returns a string instance
method replaceAll(Ljava/lang/String;Ljava/lang/String;)Ljava/lang/String;:
parameter #0:
type: @libcore.util.NonNull
parameter #1:
type: @libcore.util.NonNull
return: @libcore.util.NonNull
// Always returns a string instance
method replaceFirst(Ljava/lang/String;Ljava/lang/String;)Ljava/lang/String;:
parameter #0:
type: @libcore.util.NonNull
parameter #1:
type: @libcore.util.NonNull
return: @libcore.util.NonNull
method replace(Ljava/lang/CharSequence;Ljava/lang/CharSequence;)Ljava/lang/String;:
parameter #0:
type: @libcore.util.NonNull
parameter #1:
type: @libcore.util.NonNull
return: @libcore.util.NonNull
method contentEquals(Ljava/lang/StringBuffer;)Z:
parameter #0:
type: @libcore.util.NonNull
method contentEquals(Ljava/lang/CharSequence;)Z:
parameter #0:
type: @libcore.util.NonNull
method equalsIgnoreCase(Ljava/lang/String;)Z:
parameter #0:
type: @libcore.util.Nullable
method compareTo(Ljava/lang/String;)I:
parameter #0:
type: @libcore.util.NonNull
method compareToIgnoreCase(Ljava/lang/String;)I:
parameter #0:
type: @libcore.util.NonNull
method regionMatches(ILjava/lang/String;II)Z:
parameter #1:
type: @libcore.util.NonNull
method regionMatches(ZILjava/lang/String;II)Z:
parameter #2:
type: @libcore.util.NonNull
method startsWith(Ljava/lang/String;I)Z:
parameter #0:
type: @libcore.util.NonNull
method startsWith(Ljava/lang/String;)Z:
parameter #0:
type: @libcore.util.NonNull
method endsWith(Ljava/lang/String;)Z:
parameter #0:
type: @libcore.util.NonNull
method indexOf(Ljava/lang/String;)I:
parameter #0:
type: @libcore.util.NonNull
method indexOf(Ljava/lang/String;I)I:
parameter #0:
type: @libcore.util.NonNull
method lastIndexOf(Ljava/lang/String;)I:
parameter #0:
type: @libcore.util.NonNull
method lastIndexOf(Ljava/lang/String;I)I:
parameter #0:
type: @libcore.util.NonNull
method matches(Ljava/lang/String;)Z:
parameter #0:
type: @libcore.util.NonNull
method contains(Ljava/lang/CharSequence;)Z:
parameter #0:
type: @libcore.util.NonNull
method format(Ljava/lang/String;[Ljava/lang/Object;)Ljava/lang/String;:
parameter #0:
type: @libcore.util.NonNull
parameter #1:
type: @libcore.util.NonNull
inner-type 0, 0: @libcore.util.Nullable
return: @libcore.util.NonNull
method format(Ljava/util/Locale;Ljava/lang/String;[Ljava/lang/Object;)Ljava/lang/String;:
parameter #0:
type: @libcore.util.NonNull
parameter #1:
type: @libcore.util.NonNull
parameter #2:
type: @libcore.util.NonNull
inner-type 0, 0: @libcore.util.Nullable
return: @libcore.util.NonNull
class Thread:
// Always returns a string instance
method toString()Ljava/lang/String;:
return: @libcore.util.NonNull
// Always return an instance
method currentThread()Ljava/lang/Thread;:
return: @libcore.util.NonNull
package java.lang.reflect:
class AccessibleObject:
// Empty array in the worst case
method getAnnotations()[Ljava/lang/annotation/Annotation;:
return: @libcore.util.NonNull
inner-type 0, 0: @libcore.util.NonNull
// Empty array in the worst case
method getDeclaredAnnotations()[Ljava/lang/annotation/Annotation;:
return: @libcore.util.NonNull
inner-type 0, 0: @libcore.util.NonNull
class AnnotatedElement:
// Empty array in the worst case
method getAnnotations()[Ljava/lang/annotation/Annotation;:
return: @libcore.util.NonNull
inner-type 0, 0: @libcore.util.NonNull
// Empty array in the worst case
method getDeclaredAnnotations()[Ljava/lang/annotation/Annotation;:
return: @libcore.util.NonNull
inner-type 0, 0: @libcore.util.NonNull
class Array:
// Returns instance or throws
method newInstance(Ljava/lang/Class;I)Ljava/lang/Object;:
return: @libcore.util.NonNull
// Returns instance or throws
method newInstance(Ljava/lang/Class;[I)Ljava/lang/Object;:
return: @libcore.util.NonNull
class Constructor:
// Always returns an instance
method toString()Ljava/lang/String;:
return: @libcore.util.NonNull
// Always returns an instance
method toGenericString()Ljava/lang/String;:
return: @libcore.util.NonNull
// Always returns an instance
method getName()Ljava/lang/String;:
return: @libcore.util.NonNull
// There's always a declaring class
method getDeclaringClass()Ljava/lang/Class;:
return: @libcore.util.NonNull
// Empty array in the worst case
method getParameterTypes()[Ljava/lang/Class;:
return: @libcore.util.NonNull
inner-type 0, 0: @libcore.util.NonNull
// Returns instance or throws
method newInstance([Ljava/lang/Object;)Ljava/lang/Object;:
return: @libcore.util.NonNull
class Executable:
// There's always a declaring class
method getDeclaringClass()Ljava/lang/Class;:
return: @libcore.util.NonNull
// Always returns an instance
method getName()Ljava/lang/String;:
return: @libcore.util.NonNull
// Empty array in the worst case
method getParameterTypes()[Ljava/lang/Class;:
return: @libcore.util.NonNull
inner-type 0, 0: @libcore.util.NonNull
// Empty array in the worst case
method getTypeParameters()[Ljava/lang/reflect/TypeVariable;:
return: @libcore.util.NonNull
inner-type 0, 0: @libcore.util.NonNull
// Empty array in the worst case
method getGenericParameterTypes()[Ljava/lang/reflect/Type;:
return: @libcore.util.NonNull
inner-type 0, 0: @libcore.util.NonNull
// Empty array in the worst case
method getParameters()[Ljava/lang/reflect/Parameter;:
return: @libcore.util.NonNull
inner-type 0, 0: @libcore.util.NonNull
// Empty array in the worst case
method getExceptionTypes()[Ljava/lang/Class;:
return: @libcore.util.NonNull
inner-type 0, 0: @libcore.util.NonNull
// Empty array in the worst case
method getGenericExceptionTypes()[Ljava/lang/reflect/Type;:
return: @libcore.util.NonNull
inner-type 0, 0: @libcore.util.NonNull
// Always returns an instance
method toGenericString()Ljava/lang/String;:
return: @libcore.util.NonNull
// Empty array in the worst case
method getDeclaredAnnotations()[Ljava/lang/annotation/Annotation;:
return: @libcore.util.NonNull
inner-type 0, 0: @libcore.util.NonNull
// Empty array in the worst case
method getParameterAnnotations()[[Ljava/lang/annotation/Annotation;:
return: @libcore.util.NonNull
inner-type 0, 0: @libcore.util.NonNull
inner-type 0, 0, 0, 0: @libcore.util.NonNull
class Field:
// Always returns an instance
method getName()Ljava/lang/String;:
return: @libcore.util.NonNull
// There's always a type of a field
method getType()Ljava/lang/Class;:
return: @libcore.util.NonNull
// Always returns an instance
method toString()Ljava/lang/String;:
return: @libcore.util.NonNull
// Always returns an instance
method toGenericString()Ljava/lang/String;:
return: @libcore.util.NonNull
class GenericArrayType:
// There's always a type for array
method getGenericComponentType()Ljava/lang/reflect/Type;:
return: @libcore.util.NonNull
class GenericDeclaration:
// Empty array in the worst case
method getTypeParameters()[Ljava/lang/reflect/TypeVariable;:
return: @libcore.util.NonNull
inner-type 0, 0: @libcore.util.NonNull
class Member:
method getDeclaringClass()Ljava/lang/Class;:
return: @libcore.util.NonNull
// Always returns an instance
method getName()Ljava/lang/String;:
return: @libcore.util.NonNull
class Method:
// There's always a declaring class
method getDeclaringClass()Ljava/lang/Class;:
return: @libcore.util.NonNull
// Empty array in the worst case
method getTypeParameters()[Ljava/lang/reflect/TypeVariable;:
return: @libcore.util.NonNull
inner-type 0, 0: @libcore.util.NonNull
// There's always a return type (such as Void.class)
method getReturnType()Ljava/lang/Class;:
return: @libcore.util.NonNull
// There's always a return type (such as Void.class)
method getGenericReturnType()Ljava/lang/reflect/Type;:
return: @libcore.util.NonNull
// Empty array in the worst case
method getParameterTypes()[Ljava/lang/Class;:
return: @libcore.util.NonNull
inner-type 0, 0: @libcore.util.NonNull
// Empty array in the worst case
method getGenericParameterTypes()[Ljava/lang/reflect/Type;:
return: @libcore.util.NonNull
inner-type 0, 0: @libcore.util.NonNull
// Empty array in the worst case
method getExceptionTypes()[Ljava/lang/Class;:
return: @libcore.util.NonNull
inner-type 0, 0: @libcore.util.NonNull
// Empty array in the worst case
method getGenericExceptionTypes()[Ljava/lang/reflect/Type;:
return: @libcore.util.NonNull
inner-type 0, 0: @libcore.util.NonNull
// Always returns an instance
method toString()Ljava/lang/String;:
return: @libcore.util.NonNull
// Always returns an instance
method toGenericString()Ljava/lang/String;:
return: @libcore.util.NonNull
// Empty array in the worst case
method getDeclaredAnnotations()[Ljava/lang/annotation/Annotation;:
return: @libcore.util.NonNull
inner-type 0, 0: @libcore.util.NonNull
// Empty array in the worst case
method getParameterAnnotations()[[Ljava/lang/annotation/Annotation;:
return: @libcore.util.NonNull
inner-type 0, 0: @libcore.util.NonNull
inner-type 0, 0, 0, 0: @libcore.util.NonNull
class ParameterizedType:
// Empty array in the worst case
method getActualTypeArguments()[Ljava/lang/reflect/Type;:
return: @libcore.util.NonNull
inner-type 0, 0: @libcore.util.NonNull
// Always returns an instance
method getRawType()Ljava/lang/reflect/Type;:
return: @libcore.util.NonNull
class Parameter:
// Always returns an instance
method toString()Ljava/lang/String;:
return: @libcore.util.NonNull
// There's always a declaring executable
method getDeclaringExecutable()Ljava/lang/reflect/Executable;:
return: @libcore.util.NonNull
// Always returns an instance
method getRealName()Ljava/lang/String;:
return: @libcore.util.NonNull
// There's always a type
method getParameterizedType()Ljava/lang/reflect/Type;:
return: @libcore.util.NonNull
// There's always a type
method getType()Ljava/lang/Class;:
return: @libcore.util.NonNull
// Empty array in the worst case
method getDeclaredAnnotations()[Ljava/lang/annotation/Annotation;:
return: @libcore.util.NonNull
inner-type 0, 0: @libcore.util.NonNull
// Empty array in the worst case
method getAnnotations()[Ljava/lang/annotation/Annotation;:
return: @libcore.util.NonNull
inner-type 0, 0: @libcore.util.NonNull
class Proxy:
// Always returns an instance (or throws)
method getProxyClass(Ljava/lang/ClassLoader;[Ljava/lang/Class;)Ljava/lang/Class;:
return: @libcore.util.NonNull
// Always returns an instance (or throws)
method newProxyInstance(Ljava/lang/ClassLoader;[Ljava/lang/Class;Ljava/lang/reflect/InvocationHandler;)Ljava/lang/Object;:
return: @libcore.util.NonNull
// Always returns an instance (or throws)
method getInvocationHandler(Ljava/lang/Object;)Ljava/lang/reflect/InvocationHandler;:
return: @libcore.util.NonNull
class Type:
// Always returns an instance
method getTypeName()Ljava/lang/String;:
return: @libcore.util.NonNull
class TypeVariable:
// Empty array in the worst case
method getBounds()[Ljava/lang/reflect/Type;:
return: @libcore.util.NonNull
inner-type 0, 0: @libcore.util.NonNull
// Always returns an instance
method getGenericDeclaration()Ljava/lang/reflect/GenericDeclaration;:
return: @libcore.util.NonNull
// Always returns an instance
method getName()Ljava/lang/String;:
return: @libcore.util.NonNull
class WildcardType:
// Empty array in the worst case
method getUpperBounds()[Ljava/lang/reflect/Type;:
return: @libcore.util.NonNull
inner-type 0, 0: @libcore.util.NonNull
// Empty array in the worst case
method getLowerBounds()[Ljava/lang/reflect/Type;:
return: @libcore.util.NonNull
inner-type 0, 0: @libcore.util.NonNull