Update keep anno Kotlin generation
Use Any::class on place of Object::class.
Bug: b/392865072
Change-Id: Ibb2fb128e725dbe5de35642f75cb6eaad05baa36
diff --git a/src/keepanno/java/androidx/annotation/keep/AnnotationPattern.kt b/src/keepanno/java/androidx/annotation/keep/AnnotationPattern.kt
index 9ff9f61..389c5d6 100644
--- a/src/keepanno/java/androidx/annotation/keep/AnnotationPattern.kt
+++ b/src/keepanno/java/androidx/annotation/keep/AnnotationPattern.kt
@@ -72,7 +72,7 @@
*
* @return The Class constant that defines the annotation.
*/
- val constant: KClass<*> = Object::class,
+ val constant: KClass<*> = Any::class,
/**
* Define the annotation-name pattern by reference to a class-name pattern.
diff --git a/src/keepanno/java/androidx/annotation/keep/ClassNamePattern.kt b/src/keepanno/java/androidx/annotation/keep/ClassNamePattern.kt
index b5c312c..4abf83c 100644
--- a/src/keepanno/java/androidx/annotation/keep/ClassNamePattern.kt
+++ b/src/keepanno/java/androidx/annotation/keep/ClassNamePattern.kt
@@ -68,7 +68,7 @@
*
* @return The class-constant that defines the class.
*/
- val constant: KClass<*> = Object::class,
+ val constant: KClass<*> = Any::class,
/**
* Exact and unqualified name of the class or interface.
diff --git a/src/keepanno/java/androidx/annotation/keep/KeepBinding.kt b/src/keepanno/java/androidx/annotation/keep/KeepBinding.kt
index aa8de9a..526d374 100644
--- a/src/keepanno/java/androidx/annotation/keep/KeepBinding.kt
+++ b/src/keepanno/java/androidx/annotation/keep/KeepBinding.kt
@@ -142,7 +142,7 @@
*
* @return The class-constant that defines the class.
*/
- val classConstant: KClass<*> = Object::class,
+ val classConstant: KClass<*> = Any::class,
/**
* Define the class-name pattern by reference to a class-name pattern.
@@ -226,7 +226,7 @@
*
* @return The class constant that defines what instance-of the class must be.
*/
- val instanceOfClassConstant: KClass<*> = Object::class,
+ val instanceOfClassConstant: KClass<*> = Any::class,
/**
* Define the instance-of pattern as classes that are instances the referenced Class constant.
@@ -250,7 +250,7 @@
*
* @return The class constant that defines what instance-of the class must be.
*/
- val instanceOfClassConstantExclusive: KClass<*> = Object::class,
+ val instanceOfClassConstantExclusive: KClass<*> = Any::class,
/**
* Define the instance-of with a pattern.
@@ -308,7 +308,7 @@
*
* @return The class-constant that defines the annotation.
*/
- val classAnnotatedByClassConstant: KClass<*> = Object::class,
+ val classAnnotatedByClassConstant: KClass<*> = Any::class,
/**
* Define the class-annotated-by pattern by reference to a class-name pattern.
@@ -371,7 +371,7 @@
*
* @return The class-constant that defines the annotation.
*/
- val memberAnnotatedByClassConstant: KClass<*> = Object::class,
+ val memberAnnotatedByClassConstant: KClass<*> = Any::class,
/**
* Define the member-annotated-by pattern by reference to a class-name pattern.
@@ -447,7 +447,7 @@
*
* @return The class-constant that defines the annotation.
*/
- val methodAnnotatedByClassConstant: KClass<*> = Object::class,
+ val methodAnnotatedByClassConstant: KClass<*> = Any::class,
/**
* Define the method-annotated-by pattern by reference to a class-name pattern.
@@ -559,7 +559,7 @@
*
* @return A class constant denoting the type of the method return type.
*/
- val methodReturnTypeConstant: KClass<*> = Object::class,
+ val methodReturnTypeConstant: KClass<*> = Any::class,
/**
* Define the method return-type pattern by a type pattern.
@@ -656,7 +656,7 @@
*
* @return The class-constant that defines the annotation.
*/
- val fieldAnnotatedByClassConstant: KClass<*> = Object::class,
+ val fieldAnnotatedByClassConstant: KClass<*> = Any::class,
/**
* Define the field-annotated-by pattern by reference to a class-name pattern.
@@ -765,7 +765,7 @@
*
* @return The class constant for the field type.
*/
- val fieldTypeConstant: KClass<*> = Object::class,
+ val fieldTypeConstant: KClass<*> = Any::class,
/**
* Define the field-type pattern by a pattern on types.
diff --git a/src/keepanno/java/androidx/annotation/keep/KeepCondition.kt b/src/keepanno/java/androidx/annotation/keep/KeepCondition.kt
index 58a127e..f64cc7f 100644
--- a/src/keepanno/java/androidx/annotation/keep/KeepCondition.kt
+++ b/src/keepanno/java/androidx/annotation/keep/KeepCondition.kt
@@ -103,7 +103,7 @@
*
* @return The class-constant that defines the class.
*/
- val classConstant: KClass<*> = Object::class,
+ val classConstant: KClass<*> = Any::class,
/**
* Define the class-name pattern by reference to a class-name pattern.
@@ -187,7 +187,7 @@
*
* @return The class constant that defines what instance-of the class must be.
*/
- val instanceOfClassConstant: KClass<*> = Object::class,
+ val instanceOfClassConstant: KClass<*> = Any::class,
/**
* Define the instance-of pattern as classes that are instances the referenced Class constant.
@@ -211,7 +211,7 @@
*
* @return The class constant that defines what instance-of the class must be.
*/
- val instanceOfClassConstantExclusive: KClass<*> = Object::class,
+ val instanceOfClassConstantExclusive: KClass<*> = Any::class,
/**
* Define the instance-of with a pattern.
@@ -269,7 +269,7 @@
*
* @return The class-constant that defines the annotation.
*/
- val classAnnotatedByClassConstant: KClass<*> = Object::class,
+ val classAnnotatedByClassConstant: KClass<*> = Any::class,
/**
* Define the class-annotated-by pattern by reference to a class-name pattern.
@@ -345,7 +345,7 @@
*
* @return The class-constant that defines the annotation.
*/
- val memberAnnotatedByClassConstant: KClass<*> = Object::class,
+ val memberAnnotatedByClassConstant: KClass<*> = Any::class,
/**
* Define the member-annotated-by pattern by reference to a class-name pattern.
@@ -427,7 +427,7 @@
*
* @return The class-constant that defines the annotation.
*/
- val methodAnnotatedByClassConstant: KClass<*> = Object::class,
+ val methodAnnotatedByClassConstant: KClass<*> = Any::class,
/**
* Define the method-annotated-by pattern by reference to a class-name pattern.
@@ -553,7 +553,7 @@
*
* @return A class constant denoting the type of the method return type.
*/
- val methodReturnTypeConstant: KClass<*> = Object::class,
+ val methodReturnTypeConstant: KClass<*> = Any::class,
/**
* Define the method return-type pattern by a type pattern.
@@ -661,7 +661,7 @@
*
* @return The class-constant that defines the annotation.
*/
- val fieldAnnotatedByClassConstant: KClass<*> = Object::class,
+ val fieldAnnotatedByClassConstant: KClass<*> = Any::class,
/**
* Define the field-annotated-by pattern by reference to a class-name pattern.
@@ -784,7 +784,7 @@
*
* @return The class constant for the field type.
*/
- val fieldTypeConstant: KClass<*> = Object::class,
+ val fieldTypeConstant: KClass<*> = Any::class,
/**
* Define the field-type pattern by a pattern on types.
diff --git a/src/keepanno/java/androidx/annotation/keep/KeepForApi.kt b/src/keepanno/java/androidx/annotation/keep/KeepForApi.kt
index 1c27695..aa8f2fe 100644
--- a/src/keepanno/java/androidx/annotation/keep/KeepForApi.kt
+++ b/src/keepanno/java/androidx/annotation/keep/KeepForApi.kt
@@ -124,7 +124,7 @@
*
* @return The class-constant that defines the annotation.
*/
- val memberAnnotatedByClassConstant: KClass<*> = Object::class,
+ val memberAnnotatedByClassConstant: KClass<*> = Any::class,
/**
* Define the member-annotated-by pattern by reference to a class-name pattern.
@@ -200,7 +200,7 @@
*
* @return The class-constant that defines the annotation.
*/
- val methodAnnotatedByClassConstant: KClass<*> = Object::class,
+ val methodAnnotatedByClassConstant: KClass<*> = Any::class,
/**
* Define the method-annotated-by pattern by reference to a class-name pattern.
@@ -312,7 +312,7 @@
*
* @return A class constant denoting the type of the method return type.
*/
- val methodReturnTypeConstant: KClass<*> = Object::class,
+ val methodReturnTypeConstant: KClass<*> = Any::class,
/**
* Define the method return-type pattern by a type pattern.
@@ -409,7 +409,7 @@
*
* @return The class-constant that defines the annotation.
*/
- val fieldAnnotatedByClassConstant: KClass<*> = Object::class,
+ val fieldAnnotatedByClassConstant: KClass<*> = Any::class,
/**
* Define the field-annotated-by pattern by reference to a class-name pattern.
@@ -518,7 +518,7 @@
*
* @return The class constant for the field type.
*/
- val fieldTypeConstant: KClass<*> = Object::class,
+ val fieldTypeConstant: KClass<*> = Any::class,
/**
* Define the field-type pattern by a pattern on types.
diff --git a/src/keepanno/java/androidx/annotation/keep/KeepTarget.kt b/src/keepanno/java/androidx/annotation/keep/KeepTarget.kt
index c86993f..d8a5926 100644
--- a/src/keepanno/java/androidx/annotation/keep/KeepTarget.kt
+++ b/src/keepanno/java/androidx/annotation/keep/KeepTarget.kt
@@ -208,7 +208,7 @@
*
* @return The class-constant that defines the class.
*/
- val classConstant: KClass<*> = Object::class,
+ val classConstant: KClass<*> = Any::class,
/**
* Define the class-name pattern by reference to a class-name pattern.
@@ -292,7 +292,7 @@
*
* @return The class constant that defines what instance-of the class must be.
*/
- val instanceOfClassConstant: KClass<*> = Object::class,
+ val instanceOfClassConstant: KClass<*> = Any::class,
/**
* Define the instance-of pattern as classes that are instances the referenced Class constant.
@@ -316,7 +316,7 @@
*
* @return The class constant that defines what instance-of the class must be.
*/
- val instanceOfClassConstantExclusive: KClass<*> = Object::class,
+ val instanceOfClassConstantExclusive: KClass<*> = Any::class,
/**
* Define the instance-of with a pattern.
@@ -374,7 +374,7 @@
*
* @return The class-constant that defines the annotation.
*/
- val classAnnotatedByClassConstant: KClass<*> = Object::class,
+ val classAnnotatedByClassConstant: KClass<*> = Any::class,
/**
* Define the class-annotated-by pattern by reference to a class-name pattern.
@@ -450,7 +450,7 @@
*
* @return The class-constant that defines the annotation.
*/
- val memberAnnotatedByClassConstant: KClass<*> = Object::class,
+ val memberAnnotatedByClassConstant: KClass<*> = Any::class,
/**
* Define the member-annotated-by pattern by reference to a class-name pattern.
@@ -532,7 +532,7 @@
*
* @return The class-constant that defines the annotation.
*/
- val methodAnnotatedByClassConstant: KClass<*> = Object::class,
+ val methodAnnotatedByClassConstant: KClass<*> = Any::class,
/**
* Define the method-annotated-by pattern by reference to a class-name pattern.
@@ -658,7 +658,7 @@
*
* @return A class constant denoting the type of the method return type.
*/
- val methodReturnTypeConstant: KClass<*> = Object::class,
+ val methodReturnTypeConstant: KClass<*> = Any::class,
/**
* Define the method return-type pattern by a type pattern.
@@ -766,7 +766,7 @@
*
* @return The class-constant that defines the annotation.
*/
- val fieldAnnotatedByClassConstant: KClass<*> = Object::class,
+ val fieldAnnotatedByClassConstant: KClass<*> = Any::class,
/**
* Define the field-annotated-by pattern by reference to a class-name pattern.
@@ -889,7 +889,7 @@
*
* @return The class constant for the field type.
*/
- val fieldTypeConstant: KClass<*> = Object::class,
+ val fieldTypeConstant: KClass<*> = Any::class,
/**
* Define the field-type pattern by a pattern on types.
diff --git a/src/keepanno/java/androidx/annotation/keep/TypePattern.kt b/src/keepanno/java/androidx/annotation/keep/TypePattern.kt
index 6f9b9ee..3d9c032 100644
--- a/src/keepanno/java/androidx/annotation/keep/TypePattern.kt
+++ b/src/keepanno/java/androidx/annotation/keep/TypePattern.kt
@@ -71,7 +71,7 @@
* <li>instanceOfPattern
* </ul>
*/
- val constant: KClass<*> = Object::class,
+ val constant: KClass<*> = Any::class,
/**
* Classes matching the class-name pattern.
diff --git a/src/keepanno/java/androidx/annotation/keep/UsedByNative.kt b/src/keepanno/java/androidx/annotation/keep/UsedByNative.kt
index 9c170e0..668c549 100644
--- a/src/keepanno/java/androidx/annotation/keep/UsedByNative.kt
+++ b/src/keepanno/java/androidx/annotation/keep/UsedByNative.kt
@@ -225,7 +225,7 @@
*
* @return The class-constant that defines the annotation.
*/
- val memberAnnotatedByClassConstant: KClass<*> = Object::class,
+ val memberAnnotatedByClassConstant: KClass<*> = Any::class,
/**
* Define the member-annotated-by pattern by reference to a class-name pattern.
@@ -301,7 +301,7 @@
*
* @return The class-constant that defines the annotation.
*/
- val methodAnnotatedByClassConstant: KClass<*> = Object::class,
+ val methodAnnotatedByClassConstant: KClass<*> = Any::class,
/**
* Define the method-annotated-by pattern by reference to a class-name pattern.
@@ -413,7 +413,7 @@
*
* @return A class constant denoting the type of the method return type.
*/
- val methodReturnTypeConstant: KClass<*> = Object::class,
+ val methodReturnTypeConstant: KClass<*> = Any::class,
/**
* Define the method return-type pattern by a type pattern.
@@ -510,7 +510,7 @@
*
* @return The class-constant that defines the annotation.
*/
- val fieldAnnotatedByClassConstant: KClass<*> = Object::class,
+ val fieldAnnotatedByClassConstant: KClass<*> = Any::class,
/**
* Define the field-annotated-by pattern by reference to a class-name pattern.
@@ -619,7 +619,7 @@
*
* @return The class constant for the field type.
*/
- val fieldTypeConstant: KClass<*> = Object::class,
+ val fieldTypeConstant: KClass<*> = Any::class,
/**
* Define the field-type pattern by a pattern on types.
diff --git a/src/keepanno/java/androidx/annotation/keep/UsedByReflection.kt b/src/keepanno/java/androidx/annotation/keep/UsedByReflection.kt
index c617f77..6d29600d 100644
--- a/src/keepanno/java/androidx/annotation/keep/UsedByReflection.kt
+++ b/src/keepanno/java/androidx/annotation/keep/UsedByReflection.kt
@@ -225,7 +225,7 @@
*
* @return The class-constant that defines the annotation.
*/
- val memberAnnotatedByClassConstant: KClass<*> = Object::class,
+ val memberAnnotatedByClassConstant: KClass<*> = Any::class,
/**
* Define the member-annotated-by pattern by reference to a class-name pattern.
@@ -301,7 +301,7 @@
*
* @return The class-constant that defines the annotation.
*/
- val methodAnnotatedByClassConstant: KClass<*> = Object::class,
+ val methodAnnotatedByClassConstant: KClass<*> = Any::class,
/**
* Define the method-annotated-by pattern by reference to a class-name pattern.
@@ -413,7 +413,7 @@
*
* @return A class constant denoting the type of the method return type.
*/
- val methodReturnTypeConstant: KClass<*> = Object::class,
+ val methodReturnTypeConstant: KClass<*> = Any::class,
/**
* Define the method return-type pattern by a type pattern.
@@ -510,7 +510,7 @@
*
* @return The class-constant that defines the annotation.
*/
- val fieldAnnotatedByClassConstant: KClass<*> = Object::class,
+ val fieldAnnotatedByClassConstant: KClass<*> = Any::class,
/**
* Define the field-annotated-by pattern by reference to a class-name pattern.
@@ -619,7 +619,7 @@
*
* @return The class constant for the field type.
*/
- val fieldTypeConstant: KClass<*> = Object::class,
+ val fieldTypeConstant: KClass<*> = Any::class,
/**
* Define the field-type pattern by a pattern on types.
diff --git a/src/test/java/com/android/tools/r8/keepanno/utils/KeepItemAnnotationGenerator.java b/src/test/java/com/android/tools/r8/keepanno/utils/KeepItemAnnotationGenerator.java
index 2f9423a..c9c382c 100644
--- a/src/test/java/com/android/tools/r8/keepanno/utils/KeepItemAnnotationGenerator.java
+++ b/src/test/java/com/android/tools/r8/keepanno/utils/KeepItemAnnotationGenerator.java
@@ -190,7 +190,7 @@
private String kotlinValueDefault() {
if (valueDefault != null) {
if (valueDefault.equals("Object.class")) {
- return "Object::class";
+ return "Any::class";
}
if (valueDefault.startsWith("{") && valueDefault.endsWith("}")) {
return "[" + valueDefault.substring(1, valueDefault.length() - 1) + "]";