1 /*
2  * Copyright (C) 2023 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 com.android.tools.metalava.model
18 
19 const val JAVA_ENUM_VALUES = "values"
20 const val JAVA_ENUM_VALUE_OF = "valueOf"
21 
22 const val JAVA_LANG_PREFIX = "java.lang."
23 
24 const val JAVA_LANG_ANNOTATION = "java.lang.annotation.Annotation"
25 const val JAVA_LANG_DEPRECATED = "java.lang.Deprecated"
26 const val JAVA_LANG_ENUM = "java.lang.Enum"
27 const val JAVA_LANG_OBJECT = "java.lang.Object"
28 const val JAVA_LANG_STRING = "java.lang.String"
29 const val JAVA_LANG_THROWABLE = "java.lang.Throwable"
30 
31 const val JAVA_LANG_ANNOTATION_TARGET = "java.lang.annotation.Target"
32 const val JAVA_LANG_TYPE_USE_TARGET = "java.lang.annotation.ElementType.TYPE_USE"
33 const val JAVA_LANG_METHOD_TARGET = "java.lang.annotation.ElementType.METHOD"
34 const val JAVA_LANG_FIELD_TARGET = "java.lang.annotation.ElementType.FIELD"
35 const val JAVA_LANG_PARAMETER_TARGET = "java.lang.annotation.ElementType.PARAMETER"
36 
37 const val JAVA_RETENTION = "java.lang.annotation.Retention"
38 const val KT_RETENTION = "kotlin.annotation.Retention"
39 
40 /** True if the annotation name represents @Retention (either the Java or Kotlin version) */
isRetentionnull41 fun isRetention(qualifiedName: String?): Boolean =
42     JAVA_RETENTION == qualifiedName || KT_RETENTION == qualifiedName
43