Change the keep annotations in the androidx namespace to Kotlin source

Bug: b/392865072

Change-Id: I2df023091929792b5f89b1661a94a05c54b73b5f
diff --git a/src/keepanno/java/androidx/annotation/keep/AnnotationPattern.java b/src/keepanno/java/androidx/annotation/keep/AnnotationPattern.java
deleted file mode 100644
index aac8b68..0000000
--- a/src/keepanno/java/androidx/annotation/keep/AnnotationPattern.java
+++ /dev/null
@@ -1,98 +0,0 @@
-/*
- * Copyright 2025 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.
- */
-
-// ***********************************************************************************
-// GENERATED FILE. DO NOT EDIT! See KeepItemAnnotationGenerator.java.
-// ***********************************************************************************
-
-// ***********************************************************************************
-// MAINTAINED AND TESTED IN THE R8 REPO. PLEASE MAKE CHANGES THERE AND REPLICATE.
-// ***********************************************************************************
-
-package androidx.annotation.keep;
-
-import java.lang.annotation.ElementType;
-import java.lang.annotation.Retention;
-import java.lang.annotation.RetentionPolicy;
-import java.lang.annotation.Target;
-
-/**
- * A pattern structure for matching annotations.
- *
- * <p>If no properties are set, the default pattern matches any annotation with a runtime retention
- * policy.
- */
-@Target(ElementType.ANNOTATION_TYPE)
-@Retention(RetentionPolicy.CLASS)
-public @interface AnnotationPattern {
-
-  /**
-   * Define the annotation-name pattern by fully qualified class name.
-   *
-   * <p>Mutually exclusive with the following other properties defining annotation-name:
-   *
-   * <ul>
-   *   <li>constant
-   *   <li>namePattern
-   * </ul>
-   *
-   * <p>If none are specified the default is to match any annotation name.
-   *
-   * @return The qualified class name that defines the annotation.
-   */
-  String name() default "";
-
-  /**
-   * Define the annotation-name pattern by reference to a {@code Class} constant.
-   *
-   * <p>Mutually exclusive with the following other properties defining annotation-name:
-   *
-   * <ul>
-   *   <li>name
-   *   <li>namePattern
-   * </ul>
-   *
-   * <p>If none are specified the default is to match any annotation name.
-   *
-   * @return The Class constant that defines the annotation.
-   */
-  Class<?> constant() default Object.class;
-
-  /**
-   * Define the annotation-name pattern by reference to a class-name pattern.
-   *
-   * <p>Mutually exclusive with the following other properties defining annotation-name:
-   *
-   * <ul>
-   *   <li>name
-   *   <li>constant
-   * </ul>
-   *
-   * <p>If none are specified the default is to match any annotation name.
-   *
-   * @return The class-name pattern that defines the annotation.
-   */
-  ClassNamePattern namePattern() default @ClassNamePattern(unqualifiedName = "");
-
-  /**
-   * Specify which retention policies must be set for the annotations.
-   *
-   * <p>Matches annotations with matching retention policies
-   *
-   * @return Retention policies. By default {@code RetentionPolicy.RUNTIME}.
-   */
-  RetentionPolicy[] retention() default {RetentionPolicy.RUNTIME};
-}
diff --git a/src/keepanno/java/androidx/annotation/keep/AnnotationPattern.kt b/src/keepanno/java/androidx/annotation/keep/AnnotationPattern.kt
new file mode 100644
index 0000000..f8f1e97
--- /dev/null
+++ b/src/keepanno/java/androidx/annotation/keep/AnnotationPattern.kt
@@ -0,0 +1,103 @@
+/*
+ * Copyright 2025 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.
+ */
+
+// ***********************************************************************************
+// GENERATED FILE. DO NOT EDIT! See KeepItemAnnotationGenerator.java.
+// ***********************************************************************************
+
+// ***********************************************************************************
+// MAINTAINED AND TESTED IN THE R8 REPO. PLEASE MAKE CHANGES THERE AND REPLICATE.
+// ***********************************************************************************
+
+package androidx.annotation.keep
+
+import java.lang.annotation.RetentionPolicy
+import kotlin.annotation.Retention
+import kotlin.annotation.Target
+import kotlin.reflect.KClass
+
+/**
+ * A pattern structure for matching annotations.
+ *
+ * <p>
+ * If no properties are set, the default pattern matches any annotation with a runtime retention
+ * policy.
+ */
+@Retention(AnnotationRetention.BINARY)
+@Target(AnnotationTarget.ANNOTATION_CLASS)
+annotation class AnnotationPattern(
+
+  /**
+   * Define the annotation-name pattern by fully qualified class name.
+   *
+   * <p>
+   * Mutually exclusive with the following other properties defining annotation-name:
+   * <ul>
+   * <li>constant
+   * <li>namePattern
+   * </ul>
+   *
+   * <p>
+   * If none are specified the default is to match any annotation name.
+   *
+   * @return The qualified class name that defines the annotation.
+   */
+  val name: String = "",
+
+  /**
+   * Define the annotation-name pattern by reference to a {@code Class} constant.
+   *
+   * <p>
+   * Mutually exclusive with the following other properties defining annotation-name:
+   * <ul>
+   * <li>name
+   * <li>namePattern
+   * </ul>
+   *
+   * <p>
+   * If none are specified the default is to match any annotation name.
+   *
+   * @return The Class constant that defines the annotation.
+   */
+  val constant: KClass<*> = Object::class,
+
+  /**
+   * Define the annotation-name pattern by reference to a class-name pattern.
+   *
+   * <p>
+   * Mutually exclusive with the following other properties defining annotation-name:
+   * <ul>
+   * <li>name
+   * <li>constant
+   * </ul>
+   *
+   * <p>
+   * If none are specified the default is to match any annotation name.
+   *
+   * @return The class-name pattern that defines the annotation.
+   */
+  val namePattern: ClassNamePattern = ClassNamePattern(unqualifiedName = ""),
+
+  /**
+   * Specify which retention policies must be set for the annotations.
+   *
+   * <p>
+   * Matches annotations with matching retention policies
+   *
+   * @return Retention policies. By default {@code RetentionPolicy.RUNTIME}.
+   */
+  val retention: Array<RetentionPolicy> = [RetentionPolicy.RUNTIME],
+)
diff --git a/src/keepanno/java/androidx/annotation/keep/CheckOptimizedOut.java b/src/keepanno/java/androidx/annotation/keep/CheckOptimizedOut.kt
similarity index 80%
rename from src/keepanno/java/androidx/annotation/keep/CheckOptimizedOut.java
rename to src/keepanno/java/androidx/annotation/keep/CheckOptimizedOut.kt
index 122ed7e..c85f0ea 100644
--- a/src/keepanno/java/androidx/annotation/keep/CheckOptimizedOut.java
+++ b/src/keepanno/java/androidx/annotation/keep/CheckOptimizedOut.kt
@@ -18,12 +18,10 @@
 // MAINTAINED AND TESTED IN THE R8 REPO. PLEASE MAKE CHANGES THERE AND REPLICATE.
 // ***********************************************************************************
 
-package androidx.annotation.keep;
+package androidx.annotation.keep
 
-import java.lang.annotation.ElementType;
-import java.lang.annotation.Retention;
-import java.lang.annotation.RetentionPolicy;
-import java.lang.annotation.Target;
+import kotlin.annotation.Retention
+import kotlin.annotation.Target
 
 /**
  * Mark that an item must be optimized out of the residual program.
@@ -38,9 +36,11 @@
  * inlining vs merging, the use of this annotation is somewhat unreliable and should be used with
  * caution. In most cases it is more appropriate to use {@link CheckRemoved}.
  */
-@Target({ElementType.TYPE, ElementType.FIELD, ElementType.METHOD, ElementType.CONSTRUCTOR})
-@Retention(RetentionPolicy.CLASS)
-public @interface CheckOptimizedOut {
-
-  String description() default "";
-}
+@Retention(AnnotationRetention.BINARY)
+@Target(
+  AnnotationTarget.TYPE,
+  AnnotationTarget.FIELD,
+  AnnotationTarget.FUNCTION,
+  AnnotationTarget.CONSTRUCTOR,
+)
+annotation class CheckOptimizedOut(val description: String = "")
diff --git a/src/keepanno/java/androidx/annotation/keep/CheckRemoved.java b/src/keepanno/java/androidx/annotation/keep/CheckRemoved.kt
similarity index 76%
rename from src/keepanno/java/androidx/annotation/keep/CheckRemoved.java
rename to src/keepanno/java/androidx/annotation/keep/CheckRemoved.kt
index 20d2d5d..0be0daa 100644
--- a/src/keepanno/java/androidx/annotation/keep/CheckRemoved.java
+++ b/src/keepanno/java/androidx/annotation/keep/CheckRemoved.kt
@@ -18,12 +18,10 @@
 // MAINTAINED AND TESTED IN THE R8 REPO. PLEASE MAKE CHANGES THERE AND REPLICATE.
 // ***********************************************************************************
 
-package androidx.annotation.keep;
+package androidx.annotation.keep
 
-import java.lang.annotation.ElementType;
-import java.lang.annotation.Retention;
-import java.lang.annotation.RetentionPolicy;
-import java.lang.annotation.Target;
+import kotlin.annotation.Retention
+import kotlin.annotation.Target
 
 /**
  * Mark that an item must be fully removed from the residual program.
@@ -34,9 +32,11 @@
  *
  * <p>A class is removed if all of its members are removed and no references to the class remain.
  */
-@Target({ElementType.TYPE, ElementType.FIELD, ElementType.METHOD, ElementType.CONSTRUCTOR})
-@Retention(RetentionPolicy.CLASS)
-public @interface CheckRemoved {
-
-  String description() default "";
-}
+@Retention(AnnotationRetention.BINARY)
+@Target(
+  AnnotationTarget.TYPE,
+  AnnotationTarget.FIELD,
+  AnnotationTarget.FUNCTION,
+  AnnotationTarget.CONSTRUCTOR,
+)
+annotation class CheckRemoved(val description: String = "")
diff --git a/src/keepanno/java/androidx/annotation/keep/ClassAccessFlags.java b/src/keepanno/java/androidx/annotation/keep/ClassAccessFlags.kt
similarity index 93%
rename from src/keepanno/java/androidx/annotation/keep/ClassAccessFlags.java
rename to src/keepanno/java/androidx/annotation/keep/ClassAccessFlags.kt
index 0d4e765..80cdeed 100644
--- a/src/keepanno/java/androidx/annotation/keep/ClassAccessFlags.java
+++ b/src/keepanno/java/androidx/annotation/keep/ClassAccessFlags.kt
@@ -18,7 +18,7 @@
 // MAINTAINED AND TESTED IN THE R8 REPO. PLEASE MAKE CHANGES THERE AND REPLICATE.
 // ***********************************************************************************
 
-package androidx.annotation.keep;
+package androidx.annotation.keep
 
 /**
  * Valid matches on class access flags and their negations.
@@ -26,7 +26,7 @@
  * <p>The negated elements make it easier to express the inverse as we cannot use a "not/negation"
  * operation syntactically.
  */
-public enum ClassAccessFlags {
+enum class ClassAccessFlags {
   PUBLIC,
   NON_PUBLIC,
   PACKAGE_PRIVATE,
@@ -42,5 +42,5 @@
   ANNOTATION,
   NON_ANNOTATION,
   ENUM,
-  NON_ENUM
+  NON_ENUM,
 }
diff --git a/src/keepanno/java/androidx/annotation/keep/ClassNamePattern.java b/src/keepanno/java/androidx/annotation/keep/ClassNamePattern.java
deleted file mode 100644
index 299bf04..0000000
--- a/src/keepanno/java/androidx/annotation/keep/ClassNamePattern.java
+++ /dev/null
@@ -1,124 +0,0 @@
-/*
- * Copyright 2025 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.
- */
-
-// ***********************************************************************************
-// GENERATED FILE. DO NOT EDIT! See KeepItemAnnotationGenerator.java.
-// ***********************************************************************************
-
-// ***********************************************************************************
-// MAINTAINED AND TESTED IN THE R8 REPO. PLEASE MAKE CHANGES THERE AND REPLICATE.
-// ***********************************************************************************
-
-package androidx.annotation.keep;
-
-import java.lang.annotation.ElementType;
-import java.lang.annotation.Retention;
-import java.lang.annotation.RetentionPolicy;
-import java.lang.annotation.Target;
-
-/**
- * A pattern structure for matching names of classes and interfaces.
- *
- * <p>If no properties are set, the default pattern matches any name of a class or interface.
- */
-@Target(ElementType.ANNOTATION_TYPE)
-@Retention(RetentionPolicy.CLASS)
-public @interface ClassNamePattern {
-
-  /**
-   * Define the class-name pattern by fully qualified class name.
-   *
-   * <p>Mutually exclusive with the following other properties defining class-name:
-   *
-   * <ul>
-   *   <li>constant
-   *   <li>unqualifiedName
-   *   <li>unqualifiedNamePattern
-   *   <li>packageName
-   * </ul>
-   *
-   * @return The qualified class name that defines the class.
-   */
-  String name() default "";
-
-  /**
-   * Define the class-name pattern by reference to a Class constant.
-   *
-   * <p>Mutually exclusive with the following other properties defining class-name:
-   *
-   * <ul>
-   *   <li>name
-   *   <li>unqualifiedName
-   *   <li>unqualifiedNamePattern
-   *   <li>packageName
-   * </ul>
-   *
-   * @return The class-constant that defines the class.
-   */
-  Class<?> constant() default Object.class;
-
-  /**
-   * Exact and unqualified name of the class or interface.
-   *
-   * <p>For example, the unqualified name of {@code com.example.MyClass} is {@code MyClass}. Note
-   * that for inner classes a `$` will appear in the unqualified name,such as, {@code
-   * MyClass$MyInnerClass}.
-   *
-   * <p>The default matches any unqualified name.
-   *
-   * <p>Mutually exclusive with the following other properties defining class-unqualified-name:
-   *
-   * <ul>
-   *   <li>unqualifiedNamePattern
-   *   <li>name
-   *   <li>constant
-   * </ul>
-   */
-  String unqualifiedName() default "";
-
-  /**
-   * Define the unqualified class-name pattern by a string pattern.
-   *
-   * <p>The default matches any unqualified name.
-   *
-   * <p>Mutually exclusive with the following other properties defining class-unqualified-name:
-   *
-   * <ul>
-   *   <li>unqualifiedName
-   *   <li>name
-   *   <li>constant
-   * </ul>
-   *
-   * @return The string pattern of the unqualified class name.
-   */
-  StringPattern unqualifiedNamePattern() default @StringPattern(exact = "");
-
-  /**
-   * Exact package name of the class or interface.
-   *
-   * <p>For example, the package of {@code com.example.MyClass} is {@code com.example}.
-   *
-   * <p>The default matches any package.
-   *
-   * <p>Mutually exclusive with the following other properties defining class-package-name:
-   *
-   * <ul>
-   *   <li>name
-   *   <li>constant
-   * </ul>
-   */
-  String packageName() default "";
-}
diff --git a/src/keepanno/java/androidx/annotation/keep/ClassNamePattern.kt b/src/keepanno/java/androidx/annotation/keep/ClassNamePattern.kt
new file mode 100644
index 0000000..e01a876
--- /dev/null
+++ b/src/keepanno/java/androidx/annotation/keep/ClassNamePattern.kt
@@ -0,0 +1,129 @@
+/*
+ * Copyright 2025 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.
+ */
+
+// ***********************************************************************************
+// GENERATED FILE. DO NOT EDIT! See KeepItemAnnotationGenerator.java.
+// ***********************************************************************************
+
+// ***********************************************************************************
+// MAINTAINED AND TESTED IN THE R8 REPO. PLEASE MAKE CHANGES THERE AND REPLICATE.
+// ***********************************************************************************
+
+package androidx.annotation.keep
+
+import kotlin.annotation.Retention
+import kotlin.annotation.Target
+import kotlin.reflect.KClass
+
+/**
+ * A pattern structure for matching names of classes and interfaces.
+ *
+ * <p>
+ * If no properties are set, the default pattern matches any name of a class or interface.
+ */
+@Retention(AnnotationRetention.BINARY)
+@Target(AnnotationTarget.ANNOTATION_CLASS)
+annotation class ClassNamePattern(
+
+  /**
+   * Define the class-name pattern by fully qualified class name.
+   *
+   * <p>
+   * Mutually exclusive with the following other properties defining class-name:
+   * <ul>
+   * <li>constant
+   * <li>unqualifiedName
+   * <li>unqualifiedNamePattern
+   * <li>packageName
+   * </ul>
+   *
+   * @return The qualified class name that defines the class.
+   */
+  val name: String = "",
+
+  /**
+   * Define the class-name pattern by reference to a Class constant.
+   *
+   * <p>
+   * Mutually exclusive with the following other properties defining class-name:
+   * <ul>
+   * <li>name
+   * <li>unqualifiedName
+   * <li>unqualifiedNamePattern
+   * <li>packageName
+   * </ul>
+   *
+   * @return The class-constant that defines the class.
+   */
+  val constant: KClass<*> = Object::class,
+
+  /**
+   * Exact and unqualified name of the class or interface.
+   *
+   * <p>
+   * For example, the unqualified name of {@code com.example.MyClass} is {@code MyClass}. Note that
+   * for inner classes a `$` will appear in the unqualified name,such as, {@code
+   * MyClass$MyInnerClass}.
+   *
+   * <p>
+   * The default matches any unqualified name.
+   *
+   * <p>
+   * Mutually exclusive with the following other properties defining class-unqualified-name:
+   * <ul>
+   * <li>unqualifiedNamePattern
+   * <li>name
+   * <li>constant
+   * </ul>
+   */
+  val unqualifiedName: String = "",
+
+  /**
+   * Define the unqualified class-name pattern by a string pattern.
+   *
+   * <p>
+   * The default matches any unqualified name.
+   *
+   * <p>
+   * Mutually exclusive with the following other properties defining class-unqualified-name:
+   * <ul>
+   * <li>unqualifiedName
+   * <li>name
+   * <li>constant
+   * </ul>
+   *
+   * @return The string pattern of the unqualified class name.
+   */
+  val unqualifiedNamePattern: StringPattern = StringPattern(exact = ""),
+
+  /**
+   * Exact package name of the class or interface.
+   *
+   * <p>
+   * For example, the package of {@code com.example.MyClass} is {@code com.example}.
+   *
+   * <p>
+   * The default matches any package.
+   *
+   * <p>
+   * Mutually exclusive with the following other properties defining class-package-name:
+   * <ul>
+   * <li>name
+   * <li>constant
+   * </ul>
+   */
+  val packageName: String = "",
+)
diff --git a/src/keepanno/java/androidx/annotation/keep/FieldAccessFlags.java b/src/keepanno/java/androidx/annotation/keep/FieldAccessFlags.kt
similarity index 95%
rename from src/keepanno/java/androidx/annotation/keep/FieldAccessFlags.java
rename to src/keepanno/java/androidx/annotation/keep/FieldAccessFlags.kt
index 9b28dec..11867e6 100644
--- a/src/keepanno/java/androidx/annotation/keep/FieldAccessFlags.java
+++ b/src/keepanno/java/androidx/annotation/keep/FieldAccessFlags.kt
@@ -18,7 +18,7 @@
 // MAINTAINED AND TESTED IN THE R8 REPO. PLEASE MAKE CHANGES THERE AND REPLICATE.
 // ***********************************************************************************
 
-package androidx.annotation.keep;
+package androidx.annotation.keep
 
 /**
  * Valid matches on field access flags and their negations.
@@ -26,7 +26,7 @@
  * <p>The negated elements make it easier to express the inverse as we cannot use a "not/negation"
  * operation syntactically.
  */
-public enum FieldAccessFlags {
+enum class FieldAccessFlags {
   // General member flags.
   PUBLIC,
   NON_PUBLIC,
diff --git a/src/keepanno/java/androidx/annotation/keep/InstanceOfPattern.java b/src/keepanno/java/androidx/annotation/keep/InstanceOfPattern.kt
similarity index 68%
rename from src/keepanno/java/androidx/annotation/keep/InstanceOfPattern.java
rename to src/keepanno/java/androidx/annotation/keep/InstanceOfPattern.kt
index 9e55d6a..9387973 100644
--- a/src/keepanno/java/androidx/annotation/keep/InstanceOfPattern.java
+++ b/src/keepanno/java/androidx/annotation/keep/InstanceOfPattern.kt
@@ -22,30 +22,30 @@
 // MAINTAINED AND TESTED IN THE R8 REPO. PLEASE MAKE CHANGES THERE AND REPLICATE.
 // ***********************************************************************************
 
-package androidx.annotation.keep;
+package androidx.annotation.keep
 
-import java.lang.annotation.ElementType;
-import java.lang.annotation.Retention;
-import java.lang.annotation.RetentionPolicy;
-import java.lang.annotation.Target;
+import kotlin.annotation.Retention
+import kotlin.annotation.Target
 
 /**
  * A pattern structure for matching instances of classes and interfaces.
  *
- * <p>If no properties are set, the default pattern matches any instance.
+ * <p>
+ * If no properties are set, the default pattern matches any instance.
  */
-@Target(ElementType.ANNOTATION_TYPE)
-@Retention(RetentionPolicy.CLASS)
-public @interface InstanceOfPattern {
+@Retention(AnnotationRetention.BINARY)
+@Target(AnnotationTarget.ANNOTATION_CLASS)
+annotation class InstanceOfPattern(
 
   /**
    * True if the pattern should include the directly matched classes.
    *
-   * <p>If false, the pattern is exclusive and only matches classes that are strict subclasses of
-   * the pattern.
+   * <p>
+   * If false, the pattern is exclusive and only matches classes that are strict subclasses of the
+   * pattern.
    */
-  boolean inclusive() default true;
+  val inclusive: Boolean = true,
 
   /** Instances of classes matching the class-name pattern. */
-  ClassNamePattern classNamePattern() default @ClassNamePattern(unqualifiedName = "");
-}
+  val classNamePattern: ClassNamePattern = ClassNamePattern(unqualifiedName = ""),
+)
diff --git a/src/keepanno/java/androidx/annotation/keep/KeepBinding.java b/src/keepanno/java/androidx/annotation/keep/KeepBinding.java
deleted file mode 100644
index a15e97e..0000000
--- a/src/keepanno/java/androidx/annotation/keep/KeepBinding.java
+++ /dev/null
@@ -1,722 +0,0 @@
-/*
- * Copyright 2025 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.
- */
-
-// ***********************************************************************************
-// GENERATED FILE. DO NOT EDIT! See KeepItemAnnotationGenerator.java.
-// ***********************************************************************************
-
-// ***********************************************************************************
-// MAINTAINED AND TESTED IN THE R8 REPO. PLEASE MAKE CHANGES THERE AND REPLICATE.
-// ***********************************************************************************
-
-package androidx.annotation.keep;
-
-import java.lang.annotation.ElementType;
-import java.lang.annotation.Retention;
-import java.lang.annotation.RetentionPolicy;
-import java.lang.annotation.Target;
-
-/**
- * A binding of a keep item.
- *
- * <p>Bindings allow referencing the exact instance of a match from a condition in other conditions
- * and/or targets. It can also be used to reduce duplication of targets by sharing patterns.
- *
- * <p>An item can be:
- *
- * <ul>
- *   <li>a pattern on classes;
- *   <li>a pattern on methods; or
- *   <li>a pattern on fields.
- * </ul>
- */
-@Target(ElementType.ANNOTATION_TYPE)
-@Retention(RetentionPolicy.CLASS)
-public @interface KeepBinding {
-
-  /**
-   * Name with which other bindings, conditions or targets can reference the bound item pattern.
-   *
-   * @return Name of the binding.
-   */
-  String bindingName();
-
-  /**
-   * Specify the kind of this item pattern.
-   *
-   * <p>Possible values are:
-   *
-   * <ul>
-   *   <li>{@link KeepItemKind#ONLY_CLASS}
-   *   <li>{@link KeepItemKind#ONLY_MEMBERS}
-   *   <li>{@link KeepItemKind#ONLY_METHODS}
-   *   <li>{@link KeepItemKind#ONLY_FIELDS}
-   *   <li>{@link KeepItemKind#CLASS_AND_MEMBERS}
-   *   <li>{@link KeepItemKind#CLASS_AND_METHODS}
-   *   <li>{@link KeepItemKind#CLASS_AND_FIELDS}
-   * </ul>
-   *
-   * <p>If unspecified the default kind for an item depends on its member patterns:
-   *
-   * <ul>
-   *   <li>{@link KeepItemKind#ONLY_CLASS} if no member patterns are defined
-   *   <li>{@link KeepItemKind#ONLY_METHODS} if method patterns are defined
-   *   <li>{@link KeepItemKind#ONLY_FIELDS} if field patterns are defined
-   *   <li>{@link KeepItemKind#ONLY_MEMBERS} otherwise.
-   * </ul>
-   *
-   * @return The kind for this pattern.
-   */
-  KeepItemKind kind() default KeepItemKind.DEFAULT;
-
-  /**
-   * Define the class pattern by reference to a binding.
-   *
-   * <p>Mutually exclusive with the following other properties defining class:
-   *
-   * <ul>
-   *   <li>className
-   *   <li>classConstant
-   *   <li>classNamePattern
-   *   <li>instanceOfClassName
-   *   <li>instanceOfClassNameExclusive
-   *   <li>instanceOfClassConstant
-   *   <li>instanceOfClassConstantExclusive
-   *   <li>instanceOfPattern
-   *   <li>classAnnotatedByClassName
-   *   <li>classAnnotatedByClassConstant
-   *   <li>classAnnotatedByClassNamePattern
-   * </ul>
-   *
-   * <p>If none are specified the default is to match any class.
-   *
-   * @return The name of the binding that defines the class.
-   */
-  String classFromBinding() default "";
-
-  /**
-   * Define the class-name pattern by fully qualified class name.
-   *
-   * <p>Mutually exclusive with the following other properties defining class-name:
-   *
-   * <ul>
-   *   <li>classConstant
-   *   <li>classNamePattern
-   *   <li>classFromBinding
-   * </ul>
-   *
-   * <p>If none are specified the default is to match any class name.
-   *
-   * @return The qualified class name that defines the class.
-   */
-  String className() default "";
-
-  /**
-   * Define the class-name pattern by reference to a Class constant.
-   *
-   * <p>Mutually exclusive with the following other properties defining class-name:
-   *
-   * <ul>
-   *   <li>className
-   *   <li>classNamePattern
-   *   <li>classFromBinding
-   * </ul>
-   *
-   * <p>If none are specified the default is to match any class name.
-   *
-   * @return The class-constant that defines the class.
-   */
-  Class<?> classConstant() default Object.class;
-
-  /**
-   * Define the class-name pattern by reference to a class-name pattern.
-   *
-   * <p>Mutually exclusive with the following other properties defining class-name:
-   *
-   * <ul>
-   *   <li>className
-   *   <li>classConstant
-   *   <li>classFromBinding
-   * </ul>
-   *
-   * <p>If none are specified the default is to match any class name.
-   *
-   * @return The class-name pattern that defines the class.
-   */
-  ClassNamePattern classNamePattern() default @ClassNamePattern(unqualifiedName = "");
-
-  /**
-   * Define the instance-of pattern as classes that are instances of the fully qualified class name.
-   *
-   * <p>Mutually exclusive with the following other properties defining instance-of:
-   *
-   * <ul>
-   *   <li>instanceOfClassNameExclusive
-   *   <li>instanceOfClassConstant
-   *   <li>instanceOfClassConstantExclusive
-   *   <li>instanceOfPattern
-   *   <li>classFromBinding
-   * </ul>
-   *
-   * <p>If none are specified the default is to match any class instance.
-   *
-   * @return The qualified class name that defines what instance-of the class must be.
-   */
-  String instanceOfClassName() default "";
-
-  /**
-   * Define the instance-of pattern as classes that are instances of the fully qualified class name.
-   *
-   * <p>The pattern is exclusive in that it does not match classes that are instances of the
-   * pattern, but only those that are instances of classes that are subclasses of the pattern.
-   *
-   * <p>Mutually exclusive with the following other properties defining instance-of:
-   *
-   * <ul>
-   *   <li>instanceOfClassName
-   *   <li>instanceOfClassConstant
-   *   <li>instanceOfClassConstantExclusive
-   *   <li>instanceOfPattern
-   *   <li>classFromBinding
-   * </ul>
-   *
-   * <p>If none are specified the default is to match any class instance.
-   *
-   * @return The qualified class name that defines what instance-of the class must be.
-   */
-  String instanceOfClassNameExclusive() default "";
-
-  /**
-   * Define the instance-of pattern as classes that are instances the referenced Class constant.
-   *
-   * <p>Mutually exclusive with the following other properties defining instance-of:
-   *
-   * <ul>
-   *   <li>instanceOfClassName
-   *   <li>instanceOfClassNameExclusive
-   *   <li>instanceOfClassConstantExclusive
-   *   <li>instanceOfPattern
-   *   <li>classFromBinding
-   * </ul>
-   *
-   * <p>If none are specified the default is to match any class instance.
-   *
-   * @return The class constant that defines what instance-of the class must be.
-   */
-  Class<?> instanceOfClassConstant() default Object.class;
-
-  /**
-   * Define the instance-of pattern as classes that are instances the referenced Class constant.
-   *
-   * <p>The pattern is exclusive in that it does not match classes that are instances of the
-   * pattern, but only those that are instances of classes that are subclasses of the pattern.
-   *
-   * <p>Mutually exclusive with the following other properties defining instance-of:
-   *
-   * <ul>
-   *   <li>instanceOfClassName
-   *   <li>instanceOfClassNameExclusive
-   *   <li>instanceOfClassConstant
-   *   <li>instanceOfPattern
-   *   <li>classFromBinding
-   * </ul>
-   *
-   * <p>If none are specified the default is to match any class instance.
-   *
-   * @return The class constant that defines what instance-of the class must be.
-   */
-  Class<?> instanceOfClassConstantExclusive() default Object.class;
-
-  /**
-   * Define the instance-of with a pattern.
-   *
-   * <p>Mutually exclusive with the following other properties defining instance-of:
-   *
-   * <ul>
-   *   <li>instanceOfClassName
-   *   <li>instanceOfClassNameExclusive
-   *   <li>instanceOfClassConstant
-   *   <li>instanceOfClassConstantExclusive
-   *   <li>classFromBinding
-   * </ul>
-   *
-   * <p>If none are specified the default is to match any class instance.
-   *
-   * @return The pattern that defines what instance-of the class must be.
-   */
-  InstanceOfPattern instanceOfPattern() default @InstanceOfPattern();
-
-  /**
-   * Define the class-annotated-by pattern by fully qualified class name.
-   *
-   * <p>Mutually exclusive with the following other properties defining class-annotated-by:
-   *
-   * <ul>
-   *   <li>classAnnotatedByClassConstant
-   *   <li>classAnnotatedByClassNamePattern
-   *   <li>classFromBinding
-   * </ul>
-   *
-   * <p>If none are specified the default is to match any class regardless of what the class is
-   * annotated by.
-   *
-   * @return The qualified class name that defines the annotation.
-   */
-  String classAnnotatedByClassName() default "";
-
-  /**
-   * Define the class-annotated-by pattern by reference to a Class constant.
-   *
-   * <p>Mutually exclusive with the following other properties defining class-annotated-by:
-   *
-   * <ul>
-   *   <li>classAnnotatedByClassName
-   *   <li>classAnnotatedByClassNamePattern
-   *   <li>classFromBinding
-   * </ul>
-   *
-   * <p>If none are specified the default is to match any class regardless of what the class is
-   * annotated by.
-   *
-   * @return The class-constant that defines the annotation.
-   */
-  Class<?> classAnnotatedByClassConstant() default Object.class;
-
-  /**
-   * Define the class-annotated-by pattern by reference to a class-name pattern.
-   *
-   * <p>Mutually exclusive with the following other properties defining class-annotated-by:
-   *
-   * <ul>
-   *   <li>classAnnotatedByClassName
-   *   <li>classAnnotatedByClassConstant
-   *   <li>classFromBinding
-   * </ul>
-   *
-   * <p>If none are specified the default is to match any class regardless of what the class is
-   * annotated by.
-   *
-   * @return The class-name pattern that defines the annotation.
-   */
-  ClassNamePattern classAnnotatedByClassNamePattern() default
-      @ClassNamePattern(unqualifiedName = "");
-
-  /**
-   * Define the member-annotated-by pattern by fully qualified class name.
-   *
-   * <p>Mutually exclusive with the following other properties defining member-annotated-by:
-   *
-   * <ul>
-   *   <li>memberAnnotatedByClassConstant
-   *   <li>memberAnnotatedByClassNamePattern
-   * </ul>
-   *
-   * <p>Mutually exclusive with all field and method properties as use restricts the match to both
-   * types of members.
-   *
-   * <p>If none are specified the default is to match any member regardless of what the member is
-   * annotated by.
-   *
-   * @return The qualified class name that defines the annotation.
-   */
-  String memberAnnotatedByClassName() default "";
-
-  /**
-   * Define the member-annotated-by pattern by reference to a Class constant.
-   *
-   * <p>Mutually exclusive with the following other properties defining member-annotated-by:
-   *
-   * <ul>
-   *   <li>memberAnnotatedByClassName
-   *   <li>memberAnnotatedByClassNamePattern
-   * </ul>
-   *
-   * <p>Mutually exclusive with all field and method properties as use restricts the match to both
-   * types of members.
-   *
-   * <p>If none are specified the default is to match any member regardless of what the member is
-   * annotated by.
-   *
-   * @return The class-constant that defines the annotation.
-   */
-  Class<?> memberAnnotatedByClassConstant() default Object.class;
-
-  /**
-   * Define the member-annotated-by pattern by reference to a class-name pattern.
-   *
-   * <p>Mutually exclusive with the following other properties defining member-annotated-by:
-   *
-   * <ul>
-   *   <li>memberAnnotatedByClassName
-   *   <li>memberAnnotatedByClassConstant
-   * </ul>
-   *
-   * <p>Mutually exclusive with all field and method properties as use restricts the match to both
-   * types of members.
-   *
-   * <p>If none are specified the default is to match any member regardless of what the member is
-   * annotated by.
-   *
-   * @return The class-name pattern that defines the annotation.
-   */
-  ClassNamePattern memberAnnotatedByClassNamePattern() default
-      @ClassNamePattern(unqualifiedName = "");
-
-  /**
-   * Define the member-access pattern by matching on access flags.
-   *
-   * <p>Mutually exclusive with all field and method properties as use restricts the match to both
-   * types of members.
-   *
-   * @return The member access-flag constraints that must be met.
-   */
-  MemberAccessFlags[] memberAccess() default {};
-
-  /**
-   * Define the method-annotated-by pattern by fully qualified class name.
-   *
-   * <p>Mutually exclusive with the following other properties defining method-annotated-by:
-   *
-   * <ul>
-   *   <li>methodAnnotatedByClassConstant
-   *   <li>methodAnnotatedByClassNamePattern
-   * </ul>
-   *
-   * <p>Mutually exclusive with all field properties.
-   *
-   * <p>If none are specified the default is to match any method regardless of what the method is
-   * annotated by.
-   *
-   * @return The qualified class name that defines the annotation.
-   */
-  String methodAnnotatedByClassName() default "";
-
-  /**
-   * Define the method-annotated-by pattern by reference to a Class constant.
-   *
-   * <p>Mutually exclusive with the following other properties defining method-annotated-by:
-   *
-   * <ul>
-   *   <li>methodAnnotatedByClassName
-   *   <li>methodAnnotatedByClassNamePattern
-   * </ul>
-   *
-   * <p>Mutually exclusive with all field properties.
-   *
-   * <p>If none are specified the default is to match any method regardless of what the method is
-   * annotated by.
-   *
-   * @return The class-constant that defines the annotation.
-   */
-  Class<?> methodAnnotatedByClassConstant() default Object.class;
-
-  /**
-   * Define the method-annotated-by pattern by reference to a class-name pattern.
-   *
-   * <p>Mutually exclusive with the following other properties defining method-annotated-by:
-   *
-   * <ul>
-   *   <li>methodAnnotatedByClassName
-   *   <li>methodAnnotatedByClassConstant
-   * </ul>
-   *
-   * <p>Mutually exclusive with all field properties.
-   *
-   * <p>If none are specified the default is to match any method regardless of what the method is
-   * annotated by.
-   *
-   * @return The class-name pattern that defines the annotation.
-   */
-  ClassNamePattern methodAnnotatedByClassNamePattern() default
-      @ClassNamePattern(unqualifiedName = "");
-
-  /**
-   * Define the method-access pattern by matching on access flags.
-   *
-   * <p>Mutually exclusive with all field properties.
-   *
-   * <p>If none, and other properties define this item as a method, the default matches any
-   * method-access flags.
-   *
-   * @return The method access-flag constraints that must be met.
-   */
-  MethodAccessFlags[] methodAccess() default {};
-
-  /**
-   * Define the method-name pattern by an exact method name.
-   *
-   * <p>Mutually exclusive with all field properties.
-   *
-   * <p>If none, and other properties define this item as a method, the default matches any method
-   * name.
-   *
-   * <p>Mutually exclusive with the property `methodNamePattern` also defining method-name.
-   *
-   * @return The exact method name of the method.
-   */
-  String methodName() default "";
-
-  /**
-   * Define the method-name pattern by a string pattern.
-   *
-   * <p>Mutually exclusive with all field properties.
-   *
-   * <p>If none, and other properties define this item as a method, the default matches any method
-   * name.
-   *
-   * <p>Mutually exclusive with the property `methodName` also defining method-name.
-   *
-   * @return The string pattern of the method name.
-   */
-  StringPattern methodNamePattern() default @StringPattern(exact = "");
-
-  /**
-   * Define the method return-type pattern by a fully qualified type or 'void'.
-   *
-   * <p>Mutually exclusive with all field properties.
-   *
-   * <p>If none, and other properties define this item as a method, the default matches any return
-   * type.
-   *
-   * <p>Mutually exclusive with the following other properties defining return-type:
-   *
-   * <ul>
-   *   <li>methodReturnTypeConstant
-   *   <li>methodReturnTypePattern
-   * </ul>
-   *
-   * @return The qualified type name of the method return type.
-   */
-  String methodReturnType() default "";
-
-  /**
-   * Define the method return-type pattern by a class constant.
-   *
-   * <p>Mutually exclusive with all field properties.
-   *
-   * <p>If none, and other properties define this item as a method, the default matches any return
-   * type.
-   *
-   * <p>Mutually exclusive with the following other properties defining return-type:
-   *
-   * <ul>
-   *   <li>methodReturnType
-   *   <li>methodReturnTypePattern
-   * </ul>
-   *
-   * @return A class constant denoting the type of the method return type.
-   */
-  Class<?> methodReturnTypeConstant() default Object.class;
-
-  /**
-   * Define the method return-type pattern by a type pattern.
-   *
-   * <p>Mutually exclusive with all field properties.
-   *
-   * <p>If none, and other properties define this item as a method, the default matches any return
-   * type.
-   *
-   * <p>Mutually exclusive with the following other properties defining return-type:
-   *
-   * <ul>
-   *   <li>methodReturnType
-   *   <li>methodReturnTypeConstant
-   * </ul>
-   *
-   * @return The pattern of the method return type.
-   */
-  TypePattern methodReturnTypePattern() default @TypePattern(name = "");
-
-  /**
-   * Define the method parameters pattern by a list of fully qualified types.
-   *
-   * <p>Mutually exclusive with all field properties.
-   *
-   * <p>If none, and other properties define this item as a method, the default matches any
-   * parameters.
-   *
-   * <p>Mutually exclusive with the property `methodParameterTypePatterns` also defining parameters.
-   *
-   * @return The list of qualified type names of the method parameters.
-   */
-  String[] methodParameters() default {""};
-
-  /**
-   * Define the method parameters pattern by a list of patterns on types.
-   *
-   * <p>Mutually exclusive with all field properties.
-   *
-   * <p>If none, and other properties define this item as a method, the default matches any
-   * parameters.
-   *
-   * <p>Mutually exclusive with the property `methodParameters` also defining parameters.
-   *
-   * @return The list of type patterns for the method parameters.
-   */
-  TypePattern[] methodParameterTypePatterns() default {@TypePattern(name = "")};
-
-  /**
-   * Define the field-annotated-by pattern by fully qualified class name.
-   *
-   * <p>Mutually exclusive with the following other properties defining field-annotated-by:
-   *
-   * <ul>
-   *   <li>fieldAnnotatedByClassConstant
-   *   <li>fieldAnnotatedByClassNamePattern
-   * </ul>
-   *
-   * <p>Mutually exclusive with all method properties.
-   *
-   * <p>If none are specified the default is to match any field regardless of what the field is
-   * annotated by.
-   *
-   * @return The qualified class name that defines the annotation.
-   */
-  String fieldAnnotatedByClassName() default "";
-
-  /**
-   * Define the field-annotated-by pattern by reference to a Class constant.
-   *
-   * <p>Mutually exclusive with the following other properties defining field-annotated-by:
-   *
-   * <ul>
-   *   <li>fieldAnnotatedByClassName
-   *   <li>fieldAnnotatedByClassNamePattern
-   * </ul>
-   *
-   * <p>Mutually exclusive with all method properties.
-   *
-   * <p>If none are specified the default is to match any field regardless of what the field is
-   * annotated by.
-   *
-   * @return The class-constant that defines the annotation.
-   */
-  Class<?> fieldAnnotatedByClassConstant() default Object.class;
-
-  /**
-   * Define the field-annotated-by pattern by reference to a class-name pattern.
-   *
-   * <p>Mutually exclusive with the following other properties defining field-annotated-by:
-   *
-   * <ul>
-   *   <li>fieldAnnotatedByClassName
-   *   <li>fieldAnnotatedByClassConstant
-   * </ul>
-   *
-   * <p>Mutually exclusive with all method properties.
-   *
-   * <p>If none are specified the default is to match any field regardless of what the field is
-   * annotated by.
-   *
-   * @return The class-name pattern that defines the annotation.
-   */
-  ClassNamePattern fieldAnnotatedByClassNamePattern() default
-      @ClassNamePattern(unqualifiedName = "");
-
-  /**
-   * Define the field-access pattern by matching on access flags.
-   *
-   * <p>Mutually exclusive with all method properties.
-   *
-   * <p>If none, and other properties define this item as a field, the default matches any
-   * field-access flags.
-   *
-   * @return The field access-flag constraints that must be met.
-   */
-  FieldAccessFlags[] fieldAccess() default {};
-
-  /**
-   * Define the field-name pattern by an exact field name.
-   *
-   * <p>Mutually exclusive with all method properties.
-   *
-   * <p>If none, and other properties define this item as a field, the default matches any field
-   * name.
-   *
-   * <p>Mutually exclusive with the property `fieldNamePattern` also defining field-name.
-   *
-   * @return The exact field name of the field.
-   */
-  String fieldName() default "";
-
-  /**
-   * Define the field-name pattern by a string pattern.
-   *
-   * <p>Mutually exclusive with all method properties.
-   *
-   * <p>If none, and other properties define this item as a field, the default matches any field
-   * name.
-   *
-   * <p>Mutually exclusive with the property `fieldName` also defining field-name.
-   *
-   * @return The string pattern of the field name.
-   */
-  StringPattern fieldNamePattern() default @StringPattern(exact = "");
-
-  /**
-   * Define the field-type pattern by a fully qualified type.
-   *
-   * <p>Mutually exclusive with all method properties.
-   *
-   * <p>If none, and other properties define this item as a field, the default matches any type.
-   *
-   * <p>Mutually exclusive with the following other properties defining field-type:
-   *
-   * <ul>
-   *   <li>fieldTypeConstant
-   *   <li>fieldTypePattern
-   * </ul>
-   *
-   * @return The qualified type name for the field type.
-   */
-  String fieldType() default "";
-
-  /**
-   * Define the field-type pattern by a class constant.
-   *
-   * <p>Mutually exclusive with all method properties.
-   *
-   * <p>If none, and other properties define this item as a field, the default matches any type.
-   *
-   * <p>Mutually exclusive with the following other properties defining field-type:
-   *
-   * <ul>
-   *   <li>fieldType
-   *   <li>fieldTypePattern
-   * </ul>
-   *
-   * @return The class constant for the field type.
-   */
-  Class<?> fieldTypeConstant() default Object.class;
-
-  /**
-   * Define the field-type pattern by a pattern on types.
-   *
-   * <p>Mutually exclusive with all method properties.
-   *
-   * <p>If none, and other properties define this item as a field, the default matches any type.
-   *
-   * <p>Mutually exclusive with the following other properties defining field-type:
-   *
-   * <ul>
-   *   <li>fieldType
-   *   <li>fieldTypeConstant
-   * </ul>
-   *
-   * @return The type pattern for the field type.
-   */
-  TypePattern fieldTypePattern() default @TypePattern(name = "");
-}
diff --git a/src/keepanno/java/androidx/annotation/keep/KeepBinding.kt b/src/keepanno/java/androidx/annotation/keep/KeepBinding.kt
new file mode 100644
index 0000000..b54b909
--- /dev/null
+++ b/src/keepanno/java/androidx/annotation/keep/KeepBinding.kt
@@ -0,0 +1,781 @@
+/*
+ * Copyright 2025 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.
+ */
+
+// ***********************************************************************************
+// GENERATED FILE. DO NOT EDIT! See KeepItemAnnotationGenerator.java.
+// ***********************************************************************************
+
+// ***********************************************************************************
+// MAINTAINED AND TESTED IN THE R8 REPO. PLEASE MAKE CHANGES THERE AND REPLICATE.
+// ***********************************************************************************
+
+package androidx.annotation.keep
+
+import kotlin.annotation.Retention
+import kotlin.annotation.Target
+import kotlin.reflect.KClass
+
+/**
+ * A binding of a keep item.
+ *
+ * <p>
+ * Bindings allow referencing the exact instance of a match from a condition in other conditions
+ * and/or targets. It can also be used to reduce duplication of targets by sharing patterns.
+ *
+ * <p>
+ * An item can be:
+ * <ul>
+ * <li>a pattern on classes;
+ * <li>a pattern on methods; or
+ * <li>a pattern on fields.
+ * </ul>
+ */
+@Retention(AnnotationRetention.BINARY)
+@Target(AnnotationTarget.ANNOTATION_CLASS)
+annotation class KeepBinding(
+
+  /**
+   * Name with which other bindings, conditions or targets can reference the bound item pattern.
+   *
+   * @return Name of the binding.
+   */
+  val bindingName: String,
+
+  /**
+   * Specify the kind of this item pattern.
+   *
+   * <p>
+   * Possible values are:
+   * <ul>
+   * <li>{@link KeepItemKind#ONLY_CLASS}
+   * <li>{@link KeepItemKind#ONLY_MEMBERS}
+   * <li>{@link KeepItemKind#ONLY_METHODS}
+   * <li>{@link KeepItemKind#ONLY_FIELDS}
+   * <li>{@link KeepItemKind#CLASS_AND_MEMBERS}
+   * <li>{@link KeepItemKind#CLASS_AND_METHODS}
+   * <li>{@link KeepItemKind#CLASS_AND_FIELDS}
+   * </ul>
+   *
+   * <p>
+   * If unspecified the default kind for an item depends on its member patterns:
+   * <ul>
+   * <li>{@link KeepItemKind#ONLY_CLASS} if no member patterns are defined
+   * <li>{@link KeepItemKind#ONLY_METHODS} if method patterns are defined
+   * <li>{@link KeepItemKind#ONLY_FIELDS} if field patterns are defined
+   * <li>{@link KeepItemKind#ONLY_MEMBERS} otherwise.
+   * </ul>
+   *
+   * @return The kind for this pattern.
+   */
+  val kind: KeepItemKind = KeepItemKind.DEFAULT,
+
+  /**
+   * Define the class pattern by reference to a binding.
+   *
+   * <p>
+   * Mutually exclusive with the following other properties defining class:
+   * <ul>
+   * <li>className
+   * <li>classConstant
+   * <li>classNamePattern
+   * <li>instanceOfClassName
+   * <li>instanceOfClassNameExclusive
+   * <li>instanceOfClassConstant
+   * <li>instanceOfClassConstantExclusive
+   * <li>instanceOfPattern
+   * <li>classAnnotatedByClassName
+   * <li>classAnnotatedByClassConstant
+   * <li>classAnnotatedByClassNamePattern
+   * </ul>
+   *
+   * <p>
+   * If none are specified the default is to match any class.
+   *
+   * @return The name of the binding that defines the class.
+   */
+  val classFromBinding: String = "",
+
+  /**
+   * Define the class-name pattern by fully qualified class name.
+   *
+   * <p>
+   * Mutually exclusive with the following other properties defining class-name:
+   * <ul>
+   * <li>classConstant
+   * <li>classNamePattern
+   * <li>classFromBinding
+   * </ul>
+   *
+   * <p>
+   * If none are specified the default is to match any class name.
+   *
+   * @return The qualified class name that defines the class.
+   */
+  val className: String = "",
+
+  /**
+   * Define the class-name pattern by reference to a Class constant.
+   *
+   * <p>
+   * Mutually exclusive with the following other properties defining class-name:
+   * <ul>
+   * <li>className
+   * <li>classNamePattern
+   * <li>classFromBinding
+   * </ul>
+   *
+   * <p>
+   * If none are specified the default is to match any class name.
+   *
+   * @return The class-constant that defines the class.
+   */
+  val classConstant: KClass<*> = Object::class,
+
+  /**
+   * Define the class-name pattern by reference to a class-name pattern.
+   *
+   * <p>
+   * Mutually exclusive with the following other properties defining class-name:
+   * <ul>
+   * <li>className
+   * <li>classConstant
+   * <li>classFromBinding
+   * </ul>
+   *
+   * <p>
+   * If none are specified the default is to match any class name.
+   *
+   * @return The class-name pattern that defines the class.
+   */
+  val classNamePattern: ClassNamePattern = ClassNamePattern(unqualifiedName = ""),
+
+  /**
+   * Define the instance-of pattern as classes that are instances of the fully qualified class name.
+   *
+   * <p>
+   * Mutually exclusive with the following other properties defining instance-of:
+   * <ul>
+   * <li>instanceOfClassNameExclusive
+   * <li>instanceOfClassConstant
+   * <li>instanceOfClassConstantExclusive
+   * <li>instanceOfPattern
+   * <li>classFromBinding
+   * </ul>
+   *
+   * <p>
+   * If none are specified the default is to match any class instance.
+   *
+   * @return The qualified class name that defines what instance-of the class must be.
+   */
+  val instanceOfClassName: String = "",
+
+  /**
+   * Define the instance-of pattern as classes that are instances of the fully qualified class name.
+   *
+   * <p>
+   * The pattern is exclusive in that it does not match classes that are instances of the pattern,
+   * but only those that are instances of classes that are subclasses of the pattern.
+   *
+   * <p>
+   * Mutually exclusive with the following other properties defining instance-of:
+   * <ul>
+   * <li>instanceOfClassName
+   * <li>instanceOfClassConstant
+   * <li>instanceOfClassConstantExclusive
+   * <li>instanceOfPattern
+   * <li>classFromBinding
+   * </ul>
+   *
+   * <p>
+   * If none are specified the default is to match any class instance.
+   *
+   * @return The qualified class name that defines what instance-of the class must be.
+   */
+  val instanceOfClassNameExclusive: String = "",
+
+  /**
+   * Define the instance-of pattern as classes that are instances the referenced Class constant.
+   *
+   * <p>
+   * Mutually exclusive with the following other properties defining instance-of:
+   * <ul>
+   * <li>instanceOfClassName
+   * <li>instanceOfClassNameExclusive
+   * <li>instanceOfClassConstantExclusive
+   * <li>instanceOfPattern
+   * <li>classFromBinding
+   * </ul>
+   *
+   * <p>
+   * If none are specified the default is to match any class instance.
+   *
+   * @return The class constant that defines what instance-of the class must be.
+   */
+  val instanceOfClassConstant: KClass<*> = Object::class,
+
+  /**
+   * Define the instance-of pattern as classes that are instances the referenced Class constant.
+   *
+   * <p>
+   * The pattern is exclusive in that it does not match classes that are instances of the pattern,
+   * but only those that are instances of classes that are subclasses of the pattern.
+   *
+   * <p>
+   * Mutually exclusive with the following other properties defining instance-of:
+   * <ul>
+   * <li>instanceOfClassName
+   * <li>instanceOfClassNameExclusive
+   * <li>instanceOfClassConstant
+   * <li>instanceOfPattern
+   * <li>classFromBinding
+   * </ul>
+   *
+   * <p>
+   * If none are specified the default is to match any class instance.
+   *
+   * @return The class constant that defines what instance-of the class must be.
+   */
+  val instanceOfClassConstantExclusive: KClass<*> = Object::class,
+
+  /**
+   * Define the instance-of with a pattern.
+   *
+   * <p>
+   * Mutually exclusive with the following other properties defining instance-of:
+   * <ul>
+   * <li>instanceOfClassName
+   * <li>instanceOfClassNameExclusive
+   * <li>instanceOfClassConstant
+   * <li>instanceOfClassConstantExclusive
+   * <li>classFromBinding
+   * </ul>
+   *
+   * <p>
+   * If none are specified the default is to match any class instance.
+   *
+   * @return The pattern that defines what instance-of the class must be.
+   */
+  val instanceOfPattern: InstanceOfPattern = InstanceOfPattern(),
+
+  /**
+   * Define the class-annotated-by pattern by fully qualified class name.
+   *
+   * <p>
+   * Mutually exclusive with the following other properties defining class-annotated-by:
+   * <ul>
+   * <li>classAnnotatedByClassConstant
+   * <li>classAnnotatedByClassNamePattern
+   * <li>classFromBinding
+   * </ul>
+   *
+   * <p>
+   * If none are specified the default is to match any class regardless of what the class is
+   * annotated by.
+   *
+   * @return The qualified class name that defines the annotation.
+   */
+  val classAnnotatedByClassName: String = "",
+
+  /**
+   * Define the class-annotated-by pattern by reference to a Class constant.
+   *
+   * <p>
+   * Mutually exclusive with the following other properties defining class-annotated-by:
+   * <ul>
+   * <li>classAnnotatedByClassName
+   * <li>classAnnotatedByClassNamePattern
+   * <li>classFromBinding
+   * </ul>
+   *
+   * <p>
+   * If none are specified the default is to match any class regardless of what the class is
+   * annotated by.
+   *
+   * @return The class-constant that defines the annotation.
+   */
+  val classAnnotatedByClassConstant: KClass<*> = Object::class,
+
+  /**
+   * Define the class-annotated-by pattern by reference to a class-name pattern.
+   *
+   * <p>
+   * Mutually exclusive with the following other properties defining class-annotated-by:
+   * <ul>
+   * <li>classAnnotatedByClassName
+   * <li>classAnnotatedByClassConstant
+   * <li>classFromBinding
+   * </ul>
+   *
+   * <p>
+   * If none are specified the default is to match any class regardless of what the class is
+   * annotated by.
+   *
+   * @return The class-name pattern that defines the annotation.
+   */
+  val classAnnotatedByClassNamePattern: ClassNamePattern = ClassNamePattern(unqualifiedName = ""),
+
+  /**
+   * Define the member-annotated-by pattern by fully qualified class name.
+   *
+   * <p>
+   * Mutually exclusive with the following other properties defining member-annotated-by:
+   * <ul>
+   * <li>memberAnnotatedByClassConstant
+   * <li>memberAnnotatedByClassNamePattern
+   * </ul>
+   *
+   * <p>
+   * Mutually exclusive with all field and method properties as use restricts the match to both
+   * types of members.
+   *
+   * <p>
+   * If none are specified the default is to match any member regardless of what the member is
+   * annotated by.
+   *
+   * @return The qualified class name that defines the annotation.
+   */
+  val memberAnnotatedByClassName: String = "",
+
+  /**
+   * Define the member-annotated-by pattern by reference to a Class constant.
+   *
+   * <p>
+   * Mutually exclusive with the following other properties defining member-annotated-by:
+   * <ul>
+   * <li>memberAnnotatedByClassName
+   * <li>memberAnnotatedByClassNamePattern
+   * </ul>
+   *
+   * <p>
+   * Mutually exclusive with all field and method properties as use restricts the match to both
+   * types of members.
+   *
+   * <p>
+   * If none are specified the default is to match any member regardless of what the member is
+   * annotated by.
+   *
+   * @return The class-constant that defines the annotation.
+   */
+  val memberAnnotatedByClassConstant: KClass<*> = Object::class,
+
+  /**
+   * Define the member-annotated-by pattern by reference to a class-name pattern.
+   *
+   * <p>
+   * Mutually exclusive with the following other properties defining member-annotated-by:
+   * <ul>
+   * <li>memberAnnotatedByClassName
+   * <li>memberAnnotatedByClassConstant
+   * </ul>
+   *
+   * <p>
+   * Mutually exclusive with all field and method properties as use restricts the match to both
+   * types of members.
+   *
+   * <p>
+   * If none are specified the default is to match any member regardless of what the member is
+   * annotated by.
+   *
+   * @return The class-name pattern that defines the annotation.
+   */
+  val memberAnnotatedByClassNamePattern: ClassNamePattern = ClassNamePattern(unqualifiedName = ""),
+
+  /**
+   * Define the member-access pattern by matching on access flags.
+   *
+   * <p>
+   * Mutually exclusive with all field and method properties as use restricts the match to both
+   * types of members.
+   *
+   * @return The member access-flag constraints that must be met.
+   */
+  val memberAccess: Array<MemberAccessFlags> = [],
+
+  /**
+   * Define the method-annotated-by pattern by fully qualified class name.
+   *
+   * <p>
+   * Mutually exclusive with the following other properties defining method-annotated-by:
+   * <ul>
+   * <li>methodAnnotatedByClassConstant
+   * <li>methodAnnotatedByClassNamePattern
+   * </ul>
+   *
+   * <p>
+   * Mutually exclusive with all field properties.
+   *
+   * <p>
+   * If none are specified the default is to match any method regardless of what the method is
+   * annotated by.
+   *
+   * @return The qualified class name that defines the annotation.
+   */
+  val methodAnnotatedByClassName: String = "",
+
+  /**
+   * Define the method-annotated-by pattern by reference to a Class constant.
+   *
+   * <p>
+   * Mutually exclusive with the following other properties defining method-annotated-by:
+   * <ul>
+   * <li>methodAnnotatedByClassName
+   * <li>methodAnnotatedByClassNamePattern
+   * </ul>
+   *
+   * <p>
+   * Mutually exclusive with all field properties.
+   *
+   * <p>
+   * If none are specified the default is to match any method regardless of what the method is
+   * annotated by.
+   *
+   * @return The class-constant that defines the annotation.
+   */
+  val methodAnnotatedByClassConstant: KClass<*> = Object::class,
+
+  /**
+   * Define the method-annotated-by pattern by reference to a class-name pattern.
+   *
+   * <p>
+   * Mutually exclusive with the following other properties defining method-annotated-by:
+   * <ul>
+   * <li>methodAnnotatedByClassName
+   * <li>methodAnnotatedByClassConstant
+   * </ul>
+   *
+   * <p>
+   * Mutually exclusive with all field properties.
+   *
+   * <p>
+   * If none are specified the default is to match any method regardless of what the method is
+   * annotated by.
+   *
+   * @return The class-name pattern that defines the annotation.
+   */
+  val methodAnnotatedByClassNamePattern: ClassNamePattern = ClassNamePattern(unqualifiedName = ""),
+
+  /**
+   * Define the method-access pattern by matching on access flags.
+   *
+   * <p>
+   * Mutually exclusive with all field properties.
+   *
+   * <p>
+   * If none, and other properties define this item as a method, the default matches any
+   * method-access flags.
+   *
+   * @return The method access-flag constraints that must be met.
+   */
+  val methodAccess: Array<MethodAccessFlags> = [],
+
+  /**
+   * Define the method-name pattern by an exact method name.
+   *
+   * <p>
+   * Mutually exclusive with all field properties.
+   *
+   * <p>
+   * If none, and other properties define this item as a method, the default matches any method
+   * name.
+   *
+   * <p>
+   * Mutually exclusive with the property `methodNamePattern` also defining method-name.
+   *
+   * @return The exact method name of the method.
+   */
+  val methodName: String = "",
+
+  /**
+   * Define the method-name pattern by a string pattern.
+   *
+   * <p>
+   * Mutually exclusive with all field properties.
+   *
+   * <p>
+   * If none, and other properties define this item as a method, the default matches any method
+   * name.
+   *
+   * <p>
+   * Mutually exclusive with the property `methodName` also defining method-name.
+   *
+   * @return The string pattern of the method name.
+   */
+  val methodNamePattern: StringPattern = StringPattern(exact = ""),
+
+  /**
+   * Define the method return-type pattern by a fully qualified type or 'void'.
+   *
+   * <p>
+   * Mutually exclusive with all field properties.
+   *
+   * <p>
+   * If none, and other properties define this item as a method, the default matches any return
+   * type.
+   *
+   * <p>
+   * Mutually exclusive with the following other properties defining return-type:
+   * <ul>
+   * <li>methodReturnTypeConstant
+   * <li>methodReturnTypePattern
+   * </ul>
+   *
+   * @return The qualified type name of the method return type.
+   */
+  val methodReturnType: String = "",
+
+  /**
+   * Define the method return-type pattern by a class constant.
+   *
+   * <p>
+   * Mutually exclusive with all field properties.
+   *
+   * <p>
+   * If none, and other properties define this item as a method, the default matches any return
+   * type.
+   *
+   * <p>
+   * Mutually exclusive with the following other properties defining return-type:
+   * <ul>
+   * <li>methodReturnType
+   * <li>methodReturnTypePattern
+   * </ul>
+   *
+   * @return A class constant denoting the type of the method return type.
+   */
+  val methodReturnTypeConstant: KClass<*> = Object::class,
+
+  /**
+   * Define the method return-type pattern by a type pattern.
+   *
+   * <p>
+   * Mutually exclusive with all field properties.
+   *
+   * <p>
+   * If none, and other properties define this item as a method, the default matches any return
+   * type.
+   *
+   * <p>
+   * Mutually exclusive with the following other properties defining return-type:
+   * <ul>
+   * <li>methodReturnType
+   * <li>methodReturnTypeConstant
+   * </ul>
+   *
+   * @return The pattern of the method return type.
+   */
+  val methodReturnTypePattern: TypePattern = TypePattern(name = ""),
+
+  /**
+   * Define the method parameters pattern by a list of fully qualified types.
+   *
+   * <p>
+   * Mutually exclusive with all field properties.
+   *
+   * <p>
+   * If none, and other properties define this item as a method, the default matches any parameters.
+   *
+   * <p>
+   * Mutually exclusive with the property `methodParameterTypePatterns` also defining parameters.
+   *
+   * @return The list of qualified type names of the method parameters.
+   */
+  val methodParameters: Array<String> = [""],
+
+  /**
+   * Define the method parameters pattern by a list of patterns on types.
+   *
+   * <p>
+   * Mutually exclusive with all field properties.
+   *
+   * <p>
+   * If none, and other properties define this item as a method, the default matches any parameters.
+   *
+   * <p>
+   * Mutually exclusive with the property `methodParameters` also defining parameters.
+   *
+   * @return The list of type patterns for the method parameters.
+   */
+  val methodParameterTypePatterns: Array<TypePattern> = [TypePattern(name = "")],
+
+  /**
+   * Define the field-annotated-by pattern by fully qualified class name.
+   *
+   * <p>
+   * Mutually exclusive with the following other properties defining field-annotated-by:
+   * <ul>
+   * <li>fieldAnnotatedByClassConstant
+   * <li>fieldAnnotatedByClassNamePattern
+   * </ul>
+   *
+   * <p>
+   * Mutually exclusive with all method properties.
+   *
+   * <p>
+   * If none are specified the default is to match any field regardless of what the field is
+   * annotated by.
+   *
+   * @return The qualified class name that defines the annotation.
+   */
+  val fieldAnnotatedByClassName: String = "",
+
+  /**
+   * Define the field-annotated-by pattern by reference to a Class constant.
+   *
+   * <p>
+   * Mutually exclusive with the following other properties defining field-annotated-by:
+   * <ul>
+   * <li>fieldAnnotatedByClassName
+   * <li>fieldAnnotatedByClassNamePattern
+   * </ul>
+   *
+   * <p>
+   * Mutually exclusive with all method properties.
+   *
+   * <p>
+   * If none are specified the default is to match any field regardless of what the field is
+   * annotated by.
+   *
+   * @return The class-constant that defines the annotation.
+   */
+  val fieldAnnotatedByClassConstant: KClass<*> = Object::class,
+
+  /**
+   * Define the field-annotated-by pattern by reference to a class-name pattern.
+   *
+   * <p>
+   * Mutually exclusive with the following other properties defining field-annotated-by:
+   * <ul>
+   * <li>fieldAnnotatedByClassName
+   * <li>fieldAnnotatedByClassConstant
+   * </ul>
+   *
+   * <p>
+   * Mutually exclusive with all method properties.
+   *
+   * <p>
+   * If none are specified the default is to match any field regardless of what the field is
+   * annotated by.
+   *
+   * @return The class-name pattern that defines the annotation.
+   */
+  val fieldAnnotatedByClassNamePattern: ClassNamePattern = ClassNamePattern(unqualifiedName = ""),
+
+  /**
+   * Define the field-access pattern by matching on access flags.
+   *
+   * <p>
+   * Mutually exclusive with all method properties.
+   *
+   * <p>
+   * If none, and other properties define this item as a field, the default matches any field-access
+   * flags.
+   *
+   * @return The field access-flag constraints that must be met.
+   */
+  val fieldAccess: Array<FieldAccessFlags> = [],
+
+  /**
+   * Define the field-name pattern by an exact field name.
+   *
+   * <p>
+   * Mutually exclusive with all method properties.
+   *
+   * <p>
+   * If none, and other properties define this item as a field, the default matches any field name.
+   *
+   * <p>
+   * Mutually exclusive with the property `fieldNamePattern` also defining field-name.
+   *
+   * @return The exact field name of the field.
+   */
+  val fieldName: String = "",
+
+  /**
+   * Define the field-name pattern by a string pattern.
+   *
+   * <p>
+   * Mutually exclusive with all method properties.
+   *
+   * <p>
+   * If none, and other properties define this item as a field, the default matches any field name.
+   *
+   * <p>
+   * Mutually exclusive with the property `fieldName` also defining field-name.
+   *
+   * @return The string pattern of the field name.
+   */
+  val fieldNamePattern: StringPattern = StringPattern(exact = ""),
+
+  /**
+   * Define the field-type pattern by a fully qualified type.
+   *
+   * <p>
+   * Mutually exclusive with all method properties.
+   *
+   * <p>
+   * If none, and other properties define this item as a field, the default matches any type.
+   *
+   * <p>
+   * Mutually exclusive with the following other properties defining field-type:
+   * <ul>
+   * <li>fieldTypeConstant
+   * <li>fieldTypePattern
+   * </ul>
+   *
+   * @return The qualified type name for the field type.
+   */
+  val fieldType: String = "",
+
+  /**
+   * Define the field-type pattern by a class constant.
+   *
+   * <p>
+   * Mutually exclusive with all method properties.
+   *
+   * <p>
+   * If none, and other properties define this item as a field, the default matches any type.
+   *
+   * <p>
+   * Mutually exclusive with the following other properties defining field-type:
+   * <ul>
+   * <li>fieldType
+   * <li>fieldTypePattern
+   * </ul>
+   *
+   * @return The class constant for the field type.
+   */
+  val fieldTypeConstant: KClass<*> = Object::class,
+
+  /**
+   * Define the field-type pattern by a pattern on types.
+   *
+   * <p>
+   * Mutually exclusive with all method properties.
+   *
+   * <p>
+   * If none, and other properties define this item as a field, the default matches any type.
+   *
+   * <p>
+   * Mutually exclusive with the following other properties defining field-type:
+   * <ul>
+   * <li>fieldType
+   * <li>fieldTypeConstant
+   * </ul>
+   *
+   * @return The type pattern for the field type.
+   */
+  val fieldTypePattern: TypePattern = TypePattern(name = ""),
+)
diff --git a/src/keepanno/java/androidx/annotation/keep/KeepCondition.java b/src/keepanno/java/androidx/annotation/keep/KeepCondition.java
deleted file mode 100644
index 1a0cd79..0000000
--- a/src/keepanno/java/androidx/annotation/keep/KeepCondition.java
+++ /dev/null
@@ -1,745 +0,0 @@
-/*
- * Copyright 2025 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.
- */
-
-// ***********************************************************************************
-// GENERATED FILE. DO NOT EDIT! See KeepItemAnnotationGenerator.java.
-// ***********************************************************************************
-
-// ***********************************************************************************
-// MAINTAINED AND TESTED IN THE R8 REPO. PLEASE MAKE CHANGES THERE AND REPLICATE.
-// ***********************************************************************************
-
-package androidx.annotation.keep;
-
-import java.lang.annotation.ElementType;
-import java.lang.annotation.Retention;
-import java.lang.annotation.RetentionPolicy;
-import java.lang.annotation.Target;
-
-/**
- * A condition for a keep edge.
- *
- * <p>The condition denotes an item used as a precondition of a rule. An item can be:
- *
- * <ul>
- *   <li>a pattern on classes;
- *   <li>a pattern on methods; or
- *   <li>a pattern on fields.
- * </ul>
- */
-@Target(ElementType.ANNOTATION_TYPE)
-@Retention(RetentionPolicy.CLASS)
-public @interface KeepCondition {
-
-  /**
-   * Define the class pattern by reference to a binding.
-   *
-   * <p>Mutually exclusive with the following other properties defining class:
-   *
-   * <ul>
-   *   <li>className
-   *   <li>classConstant
-   *   <li>classNamePattern
-   *   <li>instanceOfClassName
-   *   <li>instanceOfClassNameExclusive
-   *   <li>instanceOfClassConstant
-   *   <li>instanceOfClassConstantExclusive
-   *   <li>instanceOfPattern
-   *   <li>classAnnotatedByClassName
-   *   <li>classAnnotatedByClassConstant
-   *   <li>classAnnotatedByClassNamePattern
-   * </ul>
-   *
-   * <p>If none are specified the default is to match any class.
-   *
-   * @return The name of the binding that defines the class.
-   */
-  String classFromBinding() default "";
-
-  /**
-   * Define the class-name pattern by fully qualified class name.
-   *
-   * <p>Mutually exclusive with the following other properties defining class-name:
-   *
-   * <ul>
-   *   <li>classConstant
-   *   <li>classNamePattern
-   *   <li>classFromBinding
-   * </ul>
-   *
-   * <p>If none are specified the default is to match any class name.
-   *
-   * @return The qualified class name that defines the class.
-   */
-  String className() default "";
-
-  /**
-   * Define the class-name pattern by reference to a Class constant.
-   *
-   * <p>Mutually exclusive with the following other properties defining class-name:
-   *
-   * <ul>
-   *   <li>className
-   *   <li>classNamePattern
-   *   <li>classFromBinding
-   * </ul>
-   *
-   * <p>If none are specified the default is to match any class name.
-   *
-   * @return The class-constant that defines the class.
-   */
-  Class<?> classConstant() default Object.class;
-
-  /**
-   * Define the class-name pattern by reference to a class-name pattern.
-   *
-   * <p>Mutually exclusive with the following other properties defining class-name:
-   *
-   * <ul>
-   *   <li>className
-   *   <li>classConstant
-   *   <li>classFromBinding
-   * </ul>
-   *
-   * <p>If none are specified the default is to match any class name.
-   *
-   * @return The class-name pattern that defines the class.
-   */
-  ClassNamePattern classNamePattern() default @ClassNamePattern(unqualifiedName = "");
-
-  /**
-   * Define the instance-of pattern as classes that are instances of the fully qualified class name.
-   *
-   * <p>Mutually exclusive with the following other properties defining instance-of:
-   *
-   * <ul>
-   *   <li>instanceOfClassNameExclusive
-   *   <li>instanceOfClassConstant
-   *   <li>instanceOfClassConstantExclusive
-   *   <li>instanceOfPattern
-   *   <li>classFromBinding
-   * </ul>
-   *
-   * <p>If none are specified the default is to match any class instance.
-   *
-   * @return The qualified class name that defines what instance-of the class must be.
-   */
-  String instanceOfClassName() default "";
-
-  /**
-   * Define the instance-of pattern as classes that are instances of the fully qualified class name.
-   *
-   * <p>The pattern is exclusive in that it does not match classes that are instances of the
-   * pattern, but only those that are instances of classes that are subclasses of the pattern.
-   *
-   * <p>Mutually exclusive with the following other properties defining instance-of:
-   *
-   * <ul>
-   *   <li>instanceOfClassName
-   *   <li>instanceOfClassConstant
-   *   <li>instanceOfClassConstantExclusive
-   *   <li>instanceOfPattern
-   *   <li>classFromBinding
-   * </ul>
-   *
-   * <p>If none are specified the default is to match any class instance.
-   *
-   * @return The qualified class name that defines what instance-of the class must be.
-   */
-  String instanceOfClassNameExclusive() default "";
-
-  /**
-   * Define the instance-of pattern as classes that are instances the referenced Class constant.
-   *
-   * <p>Mutually exclusive with the following other properties defining instance-of:
-   *
-   * <ul>
-   *   <li>instanceOfClassName
-   *   <li>instanceOfClassNameExclusive
-   *   <li>instanceOfClassConstantExclusive
-   *   <li>instanceOfPattern
-   *   <li>classFromBinding
-   * </ul>
-   *
-   * <p>If none are specified the default is to match any class instance.
-   *
-   * @return The class constant that defines what instance-of the class must be.
-   */
-  Class<?> instanceOfClassConstant() default Object.class;
-
-  /**
-   * Define the instance-of pattern as classes that are instances the referenced Class constant.
-   *
-   * <p>The pattern is exclusive in that it does not match classes that are instances of the
-   * pattern, but only those that are instances of classes that are subclasses of the pattern.
-   *
-   * <p>Mutually exclusive with the following other properties defining instance-of:
-   *
-   * <ul>
-   *   <li>instanceOfClassName
-   *   <li>instanceOfClassNameExclusive
-   *   <li>instanceOfClassConstant
-   *   <li>instanceOfPattern
-   *   <li>classFromBinding
-   * </ul>
-   *
-   * <p>If none are specified the default is to match any class instance.
-   *
-   * @return The class constant that defines what instance-of the class must be.
-   */
-  Class<?> instanceOfClassConstantExclusive() default Object.class;
-
-  /**
-   * Define the instance-of with a pattern.
-   *
-   * <p>Mutually exclusive with the following other properties defining instance-of:
-   *
-   * <ul>
-   *   <li>instanceOfClassName
-   *   <li>instanceOfClassNameExclusive
-   *   <li>instanceOfClassConstant
-   *   <li>instanceOfClassConstantExclusive
-   *   <li>classFromBinding
-   * </ul>
-   *
-   * <p>If none are specified the default is to match any class instance.
-   *
-   * @return The pattern that defines what instance-of the class must be.
-   */
-  InstanceOfPattern instanceOfPattern() default @InstanceOfPattern();
-
-  /**
-   * Define the class-annotated-by pattern by fully qualified class name.
-   *
-   * <p>Mutually exclusive with the following other properties defining class-annotated-by:
-   *
-   * <ul>
-   *   <li>classAnnotatedByClassConstant
-   *   <li>classAnnotatedByClassNamePattern
-   *   <li>classFromBinding
-   * </ul>
-   *
-   * <p>If none are specified the default is to match any class regardless of what the class is
-   * annotated by.
-   *
-   * @return The qualified class name that defines the annotation.
-   */
-  String classAnnotatedByClassName() default "";
-
-  /**
-   * Define the class-annotated-by pattern by reference to a Class constant.
-   *
-   * <p>Mutually exclusive with the following other properties defining class-annotated-by:
-   *
-   * <ul>
-   *   <li>classAnnotatedByClassName
-   *   <li>classAnnotatedByClassNamePattern
-   *   <li>classFromBinding
-   * </ul>
-   *
-   * <p>If none are specified the default is to match any class regardless of what the class is
-   * annotated by.
-   *
-   * @return The class-constant that defines the annotation.
-   */
-  Class<?> classAnnotatedByClassConstant() default Object.class;
-
-  /**
-   * Define the class-annotated-by pattern by reference to a class-name pattern.
-   *
-   * <p>Mutually exclusive with the following other properties defining class-annotated-by:
-   *
-   * <ul>
-   *   <li>classAnnotatedByClassName
-   *   <li>classAnnotatedByClassConstant
-   *   <li>classFromBinding
-   * </ul>
-   *
-   * <p>If none are specified the default is to match any class regardless of what the class is
-   * annotated by.
-   *
-   * @return The class-name pattern that defines the annotation.
-   */
-  ClassNamePattern classAnnotatedByClassNamePattern() default
-      @ClassNamePattern(unqualifiedName = "");
-
-  /**
-   * Define the member pattern in full by a reference to a binding.
-   *
-   * <p>Mutually exclusive with all other class and member pattern properties. When a member binding
-   * is referenced this item is defined to be that item, including its class and member patterns.
-   *
-   * @return The binding name that defines the member.
-   */
-  String memberFromBinding() default "";
-
-  /**
-   * Define the member-annotated-by pattern by fully qualified class name.
-   *
-   * <p>Mutually exclusive with the following other properties defining member-annotated-by:
-   *
-   * <ul>
-   *   <li>memberAnnotatedByClassConstant
-   *   <li>memberAnnotatedByClassNamePattern
-   *   <li>memberFromBinding
-   * </ul>
-   *
-   * <p>Mutually exclusive with all field and method properties as use restricts the match to both
-   * types of members.
-   *
-   * <p>If none are specified the default is to match any member regardless of what the member is
-   * annotated by.
-   *
-   * @return The qualified class name that defines the annotation.
-   */
-  String memberAnnotatedByClassName() default "";
-
-  /**
-   * Define the member-annotated-by pattern by reference to a Class constant.
-   *
-   * <p>Mutually exclusive with the following other properties defining member-annotated-by:
-   *
-   * <ul>
-   *   <li>memberAnnotatedByClassName
-   *   <li>memberAnnotatedByClassNamePattern
-   *   <li>memberFromBinding
-   * </ul>
-   *
-   * <p>Mutually exclusive with all field and method properties as use restricts the match to both
-   * types of members.
-   *
-   * <p>If none are specified the default is to match any member regardless of what the member is
-   * annotated by.
-   *
-   * @return The class-constant that defines the annotation.
-   */
-  Class<?> memberAnnotatedByClassConstant() default Object.class;
-
-  /**
-   * Define the member-annotated-by pattern by reference to a class-name pattern.
-   *
-   * <p>Mutually exclusive with the following other properties defining member-annotated-by:
-   *
-   * <ul>
-   *   <li>memberAnnotatedByClassName
-   *   <li>memberAnnotatedByClassConstant
-   *   <li>memberFromBinding
-   * </ul>
-   *
-   * <p>Mutually exclusive with all field and method properties as use restricts the match to both
-   * types of members.
-   *
-   * <p>If none are specified the default is to match any member regardless of what the member is
-   * annotated by.
-   *
-   * @return The class-name pattern that defines the annotation.
-   */
-  ClassNamePattern memberAnnotatedByClassNamePattern() default
-      @ClassNamePattern(unqualifiedName = "");
-
-  /**
-   * Define the member-access pattern by matching on access flags.
-   *
-   * <p>Mutually exclusive with all field and method properties as use restricts the match to both
-   * types of members.
-   *
-   * <p>Mutually exclusive with the property `memberFromBinding` also defining member-access.
-   *
-   * @return The member access-flag constraints that must be met.
-   */
-  MemberAccessFlags[] memberAccess() default {};
-
-  /**
-   * Define the method-annotated-by pattern by fully qualified class name.
-   *
-   * <p>Mutually exclusive with the following other properties defining method-annotated-by:
-   *
-   * <ul>
-   *   <li>methodAnnotatedByClassConstant
-   *   <li>methodAnnotatedByClassNamePattern
-   *   <li>memberFromBinding
-   * </ul>
-   *
-   * <p>Mutually exclusive with all field properties.
-   *
-   * <p>If none are specified the default is to match any method regardless of what the method is
-   * annotated by.
-   *
-   * @return The qualified class name that defines the annotation.
-   */
-  String methodAnnotatedByClassName() default "";
-
-  /**
-   * Define the method-annotated-by pattern by reference to a Class constant.
-   *
-   * <p>Mutually exclusive with the following other properties defining method-annotated-by:
-   *
-   * <ul>
-   *   <li>methodAnnotatedByClassName
-   *   <li>methodAnnotatedByClassNamePattern
-   *   <li>memberFromBinding
-   * </ul>
-   *
-   * <p>Mutually exclusive with all field properties.
-   *
-   * <p>If none are specified the default is to match any method regardless of what the method is
-   * annotated by.
-   *
-   * @return The class-constant that defines the annotation.
-   */
-  Class<?> methodAnnotatedByClassConstant() default Object.class;
-
-  /**
-   * Define the method-annotated-by pattern by reference to a class-name pattern.
-   *
-   * <p>Mutually exclusive with the following other properties defining method-annotated-by:
-   *
-   * <ul>
-   *   <li>methodAnnotatedByClassName
-   *   <li>methodAnnotatedByClassConstant
-   *   <li>memberFromBinding
-   * </ul>
-   *
-   * <p>Mutually exclusive with all field properties.
-   *
-   * <p>If none are specified the default is to match any method regardless of what the method is
-   * annotated by.
-   *
-   * @return The class-name pattern that defines the annotation.
-   */
-  ClassNamePattern methodAnnotatedByClassNamePattern() default
-      @ClassNamePattern(unqualifiedName = "");
-
-  /**
-   * Define the method-access pattern by matching on access flags.
-   *
-   * <p>Mutually exclusive with all field properties.
-   *
-   * <p>If none, and other properties define this item as a method, the default matches any
-   * method-access flags.
-   *
-   * <p>Mutually exclusive with the property `memberFromBinding` also defining method-access.
-   *
-   * @return The method access-flag constraints that must be met.
-   */
-  MethodAccessFlags[] methodAccess() default {};
-
-  /**
-   * Define the method-name pattern by an exact method name.
-   *
-   * <p>Mutually exclusive with all field properties.
-   *
-   * <p>If none, and other properties define this item as a method, the default matches any method
-   * name.
-   *
-   * <p>Mutually exclusive with the following other properties defining method-name:
-   *
-   * <ul>
-   *   <li>methodNamePattern
-   *   <li>memberFromBinding
-   * </ul>
-   *
-   * @return The exact method name of the method.
-   */
-  String methodName() default "";
-
-  /**
-   * Define the method-name pattern by a string pattern.
-   *
-   * <p>Mutually exclusive with all field properties.
-   *
-   * <p>If none, and other properties define this item as a method, the default matches any method
-   * name.
-   *
-   * <p>Mutually exclusive with the following other properties defining method-name:
-   *
-   * <ul>
-   *   <li>methodName
-   *   <li>memberFromBinding
-   * </ul>
-   *
-   * @return The string pattern of the method name.
-   */
-  StringPattern methodNamePattern() default @StringPattern(exact = "");
-
-  /**
-   * Define the method return-type pattern by a fully qualified type or 'void'.
-   *
-   * <p>Mutually exclusive with all field properties.
-   *
-   * <p>If none, and other properties define this item as a method, the default matches any return
-   * type.
-   *
-   * <p>Mutually exclusive with the following other properties defining return-type:
-   *
-   * <ul>
-   *   <li>methodReturnTypeConstant
-   *   <li>methodReturnTypePattern
-   *   <li>memberFromBinding
-   * </ul>
-   *
-   * @return The qualified type name of the method return type.
-   */
-  String methodReturnType() default "";
-
-  /**
-   * Define the method return-type pattern by a class constant.
-   *
-   * <p>Mutually exclusive with all field properties.
-   *
-   * <p>If none, and other properties define this item as a method, the default matches any return
-   * type.
-   *
-   * <p>Mutually exclusive with the following other properties defining return-type:
-   *
-   * <ul>
-   *   <li>methodReturnType
-   *   <li>methodReturnTypePattern
-   *   <li>memberFromBinding
-   * </ul>
-   *
-   * @return A class constant denoting the type of the method return type.
-   */
-  Class<?> methodReturnTypeConstant() default Object.class;
-
-  /**
-   * Define the method return-type pattern by a type pattern.
-   *
-   * <p>Mutually exclusive with all field properties.
-   *
-   * <p>If none, and other properties define this item as a method, the default matches any return
-   * type.
-   *
-   * <p>Mutually exclusive with the following other properties defining return-type:
-   *
-   * <ul>
-   *   <li>methodReturnType
-   *   <li>methodReturnTypeConstant
-   *   <li>memberFromBinding
-   * </ul>
-   *
-   * @return The pattern of the method return type.
-   */
-  TypePattern methodReturnTypePattern() default @TypePattern(name = "");
-
-  /**
-   * Define the method parameters pattern by a list of fully qualified types.
-   *
-   * <p>Mutually exclusive with all field properties.
-   *
-   * <p>If none, and other properties define this item as a method, the default matches any
-   * parameters.
-   *
-   * <p>Mutually exclusive with the following other properties defining parameters:
-   *
-   * <ul>
-   *   <li>methodParameterTypePatterns
-   *   <li>memberFromBinding
-   * </ul>
-   *
-   * @return The list of qualified type names of the method parameters.
-   */
-  String[] methodParameters() default {""};
-
-  /**
-   * Define the method parameters pattern by a list of patterns on types.
-   *
-   * <p>Mutually exclusive with all field properties.
-   *
-   * <p>If none, and other properties define this item as a method, the default matches any
-   * parameters.
-   *
-   * <p>Mutually exclusive with the following other properties defining parameters:
-   *
-   * <ul>
-   *   <li>methodParameters
-   *   <li>memberFromBinding
-   * </ul>
-   *
-   * @return The list of type patterns for the method parameters.
-   */
-  TypePattern[] methodParameterTypePatterns() default {@TypePattern(name = "")};
-
-  /**
-   * Define the field-annotated-by pattern by fully qualified class name.
-   *
-   * <p>Mutually exclusive with the following other properties defining field-annotated-by:
-   *
-   * <ul>
-   *   <li>fieldAnnotatedByClassConstant
-   *   <li>fieldAnnotatedByClassNamePattern
-   *   <li>memberFromBinding
-   * </ul>
-   *
-   * <p>Mutually exclusive with all method properties.
-   *
-   * <p>If none are specified the default is to match any field regardless of what the field is
-   * annotated by.
-   *
-   * @return The qualified class name that defines the annotation.
-   */
-  String fieldAnnotatedByClassName() default "";
-
-  /**
-   * Define the field-annotated-by pattern by reference to a Class constant.
-   *
-   * <p>Mutually exclusive with the following other properties defining field-annotated-by:
-   *
-   * <ul>
-   *   <li>fieldAnnotatedByClassName
-   *   <li>fieldAnnotatedByClassNamePattern
-   *   <li>memberFromBinding
-   * </ul>
-   *
-   * <p>Mutually exclusive with all method properties.
-   *
-   * <p>If none are specified the default is to match any field regardless of what the field is
-   * annotated by.
-   *
-   * @return The class-constant that defines the annotation.
-   */
-  Class<?> fieldAnnotatedByClassConstant() default Object.class;
-
-  /**
-   * Define the field-annotated-by pattern by reference to a class-name pattern.
-   *
-   * <p>Mutually exclusive with the following other properties defining field-annotated-by:
-   *
-   * <ul>
-   *   <li>fieldAnnotatedByClassName
-   *   <li>fieldAnnotatedByClassConstant
-   *   <li>memberFromBinding
-   * </ul>
-   *
-   * <p>Mutually exclusive with all method properties.
-   *
-   * <p>If none are specified the default is to match any field regardless of what the field is
-   * annotated by.
-   *
-   * @return The class-name pattern that defines the annotation.
-   */
-  ClassNamePattern fieldAnnotatedByClassNamePattern() default
-      @ClassNamePattern(unqualifiedName = "");
-
-  /**
-   * Define the field-access pattern by matching on access flags.
-   *
-   * <p>Mutually exclusive with all method properties.
-   *
-   * <p>If none, and other properties define this item as a field, the default matches any
-   * field-access flags.
-   *
-   * <p>Mutually exclusive with the property `memberFromBinding` also defining field-access.
-   *
-   * @return The field access-flag constraints that must be met.
-   */
-  FieldAccessFlags[] fieldAccess() default {};
-
-  /**
-   * Define the field-name pattern by an exact field name.
-   *
-   * <p>Mutually exclusive with all method properties.
-   *
-   * <p>If none, and other properties define this item as a field, the default matches any field
-   * name.
-   *
-   * <p>Mutually exclusive with the following other properties defining field-name:
-   *
-   * <ul>
-   *   <li>fieldNamePattern
-   *   <li>memberFromBinding
-   * </ul>
-   *
-   * @return The exact field name of the field.
-   */
-  String fieldName() default "";
-
-  /**
-   * Define the field-name pattern by a string pattern.
-   *
-   * <p>Mutually exclusive with all method properties.
-   *
-   * <p>If none, and other properties define this item as a field, the default matches any field
-   * name.
-   *
-   * <p>Mutually exclusive with the following other properties defining field-name:
-   *
-   * <ul>
-   *   <li>fieldName
-   *   <li>memberFromBinding
-   * </ul>
-   *
-   * @return The string pattern of the field name.
-   */
-  StringPattern fieldNamePattern() default @StringPattern(exact = "");
-
-  /**
-   * Define the field-type pattern by a fully qualified type.
-   *
-   * <p>Mutually exclusive with all method properties.
-   *
-   * <p>If none, and other properties define this item as a field, the default matches any type.
-   *
-   * <p>Mutually exclusive with the following other properties defining field-type:
-   *
-   * <ul>
-   *   <li>fieldTypeConstant
-   *   <li>fieldTypePattern
-   *   <li>memberFromBinding
-   * </ul>
-   *
-   * @return The qualified type name for the field type.
-   */
-  String fieldType() default "";
-
-  /**
-   * Define the field-type pattern by a class constant.
-   *
-   * <p>Mutually exclusive with all method properties.
-   *
-   * <p>If none, and other properties define this item as a field, the default matches any type.
-   *
-   * <p>Mutually exclusive with the following other properties defining field-type:
-   *
-   * <ul>
-   *   <li>fieldType
-   *   <li>fieldTypePattern
-   *   <li>memberFromBinding
-   * </ul>
-   *
-   * @return The class constant for the field type.
-   */
-  Class<?> fieldTypeConstant() default Object.class;
-
-  /**
-   * Define the field-type pattern by a pattern on types.
-   *
-   * <p>Mutually exclusive with all method properties.
-   *
-   * <p>If none, and other properties define this item as a field, the default matches any type.
-   *
-   * <p>Mutually exclusive with the following other properties defining field-type:
-   *
-   * <ul>
-   *   <li>fieldType
-   *   <li>fieldTypeConstant
-   *   <li>memberFromBinding
-   * </ul>
-   *
-   * @return The type pattern for the field type.
-   */
-  TypePattern fieldTypePattern() default @TypePattern(name = "");
-}
diff --git a/src/keepanno/java/androidx/annotation/keep/KeepCondition.kt b/src/keepanno/java/androidx/annotation/keep/KeepCondition.kt
new file mode 100644
index 0000000..a4fcddc
--- /dev/null
+++ b/src/keepanno/java/androidx/annotation/keep/KeepCondition.kt
@@ -0,0 +1,801 @@
+/*
+ * Copyright 2025 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.
+ */
+
+// ***********************************************************************************
+// GENERATED FILE. DO NOT EDIT! See KeepItemAnnotationGenerator.java.
+// ***********************************************************************************
+
+// ***********************************************************************************
+// MAINTAINED AND TESTED IN THE R8 REPO. PLEASE MAKE CHANGES THERE AND REPLICATE.
+// ***********************************************************************************
+
+package androidx.annotation.keep
+
+import kotlin.annotation.Retention
+import kotlin.annotation.Target
+import kotlin.reflect.KClass
+
+/**
+ * A condition for a keep edge.
+ *
+ * <p>
+ * The condition denotes an item used as a precondition of a rule. An item can be:
+ * <ul>
+ * <li>a pattern on classes;
+ * <li>a pattern on methods; or
+ * <li>a pattern on fields.
+ * </ul>
+ */
+@Retention(AnnotationRetention.BINARY)
+@Target(AnnotationTarget.ANNOTATION_CLASS)
+annotation class KeepCondition(
+
+  /**
+   * Define the class pattern by reference to a binding.
+   *
+   * <p>
+   * Mutually exclusive with the following other properties defining class:
+   * <ul>
+   * <li>className
+   * <li>classConstant
+   * <li>classNamePattern
+   * <li>instanceOfClassName
+   * <li>instanceOfClassNameExclusive
+   * <li>instanceOfClassConstant
+   * <li>instanceOfClassConstantExclusive
+   * <li>instanceOfPattern
+   * <li>classAnnotatedByClassName
+   * <li>classAnnotatedByClassConstant
+   * <li>classAnnotatedByClassNamePattern
+   * </ul>
+   *
+   * <p>
+   * If none are specified the default is to match any class.
+   *
+   * @return The name of the binding that defines the class.
+   */
+  val classFromBinding: String = "",
+
+  /**
+   * Define the class-name pattern by fully qualified class name.
+   *
+   * <p>
+   * Mutually exclusive with the following other properties defining class-name:
+   * <ul>
+   * <li>classConstant
+   * <li>classNamePattern
+   * <li>classFromBinding
+   * </ul>
+   *
+   * <p>
+   * If none are specified the default is to match any class name.
+   *
+   * @return The qualified class name that defines the class.
+   */
+  val className: String = "",
+
+  /**
+   * Define the class-name pattern by reference to a Class constant.
+   *
+   * <p>
+   * Mutually exclusive with the following other properties defining class-name:
+   * <ul>
+   * <li>className
+   * <li>classNamePattern
+   * <li>classFromBinding
+   * </ul>
+   *
+   * <p>
+   * If none are specified the default is to match any class name.
+   *
+   * @return The class-constant that defines the class.
+   */
+  val classConstant: KClass<*> = Object::class,
+
+  /**
+   * Define the class-name pattern by reference to a class-name pattern.
+   *
+   * <p>
+   * Mutually exclusive with the following other properties defining class-name:
+   * <ul>
+   * <li>className
+   * <li>classConstant
+   * <li>classFromBinding
+   * </ul>
+   *
+   * <p>
+   * If none are specified the default is to match any class name.
+   *
+   * @return The class-name pattern that defines the class.
+   */
+  val classNamePattern: ClassNamePattern = ClassNamePattern(unqualifiedName = ""),
+
+  /**
+   * Define the instance-of pattern as classes that are instances of the fully qualified class name.
+   *
+   * <p>
+   * Mutually exclusive with the following other properties defining instance-of:
+   * <ul>
+   * <li>instanceOfClassNameExclusive
+   * <li>instanceOfClassConstant
+   * <li>instanceOfClassConstantExclusive
+   * <li>instanceOfPattern
+   * <li>classFromBinding
+   * </ul>
+   *
+   * <p>
+   * If none are specified the default is to match any class instance.
+   *
+   * @return The qualified class name that defines what instance-of the class must be.
+   */
+  val instanceOfClassName: String = "",
+
+  /**
+   * Define the instance-of pattern as classes that are instances of the fully qualified class name.
+   *
+   * <p>
+   * The pattern is exclusive in that it does not match classes that are instances of the pattern,
+   * but only those that are instances of classes that are subclasses of the pattern.
+   *
+   * <p>
+   * Mutually exclusive with the following other properties defining instance-of:
+   * <ul>
+   * <li>instanceOfClassName
+   * <li>instanceOfClassConstant
+   * <li>instanceOfClassConstantExclusive
+   * <li>instanceOfPattern
+   * <li>classFromBinding
+   * </ul>
+   *
+   * <p>
+   * If none are specified the default is to match any class instance.
+   *
+   * @return The qualified class name that defines what instance-of the class must be.
+   */
+  val instanceOfClassNameExclusive: String = "",
+
+  /**
+   * Define the instance-of pattern as classes that are instances the referenced Class constant.
+   *
+   * <p>
+   * Mutually exclusive with the following other properties defining instance-of:
+   * <ul>
+   * <li>instanceOfClassName
+   * <li>instanceOfClassNameExclusive
+   * <li>instanceOfClassConstantExclusive
+   * <li>instanceOfPattern
+   * <li>classFromBinding
+   * </ul>
+   *
+   * <p>
+   * If none are specified the default is to match any class instance.
+   *
+   * @return The class constant that defines what instance-of the class must be.
+   */
+  val instanceOfClassConstant: KClass<*> = Object::class,
+
+  /**
+   * Define the instance-of pattern as classes that are instances the referenced Class constant.
+   *
+   * <p>
+   * The pattern is exclusive in that it does not match classes that are instances of the pattern,
+   * but only those that are instances of classes that are subclasses of the pattern.
+   *
+   * <p>
+   * Mutually exclusive with the following other properties defining instance-of:
+   * <ul>
+   * <li>instanceOfClassName
+   * <li>instanceOfClassNameExclusive
+   * <li>instanceOfClassConstant
+   * <li>instanceOfPattern
+   * <li>classFromBinding
+   * </ul>
+   *
+   * <p>
+   * If none are specified the default is to match any class instance.
+   *
+   * @return The class constant that defines what instance-of the class must be.
+   */
+  val instanceOfClassConstantExclusive: KClass<*> = Object::class,
+
+  /**
+   * Define the instance-of with a pattern.
+   *
+   * <p>
+   * Mutually exclusive with the following other properties defining instance-of:
+   * <ul>
+   * <li>instanceOfClassName
+   * <li>instanceOfClassNameExclusive
+   * <li>instanceOfClassConstant
+   * <li>instanceOfClassConstantExclusive
+   * <li>classFromBinding
+   * </ul>
+   *
+   * <p>
+   * If none are specified the default is to match any class instance.
+   *
+   * @return The pattern that defines what instance-of the class must be.
+   */
+  val instanceOfPattern: InstanceOfPattern = InstanceOfPattern(),
+
+  /**
+   * Define the class-annotated-by pattern by fully qualified class name.
+   *
+   * <p>
+   * Mutually exclusive with the following other properties defining class-annotated-by:
+   * <ul>
+   * <li>classAnnotatedByClassConstant
+   * <li>classAnnotatedByClassNamePattern
+   * <li>classFromBinding
+   * </ul>
+   *
+   * <p>
+   * If none are specified the default is to match any class regardless of what the class is
+   * annotated by.
+   *
+   * @return The qualified class name that defines the annotation.
+   */
+  val classAnnotatedByClassName: String = "",
+
+  /**
+   * Define the class-annotated-by pattern by reference to a Class constant.
+   *
+   * <p>
+   * Mutually exclusive with the following other properties defining class-annotated-by:
+   * <ul>
+   * <li>classAnnotatedByClassName
+   * <li>classAnnotatedByClassNamePattern
+   * <li>classFromBinding
+   * </ul>
+   *
+   * <p>
+   * If none are specified the default is to match any class regardless of what the class is
+   * annotated by.
+   *
+   * @return The class-constant that defines the annotation.
+   */
+  val classAnnotatedByClassConstant: KClass<*> = Object::class,
+
+  /**
+   * Define the class-annotated-by pattern by reference to a class-name pattern.
+   *
+   * <p>
+   * Mutually exclusive with the following other properties defining class-annotated-by:
+   * <ul>
+   * <li>classAnnotatedByClassName
+   * <li>classAnnotatedByClassConstant
+   * <li>classFromBinding
+   * </ul>
+   *
+   * <p>
+   * If none are specified the default is to match any class regardless of what the class is
+   * annotated by.
+   *
+   * @return The class-name pattern that defines the annotation.
+   */
+  val classAnnotatedByClassNamePattern: ClassNamePattern = ClassNamePattern(unqualifiedName = ""),
+
+  /**
+   * Define the member pattern in full by a reference to a binding.
+   *
+   * <p>
+   * Mutually exclusive with all other class and member pattern properties. When a member binding is
+   * referenced this item is defined to be that item, including its class and member patterns.
+   *
+   * @return The binding name that defines the member.
+   */
+  val memberFromBinding: String = "",
+
+  /**
+   * Define the member-annotated-by pattern by fully qualified class name.
+   *
+   * <p>
+   * Mutually exclusive with the following other properties defining member-annotated-by:
+   * <ul>
+   * <li>memberAnnotatedByClassConstant
+   * <li>memberAnnotatedByClassNamePattern
+   * <li>memberFromBinding
+   * </ul>
+   *
+   * <p>
+   * Mutually exclusive with all field and method properties as use restricts the match to both
+   * types of members.
+   *
+   * <p>
+   * If none are specified the default is to match any member regardless of what the member is
+   * annotated by.
+   *
+   * @return The qualified class name that defines the annotation.
+   */
+  val memberAnnotatedByClassName: String = "",
+
+  /**
+   * Define the member-annotated-by pattern by reference to a Class constant.
+   *
+   * <p>
+   * Mutually exclusive with the following other properties defining member-annotated-by:
+   * <ul>
+   * <li>memberAnnotatedByClassName
+   * <li>memberAnnotatedByClassNamePattern
+   * <li>memberFromBinding
+   * </ul>
+   *
+   * <p>
+   * Mutually exclusive with all field and method properties as use restricts the match to both
+   * types of members.
+   *
+   * <p>
+   * If none are specified the default is to match any member regardless of what the member is
+   * annotated by.
+   *
+   * @return The class-constant that defines the annotation.
+   */
+  val memberAnnotatedByClassConstant: KClass<*> = Object::class,
+
+  /**
+   * Define the member-annotated-by pattern by reference to a class-name pattern.
+   *
+   * <p>
+   * Mutually exclusive with the following other properties defining member-annotated-by:
+   * <ul>
+   * <li>memberAnnotatedByClassName
+   * <li>memberAnnotatedByClassConstant
+   * <li>memberFromBinding
+   * </ul>
+   *
+   * <p>
+   * Mutually exclusive with all field and method properties as use restricts the match to both
+   * types of members.
+   *
+   * <p>
+   * If none are specified the default is to match any member regardless of what the member is
+   * annotated by.
+   *
+   * @return The class-name pattern that defines the annotation.
+   */
+  val memberAnnotatedByClassNamePattern: ClassNamePattern = ClassNamePattern(unqualifiedName = ""),
+
+  /**
+   * Define the member-access pattern by matching on access flags.
+   *
+   * <p>
+   * Mutually exclusive with all field and method properties as use restricts the match to both
+   * types of members.
+   *
+   * <p>
+   * Mutually exclusive with the property `memberFromBinding` also defining member-access.
+   *
+   * @return The member access-flag constraints that must be met.
+   */
+  val memberAccess: Array<MemberAccessFlags> = [],
+
+  /**
+   * Define the method-annotated-by pattern by fully qualified class name.
+   *
+   * <p>
+   * Mutually exclusive with the following other properties defining method-annotated-by:
+   * <ul>
+   * <li>methodAnnotatedByClassConstant
+   * <li>methodAnnotatedByClassNamePattern
+   * <li>memberFromBinding
+   * </ul>
+   *
+   * <p>
+   * Mutually exclusive with all field properties.
+   *
+   * <p>
+   * If none are specified the default is to match any method regardless of what the method is
+   * annotated by.
+   *
+   * @return The qualified class name that defines the annotation.
+   */
+  val methodAnnotatedByClassName: String = "",
+
+  /**
+   * Define the method-annotated-by pattern by reference to a Class constant.
+   *
+   * <p>
+   * Mutually exclusive with the following other properties defining method-annotated-by:
+   * <ul>
+   * <li>methodAnnotatedByClassName
+   * <li>methodAnnotatedByClassNamePattern
+   * <li>memberFromBinding
+   * </ul>
+   *
+   * <p>
+   * Mutually exclusive with all field properties.
+   *
+   * <p>
+   * If none are specified the default is to match any method regardless of what the method is
+   * annotated by.
+   *
+   * @return The class-constant that defines the annotation.
+   */
+  val methodAnnotatedByClassConstant: KClass<*> = Object::class,
+
+  /**
+   * Define the method-annotated-by pattern by reference to a class-name pattern.
+   *
+   * <p>
+   * Mutually exclusive with the following other properties defining method-annotated-by:
+   * <ul>
+   * <li>methodAnnotatedByClassName
+   * <li>methodAnnotatedByClassConstant
+   * <li>memberFromBinding
+   * </ul>
+   *
+   * <p>
+   * Mutually exclusive with all field properties.
+   *
+   * <p>
+   * If none are specified the default is to match any method regardless of what the method is
+   * annotated by.
+   *
+   * @return The class-name pattern that defines the annotation.
+   */
+  val methodAnnotatedByClassNamePattern: ClassNamePattern = ClassNamePattern(unqualifiedName = ""),
+
+  /**
+   * Define the method-access pattern by matching on access flags.
+   *
+   * <p>
+   * Mutually exclusive with all field properties.
+   *
+   * <p>
+   * If none, and other properties define this item as a method, the default matches any
+   * method-access flags.
+   *
+   * <p>
+   * Mutually exclusive with the property `memberFromBinding` also defining method-access.
+   *
+   * @return The method access-flag constraints that must be met.
+   */
+  val methodAccess: Array<MethodAccessFlags> = [],
+
+  /**
+   * Define the method-name pattern by an exact method name.
+   *
+   * <p>
+   * Mutually exclusive with all field properties.
+   *
+   * <p>
+   * If none, and other properties define this item as a method, the default matches any method
+   * name.
+   *
+   * <p>
+   * Mutually exclusive with the following other properties defining method-name:
+   * <ul>
+   * <li>methodNamePattern
+   * <li>memberFromBinding
+   * </ul>
+   *
+   * @return The exact method name of the method.
+   */
+  val methodName: String = "",
+
+  /**
+   * Define the method-name pattern by a string pattern.
+   *
+   * <p>
+   * Mutually exclusive with all field properties.
+   *
+   * <p>
+   * If none, and other properties define this item as a method, the default matches any method
+   * name.
+   *
+   * <p>
+   * Mutually exclusive with the following other properties defining method-name:
+   * <ul>
+   * <li>methodName
+   * <li>memberFromBinding
+   * </ul>
+   *
+   * @return The string pattern of the method name.
+   */
+  val methodNamePattern: StringPattern = StringPattern(exact = ""),
+
+  /**
+   * Define the method return-type pattern by a fully qualified type or 'void'.
+   *
+   * <p>
+   * Mutually exclusive with all field properties.
+   *
+   * <p>
+   * If none, and other properties define this item as a method, the default matches any return
+   * type.
+   *
+   * <p>
+   * Mutually exclusive with the following other properties defining return-type:
+   * <ul>
+   * <li>methodReturnTypeConstant
+   * <li>methodReturnTypePattern
+   * <li>memberFromBinding
+   * </ul>
+   *
+   * @return The qualified type name of the method return type.
+   */
+  val methodReturnType: String = "",
+
+  /**
+   * Define the method return-type pattern by a class constant.
+   *
+   * <p>
+   * Mutually exclusive with all field properties.
+   *
+   * <p>
+   * If none, and other properties define this item as a method, the default matches any return
+   * type.
+   *
+   * <p>
+   * Mutually exclusive with the following other properties defining return-type:
+   * <ul>
+   * <li>methodReturnType
+   * <li>methodReturnTypePattern
+   * <li>memberFromBinding
+   * </ul>
+   *
+   * @return A class constant denoting the type of the method return type.
+   */
+  val methodReturnTypeConstant: KClass<*> = Object::class,
+
+  /**
+   * Define the method return-type pattern by a type pattern.
+   *
+   * <p>
+   * Mutually exclusive with all field properties.
+   *
+   * <p>
+   * If none, and other properties define this item as a method, the default matches any return
+   * type.
+   *
+   * <p>
+   * Mutually exclusive with the following other properties defining return-type:
+   * <ul>
+   * <li>methodReturnType
+   * <li>methodReturnTypeConstant
+   * <li>memberFromBinding
+   * </ul>
+   *
+   * @return The pattern of the method return type.
+   */
+  val methodReturnTypePattern: TypePattern = TypePattern(name = ""),
+
+  /**
+   * Define the method parameters pattern by a list of fully qualified types.
+   *
+   * <p>
+   * Mutually exclusive with all field properties.
+   *
+   * <p>
+   * If none, and other properties define this item as a method, the default matches any parameters.
+   *
+   * <p>
+   * Mutually exclusive with the following other properties defining parameters:
+   * <ul>
+   * <li>methodParameterTypePatterns
+   * <li>memberFromBinding
+   * </ul>
+   *
+   * @return The list of qualified type names of the method parameters.
+   */
+  val methodParameters: Array<String> = [""],
+
+  /**
+   * Define the method parameters pattern by a list of patterns on types.
+   *
+   * <p>
+   * Mutually exclusive with all field properties.
+   *
+   * <p>
+   * If none, and other properties define this item as a method, the default matches any parameters.
+   *
+   * <p>
+   * Mutually exclusive with the following other properties defining parameters:
+   * <ul>
+   * <li>methodParameters
+   * <li>memberFromBinding
+   * </ul>
+   *
+   * @return The list of type patterns for the method parameters.
+   */
+  val methodParameterTypePatterns: Array<TypePattern> = [TypePattern(name = "")],
+
+  /**
+   * Define the field-annotated-by pattern by fully qualified class name.
+   *
+   * <p>
+   * Mutually exclusive with the following other properties defining field-annotated-by:
+   * <ul>
+   * <li>fieldAnnotatedByClassConstant
+   * <li>fieldAnnotatedByClassNamePattern
+   * <li>memberFromBinding
+   * </ul>
+   *
+   * <p>
+   * Mutually exclusive with all method properties.
+   *
+   * <p>
+   * If none are specified the default is to match any field regardless of what the field is
+   * annotated by.
+   *
+   * @return The qualified class name that defines the annotation.
+   */
+  val fieldAnnotatedByClassName: String = "",
+
+  /**
+   * Define the field-annotated-by pattern by reference to a Class constant.
+   *
+   * <p>
+   * Mutually exclusive with the following other properties defining field-annotated-by:
+   * <ul>
+   * <li>fieldAnnotatedByClassName
+   * <li>fieldAnnotatedByClassNamePattern
+   * <li>memberFromBinding
+   * </ul>
+   *
+   * <p>
+   * Mutually exclusive with all method properties.
+   *
+   * <p>
+   * If none are specified the default is to match any field regardless of what the field is
+   * annotated by.
+   *
+   * @return The class-constant that defines the annotation.
+   */
+  val fieldAnnotatedByClassConstant: KClass<*> = Object::class,
+
+  /**
+   * Define the field-annotated-by pattern by reference to a class-name pattern.
+   *
+   * <p>
+   * Mutually exclusive with the following other properties defining field-annotated-by:
+   * <ul>
+   * <li>fieldAnnotatedByClassName
+   * <li>fieldAnnotatedByClassConstant
+   * <li>memberFromBinding
+   * </ul>
+   *
+   * <p>
+   * Mutually exclusive with all method properties.
+   *
+   * <p>
+   * If none are specified the default is to match any field regardless of what the field is
+   * annotated by.
+   *
+   * @return The class-name pattern that defines the annotation.
+   */
+  val fieldAnnotatedByClassNamePattern: ClassNamePattern = ClassNamePattern(unqualifiedName = ""),
+
+  /**
+   * Define the field-access pattern by matching on access flags.
+   *
+   * <p>
+   * Mutually exclusive with all method properties.
+   *
+   * <p>
+   * If none, and other properties define this item as a field, the default matches any field-access
+   * flags.
+   *
+   * <p>
+   * Mutually exclusive with the property `memberFromBinding` also defining field-access.
+   *
+   * @return The field access-flag constraints that must be met.
+   */
+  val fieldAccess: Array<FieldAccessFlags> = [],
+
+  /**
+   * Define the field-name pattern by an exact field name.
+   *
+   * <p>
+   * Mutually exclusive with all method properties.
+   *
+   * <p>
+   * If none, and other properties define this item as a field, the default matches any field name.
+   *
+   * <p>
+   * Mutually exclusive with the following other properties defining field-name:
+   * <ul>
+   * <li>fieldNamePattern
+   * <li>memberFromBinding
+   * </ul>
+   *
+   * @return The exact field name of the field.
+   */
+  val fieldName: String = "",
+
+  /**
+   * Define the field-name pattern by a string pattern.
+   *
+   * <p>
+   * Mutually exclusive with all method properties.
+   *
+   * <p>
+   * If none, and other properties define this item as a field, the default matches any field name.
+   *
+   * <p>
+   * Mutually exclusive with the following other properties defining field-name:
+   * <ul>
+   * <li>fieldName
+   * <li>memberFromBinding
+   * </ul>
+   *
+   * @return The string pattern of the field name.
+   */
+  val fieldNamePattern: StringPattern = StringPattern(exact = ""),
+
+  /**
+   * Define the field-type pattern by a fully qualified type.
+   *
+   * <p>
+   * Mutually exclusive with all method properties.
+   *
+   * <p>
+   * If none, and other properties define this item as a field, the default matches any type.
+   *
+   * <p>
+   * Mutually exclusive with the following other properties defining field-type:
+   * <ul>
+   * <li>fieldTypeConstant
+   * <li>fieldTypePattern
+   * <li>memberFromBinding
+   * </ul>
+   *
+   * @return The qualified type name for the field type.
+   */
+  val fieldType: String = "",
+
+  /**
+   * Define the field-type pattern by a class constant.
+   *
+   * <p>
+   * Mutually exclusive with all method properties.
+   *
+   * <p>
+   * If none, and other properties define this item as a field, the default matches any type.
+   *
+   * <p>
+   * Mutually exclusive with the following other properties defining field-type:
+   * <ul>
+   * <li>fieldType
+   * <li>fieldTypePattern
+   * <li>memberFromBinding
+   * </ul>
+   *
+   * @return The class constant for the field type.
+   */
+  val fieldTypeConstant: KClass<*> = Object::class,
+
+  /**
+   * Define the field-type pattern by a pattern on types.
+   *
+   * <p>
+   * Mutually exclusive with all method properties.
+   *
+   * <p>
+   * If none, and other properties define this item as a field, the default matches any type.
+   *
+   * <p>
+   * Mutually exclusive with the following other properties defining field-type:
+   * <ul>
+   * <li>fieldType
+   * <li>fieldTypeConstant
+   * <li>memberFromBinding
+   * </ul>
+   *
+   * @return The type pattern for the field type.
+   */
+  val fieldTypePattern: TypePattern = TypePattern(name = ""),
+)
diff --git a/src/keepanno/java/androidx/annotation/keep/KeepConstraint.java b/src/keepanno/java/androidx/annotation/keep/KeepConstraint.kt
similarity index 98%
rename from src/keepanno/java/androidx/annotation/keep/KeepConstraint.java
rename to src/keepanno/java/androidx/annotation/keep/KeepConstraint.kt
index 19f48dc..6eaebcc 100644
--- a/src/keepanno/java/androidx/annotation/keep/KeepConstraint.java
+++ b/src/keepanno/java/androidx/annotation/keep/KeepConstraint.kt
@@ -18,8 +18,7 @@
 // MAINTAINED AND TESTED IN THE R8 REPO. PLEASE MAKE CHANGES THERE AND REPLICATE.
 // ***********************************************************************************
 
-
-package androidx.annotation.keep;
+package androidx.annotation.keep
 
 /**
  * Usage constraints for how a target is used and what must be kept.
@@ -31,7 +30,7 @@
  * it is safe to remove the annotations. However, it would not be safe to remove parameters from the
  * method.
  */
-public enum KeepConstraint {
+enum class KeepConstraint {
   /**
    * Indicates that the target item is being looked up reflectively.
    *
diff --git a/src/keepanno/java/androidx/annotation/keep/KeepEdge.java b/src/keepanno/java/androidx/annotation/keep/KeepEdge.kt
similarity index 62%
rename from src/keepanno/java/androidx/annotation/keep/KeepEdge.java
rename to src/keepanno/java/androidx/annotation/keep/KeepEdge.kt
index b4e3830..6e683e5 100644
--- a/src/keepanno/java/androidx/annotation/keep/KeepEdge.java
+++ b/src/keepanno/java/androidx/annotation/keep/KeepEdge.kt
@@ -18,21 +18,23 @@
 // MAINTAINED AND TESTED IN THE R8 REPO. PLEASE MAKE CHANGES THERE AND REPLICATE.
 // ***********************************************************************************
 
-package androidx.annotation.keep;
+package androidx.annotation.keep
 
-import java.lang.annotation.ElementType;
-import java.lang.annotation.Retention;
-import java.lang.annotation.RetentionPolicy;
-import java.lang.annotation.Target;
+import kotlin.annotation.Retention
+import kotlin.annotation.Target
 
-@Target({ElementType.TYPE, ElementType.FIELD, ElementType.METHOD, ElementType.CONSTRUCTOR})
-@Retention(RetentionPolicy.CLASS)
-public @interface KeepEdge {
-  String description() default "";
+@Retention(AnnotationRetention.BINARY)
+@Target(
+  AnnotationTarget.TYPE,
+  AnnotationTarget.FIELD,
+  AnnotationTarget.FUNCTION,
+  AnnotationTarget.CONSTRUCTOR,
+)
+annotation class KeepEdge(
+  val description: String = "",
 
-  KeepBinding[] bindings() default {};
-
-  KeepCondition[] preconditions() default {};
-
-  KeepTarget[] consequences();
-}
+  //   val retention : Array<RetentionPolicy> = [RetentionPolicy.RUNTIME]
+  val bindings: Array<KeepBinding> = [],
+  val preconditions: Array<KeepCondition> = [],
+  val consequences: Array<KeepTarget> = [],
+)
diff --git a/src/keepanno/java/androidx/annotation/keep/KeepForApi.java b/src/keepanno/java/androidx/annotation/keep/KeepForApi.java
deleted file mode 100644
index 7ad9e61..0000000
--- a/src/keepanno/java/androidx/annotation/keep/KeepForApi.java
+++ /dev/null
@@ -1,481 +0,0 @@
-/*
- * Copyright 2025 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.
- */
-
-// ***********************************************************************************
-// GENERATED FILE. DO NOT EDIT! See KeepItemAnnotationGenerator.java.
-// ***********************************************************************************
-
-// ***********************************************************************************
-// MAINTAINED AND TESTED IN THE R8 REPO. PLEASE MAKE CHANGES THERE AND REPLICATE.
-// ***********************************************************************************
-
-package androidx.annotation.keep;
-
-import java.lang.annotation.ElementType;
-import java.lang.annotation.Retention;
-import java.lang.annotation.RetentionPolicy;
-import java.lang.annotation.Target;
-
-/**
- * Annotation to mark a class, field or method as part of a library API surface.
- *
- * <p>When a class is annotated, member patterns can be used to define which members are to be kept.
- * When no member patterns are specified the default pattern matches all public and protected
- * members.
- *
- * <p>When a member is annotated, the member patterns cannot be used as the annotated member itself
- * fully defines the item to be kept (i.e., itself).
- */
-@Target({ElementType.TYPE, ElementType.FIELD, ElementType.METHOD, ElementType.CONSTRUCTOR})
-@Retention(RetentionPolicy.CLASS)
-public @interface KeepForApi {
-
-  /**
-   * Optional description to document the reason for this annotation.
-   *
-   * @return The descriptive message. Defaults to no description.
-   */
-  String description() default "";
-
-  /**
-   * Additional targets to be kept as part of the API surface.
-   *
-   * @return List of additional target consequences. Defaults to no additional target consequences.
-   */
-  KeepTarget[] additionalTargets() default {};
-
-  /**
-   * Specify the kind of this item pattern.
-   *
-   * <p>Default kind is {@link KeepItemKind#CLASS_AND_MEMBERS}, meaning the annotated class and/or
-   * member is to be kept. When annotating a class this can be set to {@link
-   * KeepItemKind#ONLY_CLASS} to avoid patterns on any members. That can be useful when the API
-   * members are themselves explicitly annotated.
-   *
-   * <p>It is not possible to use {@link KeepItemKind#ONLY_CLASS} if annotating a member. Also, it
-   * is never valid to use kind {@link KeepItemKind#ONLY_MEMBERS} as the API surface must keep the
-   * class if any member is to be accessible.
-   *
-   * @return The kind for this pattern.
-   */
-  KeepItemKind kind() default KeepItemKind.DEFAULT;
-
-  /**
-   * Define the member-annotated-by pattern by fully qualified class name.
-   *
-   * <p>Mutually exclusive with the following other properties defining member-annotated-by:
-   *
-   * <ul>
-   *   <li>memberAnnotatedByClassConstant
-   *   <li>memberAnnotatedByClassNamePattern
-   * </ul>
-   *
-   * <p>Mutually exclusive with all field and method properties as use restricts the match to both
-   * types of members.
-   *
-   * <p>If none are specified the default is to match any member regardless of what the member is
-   * annotated by.
-   *
-   * @return The qualified class name that defines the annotation.
-   */
-  String memberAnnotatedByClassName() default "";
-
-  /**
-   * Define the member-annotated-by pattern by reference to a Class constant.
-   *
-   * <p>Mutually exclusive with the following other properties defining member-annotated-by:
-   *
-   * <ul>
-   *   <li>memberAnnotatedByClassName
-   *   <li>memberAnnotatedByClassNamePattern
-   * </ul>
-   *
-   * <p>Mutually exclusive with all field and method properties as use restricts the match to both
-   * types of members.
-   *
-   * <p>If none are specified the default is to match any member regardless of what the member is
-   * annotated by.
-   *
-   * @return The class-constant that defines the annotation.
-   */
-  Class<?> memberAnnotatedByClassConstant() default Object.class;
-
-  /**
-   * Define the member-annotated-by pattern by reference to a class-name pattern.
-   *
-   * <p>Mutually exclusive with the following other properties defining member-annotated-by:
-   *
-   * <ul>
-   *   <li>memberAnnotatedByClassName
-   *   <li>memberAnnotatedByClassConstant
-   * </ul>
-   *
-   * <p>Mutually exclusive with all field and method properties as use restricts the match to both
-   * types of members.
-   *
-   * <p>If none are specified the default is to match any member regardless of what the member is
-   * annotated by.
-   *
-   * @return The class-name pattern that defines the annotation.
-   */
-  ClassNamePattern memberAnnotatedByClassNamePattern() default
-      @ClassNamePattern(unqualifiedName = "");
-
-  /**
-   * Define the member-access pattern by matching on access flags.
-   *
-   * <p>Mutually exclusive with all field and method properties as use restricts the match to both
-   * types of members.
-   *
-   * @return The member access-flag constraints that must be met.
-   */
-  MemberAccessFlags[] memberAccess() default {};
-
-  /**
-   * Define the method-annotated-by pattern by fully qualified class name.
-   *
-   * <p>Mutually exclusive with the following other properties defining method-annotated-by:
-   *
-   * <ul>
-   *   <li>methodAnnotatedByClassConstant
-   *   <li>methodAnnotatedByClassNamePattern
-   * </ul>
-   *
-   * <p>Mutually exclusive with all field properties.
-   *
-   * <p>If none are specified the default is to match any method regardless of what the method is
-   * annotated by.
-   *
-   * @return The qualified class name that defines the annotation.
-   */
-  String methodAnnotatedByClassName() default "";
-
-  /**
-   * Define the method-annotated-by pattern by reference to a Class constant.
-   *
-   * <p>Mutually exclusive with the following other properties defining method-annotated-by:
-   *
-   * <ul>
-   *   <li>methodAnnotatedByClassName
-   *   <li>methodAnnotatedByClassNamePattern
-   * </ul>
-   *
-   * <p>Mutually exclusive with all field properties.
-   *
-   * <p>If none are specified the default is to match any method regardless of what the method is
-   * annotated by.
-   *
-   * @return The class-constant that defines the annotation.
-   */
-  Class<?> methodAnnotatedByClassConstant() default Object.class;
-
-  /**
-   * Define the method-annotated-by pattern by reference to a class-name pattern.
-   *
-   * <p>Mutually exclusive with the following other properties defining method-annotated-by:
-   *
-   * <ul>
-   *   <li>methodAnnotatedByClassName
-   *   <li>methodAnnotatedByClassConstant
-   * </ul>
-   *
-   * <p>Mutually exclusive with all field properties.
-   *
-   * <p>If none are specified the default is to match any method regardless of what the method is
-   * annotated by.
-   *
-   * @return The class-name pattern that defines the annotation.
-   */
-  ClassNamePattern methodAnnotatedByClassNamePattern() default
-      @ClassNamePattern(unqualifiedName = "");
-
-  /**
-   * Define the method-access pattern by matching on access flags.
-   *
-   * <p>Mutually exclusive with all field properties.
-   *
-   * <p>If none, and other properties define this item as a method, the default matches any
-   * method-access flags.
-   *
-   * @return The method access-flag constraints that must be met.
-   */
-  MethodAccessFlags[] methodAccess() default {};
-
-  /**
-   * Define the method-name pattern by an exact method name.
-   *
-   * <p>Mutually exclusive with all field properties.
-   *
-   * <p>If none, and other properties define this item as a method, the default matches any method
-   * name.
-   *
-   * <p>Mutually exclusive with the property `methodNamePattern` also defining method-name.
-   *
-   * @return The exact method name of the method.
-   */
-  String methodName() default "";
-
-  /**
-   * Define the method-name pattern by a string pattern.
-   *
-   * <p>Mutually exclusive with all field properties.
-   *
-   * <p>If none, and other properties define this item as a method, the default matches any method
-   * name.
-   *
-   * <p>Mutually exclusive with the property `methodName` also defining method-name.
-   *
-   * @return The string pattern of the method name.
-   */
-  StringPattern methodNamePattern() default @StringPattern(exact = "");
-
-  /**
-   * Define the method return-type pattern by a fully qualified type or 'void'.
-   *
-   * <p>Mutually exclusive with all field properties.
-   *
-   * <p>If none, and other properties define this item as a method, the default matches any return
-   * type.
-   *
-   * <p>Mutually exclusive with the following other properties defining return-type:
-   *
-   * <ul>
-   *   <li>methodReturnTypeConstant
-   *   <li>methodReturnTypePattern
-   * </ul>
-   *
-   * @return The qualified type name of the method return type.
-   */
-  String methodReturnType() default "";
-
-  /**
-   * Define the method return-type pattern by a class constant.
-   *
-   * <p>Mutually exclusive with all field properties.
-   *
-   * <p>If none, and other properties define this item as a method, the default matches any return
-   * type.
-   *
-   * <p>Mutually exclusive with the following other properties defining return-type:
-   *
-   * <ul>
-   *   <li>methodReturnType
-   *   <li>methodReturnTypePattern
-   * </ul>
-   *
-   * @return A class constant denoting the type of the method return type.
-   */
-  Class<?> methodReturnTypeConstant() default Object.class;
-
-  /**
-   * Define the method return-type pattern by a type pattern.
-   *
-   * <p>Mutually exclusive with all field properties.
-   *
-   * <p>If none, and other properties define this item as a method, the default matches any return
-   * type.
-   *
-   * <p>Mutually exclusive with the following other properties defining return-type:
-   *
-   * <ul>
-   *   <li>methodReturnType
-   *   <li>methodReturnTypeConstant
-   * </ul>
-   *
-   * @return The pattern of the method return type.
-   */
-  TypePattern methodReturnTypePattern() default @TypePattern(name = "");
-
-  /**
-   * Define the method parameters pattern by a list of fully qualified types.
-   *
-   * <p>Mutually exclusive with all field properties.
-   *
-   * <p>If none, and other properties define this item as a method, the default matches any
-   * parameters.
-   *
-   * <p>Mutually exclusive with the property `methodParameterTypePatterns` also defining parameters.
-   *
-   * @return The list of qualified type names of the method parameters.
-   */
-  String[] methodParameters() default {""};
-
-  /**
-   * Define the method parameters pattern by a list of patterns on types.
-   *
-   * <p>Mutually exclusive with all field properties.
-   *
-   * <p>If none, and other properties define this item as a method, the default matches any
-   * parameters.
-   *
-   * <p>Mutually exclusive with the property `methodParameters` also defining parameters.
-   *
-   * @return The list of type patterns for the method parameters.
-   */
-  TypePattern[] methodParameterTypePatterns() default {@TypePattern(name = "")};
-
-  /**
-   * Define the field-annotated-by pattern by fully qualified class name.
-   *
-   * <p>Mutually exclusive with the following other properties defining field-annotated-by:
-   *
-   * <ul>
-   *   <li>fieldAnnotatedByClassConstant
-   *   <li>fieldAnnotatedByClassNamePattern
-   * </ul>
-   *
-   * <p>Mutually exclusive with all method properties.
-   *
-   * <p>If none are specified the default is to match any field regardless of what the field is
-   * annotated by.
-   *
-   * @return The qualified class name that defines the annotation.
-   */
-  String fieldAnnotatedByClassName() default "";
-
-  /**
-   * Define the field-annotated-by pattern by reference to a Class constant.
-   *
-   * <p>Mutually exclusive with the following other properties defining field-annotated-by:
-   *
-   * <ul>
-   *   <li>fieldAnnotatedByClassName
-   *   <li>fieldAnnotatedByClassNamePattern
-   * </ul>
-   *
-   * <p>Mutually exclusive with all method properties.
-   *
-   * <p>If none are specified the default is to match any field regardless of what the field is
-   * annotated by.
-   *
-   * @return The class-constant that defines the annotation.
-   */
-  Class<?> fieldAnnotatedByClassConstant() default Object.class;
-
-  /**
-   * Define the field-annotated-by pattern by reference to a class-name pattern.
-   *
-   * <p>Mutually exclusive with the following other properties defining field-annotated-by:
-   *
-   * <ul>
-   *   <li>fieldAnnotatedByClassName
-   *   <li>fieldAnnotatedByClassConstant
-   * </ul>
-   *
-   * <p>Mutually exclusive with all method properties.
-   *
-   * <p>If none are specified the default is to match any field regardless of what the field is
-   * annotated by.
-   *
-   * @return The class-name pattern that defines the annotation.
-   */
-  ClassNamePattern fieldAnnotatedByClassNamePattern() default
-      @ClassNamePattern(unqualifiedName = "");
-
-  /**
-   * Define the field-access pattern by matching on access flags.
-   *
-   * <p>Mutually exclusive with all method properties.
-   *
-   * <p>If none, and other properties define this item as a field, the default matches any
-   * field-access flags.
-   *
-   * @return The field access-flag constraints that must be met.
-   */
-  FieldAccessFlags[] fieldAccess() default {};
-
-  /**
-   * Define the field-name pattern by an exact field name.
-   *
-   * <p>Mutually exclusive with all method properties.
-   *
-   * <p>If none, and other properties define this item as a field, the default matches any field
-   * name.
-   *
-   * <p>Mutually exclusive with the property `fieldNamePattern` also defining field-name.
-   *
-   * @return The exact field name of the field.
-   */
-  String fieldName() default "";
-
-  /**
-   * Define the field-name pattern by a string pattern.
-   *
-   * <p>Mutually exclusive with all method properties.
-   *
-   * <p>If none, and other properties define this item as a field, the default matches any field
-   * name.
-   *
-   * <p>Mutually exclusive with the property `fieldName` also defining field-name.
-   *
-   * @return The string pattern of the field name.
-   */
-  StringPattern fieldNamePattern() default @StringPattern(exact = "");
-
-  /**
-   * Define the field-type pattern by a fully qualified type.
-   *
-   * <p>Mutually exclusive with all method properties.
-   *
-   * <p>If none, and other properties define this item as a field, the default matches any type.
-   *
-   * <p>Mutually exclusive with the following other properties defining field-type:
-   *
-   * <ul>
-   *   <li>fieldTypeConstant
-   *   <li>fieldTypePattern
-   * </ul>
-   *
-   * @return The qualified type name for the field type.
-   */
-  String fieldType() default "";
-
-  /**
-   * Define the field-type pattern by a class constant.
-   *
-   * <p>Mutually exclusive with all method properties.
-   *
-   * <p>If none, and other properties define this item as a field, the default matches any type.
-   *
-   * <p>Mutually exclusive with the following other properties defining field-type:
-   *
-   * <ul>
-   *   <li>fieldType
-   *   <li>fieldTypePattern
-   * </ul>
-   *
-   * @return The class constant for the field type.
-   */
-  Class<?> fieldTypeConstant() default Object.class;
-
-  /**
-   * Define the field-type pattern by a pattern on types.
-   *
-   * <p>Mutually exclusive with all method properties.
-   *
-   * <p>If none, and other properties define this item as a field, the default matches any type.
-   *
-   * <p>Mutually exclusive with the following other properties defining field-type:
-   *
-   * <ul>
-   *   <li>fieldType
-   *   <li>fieldTypeConstant
-   * </ul>
-   *
-   * @return The type pattern for the field type.
-   */
-  TypePattern fieldTypePattern() default @TypePattern(name = "");
-}
diff --git a/src/keepanno/java/androidx/annotation/keep/KeepForApi.kt b/src/keepanno/java/androidx/annotation/keep/KeepForApi.kt
new file mode 100644
index 0000000..5fa5bf6
--- /dev/null
+++ b/src/keepanno/java/androidx/annotation/keep/KeepForApi.kt
@@ -0,0 +1,535 @@
+/*
+ * Copyright 2025 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.
+ */
+
+// ***********************************************************************************
+// GENERATED FILE. DO NOT EDIT! See KeepItemAnnotationGenerator.java.
+// ***********************************************************************************
+
+// ***********************************************************************************
+// MAINTAINED AND TESTED IN THE R8 REPO. PLEASE MAKE CHANGES THERE AND REPLICATE.
+// ***********************************************************************************
+
+package androidx.annotation.keep
+
+import kotlin.annotation.Retention
+import kotlin.annotation.Target
+import kotlin.reflect.KClass
+
+/**
+ * Annotation to mark a class, field or method as part of a library API surface.
+ *
+ * <p>
+ * When a class is annotated, member patterns can be used to define which members are to be kept.
+ * When no member patterns are specified the default pattern matches all public and protected
+ * members.
+ *
+ * <p>
+ * When a member is annotated, the member patterns cannot be used as the annotated member itself
+ * fully defines the item to be kept (i.e., itself).
+ */
+@Retention(AnnotationRetention.BINARY)
+@Target(
+  AnnotationTarget.CLASS,
+  AnnotationTarget.FIELD,
+  AnnotationTarget.FUNCTION,
+  AnnotationTarget.CONSTRUCTOR,
+)
+annotation class KeepForApi(
+
+  /**
+   * Optional description to document the reason for this annotation.
+   *
+   * @return The descriptive message. Defaults to no description.
+   */
+  val description: String = "",
+
+  /**
+   * Additional targets to be kept as part of the API surface.
+   *
+   * @return List of additional target consequences. Defaults to no additional target consequences.
+   */
+  val additionalTargets: Array<KeepTarget> = [],
+
+  /**
+   * Specify the kind of this item pattern.
+   *
+   * <p>
+   * Default kind is {@link KeepItemKind#CLASS_AND_MEMBERS}, meaning the annotated class and/or
+   * member is to be kept. When annotating a class this can be set to {@link
+   * KeepItemKind#ONLY_CLASS} to avoid patterns on any members. That can be useful when the API
+   * members are themselves explicitly annotated.
+   *
+   * <p>
+   * It is not possible to use {@link KeepItemKind#ONLY_CLASS} if annotating a member. Also, it is
+   * never valid to use kind {@link KeepItemKind#ONLY_MEMBERS} as the API surface must keep the
+   * class if any member is to be accessible.
+   *
+   * @return The kind for this pattern.
+   */
+  val kind: KeepItemKind = KeepItemKind.DEFAULT,
+
+  /**
+   * Define the member-annotated-by pattern by fully qualified class name.
+   *
+   * <p>
+   * Mutually exclusive with the following other properties defining member-annotated-by:
+   * <ul>
+   * <li>memberAnnotatedByClassConstant
+   * <li>memberAnnotatedByClassNamePattern
+   * </ul>
+   *
+   * <p>
+   * Mutually exclusive with all field and method properties as use restricts the match to both
+   * types of members.
+   *
+   * <p>
+   * If none are specified the default is to match any member regardless of what the member is
+   * annotated by.
+   *
+   * @return The qualified class name that defines the annotation.
+   */
+  val memberAnnotatedByClassName: String = "",
+
+  /**
+   * Define the member-annotated-by pattern by reference to a Class constant.
+   *
+   * <p>
+   * Mutually exclusive with the following other properties defining member-annotated-by:
+   * <ul>
+   * <li>memberAnnotatedByClassName
+   * <li>memberAnnotatedByClassNamePattern
+   * </ul>
+   *
+   * <p>
+   * Mutually exclusive with all field and method properties as use restricts the match to both
+   * types of members.
+   *
+   * <p>
+   * If none are specified the default is to match any member regardless of what the member is
+   * annotated by.
+   *
+   * @return The class-constant that defines the annotation.
+   */
+  val memberAnnotatedByClassConstant: KClass<*> = Object::class,
+
+  /**
+   * Define the member-annotated-by pattern by reference to a class-name pattern.
+   *
+   * <p>
+   * Mutually exclusive with the following other properties defining member-annotated-by:
+   * <ul>
+   * <li>memberAnnotatedByClassName
+   * <li>memberAnnotatedByClassConstant
+   * </ul>
+   *
+   * <p>
+   * Mutually exclusive with all field and method properties as use restricts the match to both
+   * types of members.
+   *
+   * <p>
+   * If none are specified the default is to match any member regardless of what the member is
+   * annotated by.
+   *
+   * @return The class-name pattern that defines the annotation.
+   */
+  val memberAnnotatedByClassNamePattern: ClassNamePattern = ClassNamePattern(unqualifiedName = ""),
+
+  /**
+   * Define the member-access pattern by matching on access flags.
+   *
+   * <p>
+   * Mutually exclusive with all field and method properties as use restricts the match to both
+   * types of members.
+   *
+   * @return The member access-flag constraints that must be met.
+   */
+  val memberAccess: Array<MemberAccessFlags> = [],
+
+  /**
+   * Define the method-annotated-by pattern by fully qualified class name.
+   *
+   * <p>
+   * Mutually exclusive with the following other properties defining method-annotated-by:
+   * <ul>
+   * <li>methodAnnotatedByClassConstant
+   * <li>methodAnnotatedByClassNamePattern
+   * </ul>
+   *
+   * <p>
+   * Mutually exclusive with all field properties.
+   *
+   * <p>
+   * If none are specified the default is to match any method regardless of what the method is
+   * annotated by.
+   *
+   * @return The qualified class name that defines the annotation.
+   */
+  val methodAnnotatedByClassName: String = "",
+
+  /**
+   * Define the method-annotated-by pattern by reference to a Class constant.
+   *
+   * <p>
+   * Mutually exclusive with the following other properties defining method-annotated-by:
+   * <ul>
+   * <li>methodAnnotatedByClassName
+   * <li>methodAnnotatedByClassNamePattern
+   * </ul>
+   *
+   * <p>
+   * Mutually exclusive with all field properties.
+   *
+   * <p>
+   * If none are specified the default is to match any method regardless of what the method is
+   * annotated by.
+   *
+   * @return The class-constant that defines the annotation.
+   */
+  val methodAnnotatedByClassConstant: KClass<*> = Object::class,
+
+  /**
+   * Define the method-annotated-by pattern by reference to a class-name pattern.
+   *
+   * <p>
+   * Mutually exclusive with the following other properties defining method-annotated-by:
+   * <ul>
+   * <li>methodAnnotatedByClassName
+   * <li>methodAnnotatedByClassConstant
+   * </ul>
+   *
+   * <p>
+   * Mutually exclusive with all field properties.
+   *
+   * <p>
+   * If none are specified the default is to match any method regardless of what the method is
+   * annotated by.
+   *
+   * @return The class-name pattern that defines the annotation.
+   */
+  val methodAnnotatedByClassNamePattern: ClassNamePattern = ClassNamePattern(unqualifiedName = ""),
+
+  /**
+   * Define the method-access pattern by matching on access flags.
+   *
+   * <p>
+   * Mutually exclusive with all field properties.
+   *
+   * <p>
+   * If none, and other properties define this item as a method, the default matches any
+   * method-access flags.
+   *
+   * @return The method access-flag constraints that must be met.
+   */
+  val methodAccess: Array<MethodAccessFlags> = [],
+
+  /**
+   * Define the method-name pattern by an exact method name.
+   *
+   * <p>
+   * Mutually exclusive with all field properties.
+   *
+   * <p>
+   * If none, and other properties define this item as a method, the default matches any method
+   * name.
+   *
+   * <p>
+   * Mutually exclusive with the property `methodNamePattern` also defining method-name.
+   *
+   * @return The exact method name of the method.
+   */
+  val methodName: String = "",
+
+  /**
+   * Define the method-name pattern by a string pattern.
+   *
+   * <p>
+   * Mutually exclusive with all field properties.
+   *
+   * <p>
+   * If none, and other properties define this item as a method, the default matches any method
+   * name.
+   *
+   * <p>
+   * Mutually exclusive with the property `methodName` also defining method-name.
+   *
+   * @return The string pattern of the method name.
+   */
+  val methodNamePattern: StringPattern = StringPattern(exact = ""),
+
+  /**
+   * Define the method return-type pattern by a fully qualified type or 'void'.
+   *
+   * <p>
+   * Mutually exclusive with all field properties.
+   *
+   * <p>
+   * If none, and other properties define this item as a method, the default matches any return
+   * type.
+   *
+   * <p>
+   * Mutually exclusive with the following other properties defining return-type:
+   * <ul>
+   * <li>methodReturnTypeConstant
+   * <li>methodReturnTypePattern
+   * </ul>
+   *
+   * @return The qualified type name of the method return type.
+   */
+  val methodReturnType: String = "",
+
+  /**
+   * Define the method return-type pattern by a class constant.
+   *
+   * <p>
+   * Mutually exclusive with all field properties.
+   *
+   * <p>
+   * If none, and other properties define this item as a method, the default matches any return
+   * type.
+   *
+   * <p>
+   * Mutually exclusive with the following other properties defining return-type:
+   * <ul>
+   * <li>methodReturnType
+   * <li>methodReturnTypePattern
+   * </ul>
+   *
+   * @return A class constant denoting the type of the method return type.
+   */
+  val methodReturnTypeConstant: KClass<*> = Object::class,
+
+  /**
+   * Define the method return-type pattern by a type pattern.
+   *
+   * <p>
+   * Mutually exclusive with all field properties.
+   *
+   * <p>
+   * If none, and other properties define this item as a method, the default matches any return
+   * type.
+   *
+   * <p>
+   * Mutually exclusive with the following other properties defining return-type:
+   * <ul>
+   * <li>methodReturnType
+   * <li>methodReturnTypeConstant
+   * </ul>
+   *
+   * @return The pattern of the method return type.
+   */
+  val methodReturnTypePattern: TypePattern = TypePattern(name = ""),
+
+  /**
+   * Define the method parameters pattern by a list of fully qualified types.
+   *
+   * <p>
+   * Mutually exclusive with all field properties.
+   *
+   * <p>
+   * If none, and other properties define this item as a method, the default matches any parameters.
+   *
+   * <p>
+   * Mutually exclusive with the property `methodParameterTypePatterns` also defining parameters.
+   *
+   * @return The list of qualified type names of the method parameters.
+   */
+  val methodParameters: Array<String> = [""],
+
+  /**
+   * Define the method parameters pattern by a list of patterns on types.
+   *
+   * <p>
+   * Mutually exclusive with all field properties.
+   *
+   * <p>
+   * If none, and other properties define this item as a method, the default matches any parameters.
+   *
+   * <p>
+   * Mutually exclusive with the property `methodParameters` also defining parameters.
+   *
+   * @return The list of type patterns for the method parameters.
+   */
+  val methodParameterTypePatterns: Array<TypePattern> = [TypePattern(name = "")],
+
+  /**
+   * Define the field-annotated-by pattern by fully qualified class name.
+   *
+   * <p>
+   * Mutually exclusive with the following other properties defining field-annotated-by:
+   * <ul>
+   * <li>fieldAnnotatedByClassConstant
+   * <li>fieldAnnotatedByClassNamePattern
+   * </ul>
+   *
+   * <p>
+   * Mutually exclusive with all method properties.
+   *
+   * <p>
+   * If none are specified the default is to match any field regardless of what the field is
+   * annotated by.
+   *
+   * @return The qualified class name that defines the annotation.
+   */
+  val fieldAnnotatedByClassName: String = "",
+
+  /**
+   * Define the field-annotated-by pattern by reference to a Class constant.
+   *
+   * <p>
+   * Mutually exclusive with the following other properties defining field-annotated-by:
+   * <ul>
+   * <li>fieldAnnotatedByClassName
+   * <li>fieldAnnotatedByClassNamePattern
+   * </ul>
+   *
+   * <p>
+   * Mutually exclusive with all method properties.
+   *
+   * <p>
+   * If none are specified the default is to match any field regardless of what the field is
+   * annotated by.
+   *
+   * @return The class-constant that defines the annotation.
+   */
+  val fieldAnnotatedByClassConstant: KClass<*> = Object::class,
+
+  /**
+   * Define the field-annotated-by pattern by reference to a class-name pattern.
+   *
+   * <p>
+   * Mutually exclusive with the following other properties defining field-annotated-by:
+   * <ul>
+   * <li>fieldAnnotatedByClassName
+   * <li>fieldAnnotatedByClassConstant
+   * </ul>
+   *
+   * <p>
+   * Mutually exclusive with all method properties.
+   *
+   * <p>
+   * If none are specified the default is to match any field regardless of what the field is
+   * annotated by.
+   *
+   * @return The class-name pattern that defines the annotation.
+   */
+  val fieldAnnotatedByClassNamePattern: ClassNamePattern = ClassNamePattern(unqualifiedName = ""),
+
+  /**
+   * Define the field-access pattern by matching on access flags.
+   *
+   * <p>
+   * Mutually exclusive with all method properties.
+   *
+   * <p>
+   * If none, and other properties define this item as a field, the default matches any field-access
+   * flags.
+   *
+   * @return The field access-flag constraints that must be met.
+   */
+  val fieldAccess: Array<FieldAccessFlags> = [],
+
+  /**
+   * Define the field-name pattern by an exact field name.
+   *
+   * <p>
+   * Mutually exclusive with all method properties.
+   *
+   * <p>
+   * If none, and other properties define this item as a field, the default matches any field name.
+   *
+   * <p>
+   * Mutually exclusive with the property `fieldNamePattern` also defining field-name.
+   *
+   * @return The exact field name of the field.
+   */
+  val fieldName: String = "",
+
+  /**
+   * Define the field-name pattern by a string pattern.
+   *
+   * <p>
+   * Mutually exclusive with all method properties.
+   *
+   * <p>
+   * If none, and other properties define this item as a field, the default matches any field name.
+   *
+   * <p>
+   * Mutually exclusive with the property `fieldName` also defining field-name.
+   *
+   * @return The string pattern of the field name.
+   */
+  val fieldNamePattern: StringPattern = StringPattern(exact = ""),
+
+  /**
+   * Define the field-type pattern by a fully qualified type.
+   *
+   * <p>
+   * Mutually exclusive with all method properties.
+   *
+   * <p>
+   * If none, and other properties define this item as a field, the default matches any type.
+   *
+   * <p>
+   * Mutually exclusive with the following other properties defining field-type:
+   * <ul>
+   * <li>fieldTypeConstant
+   * <li>fieldTypePattern
+   * </ul>
+   *
+   * @return The qualified type name for the field type.
+   */
+  val fieldType: String = "",
+
+  /**
+   * Define the field-type pattern by a class constant.
+   *
+   * <p>
+   * Mutually exclusive with all method properties.
+   *
+   * <p>
+   * If none, and other properties define this item as a field, the default matches any type.
+   *
+   * <p>
+   * Mutually exclusive with the following other properties defining field-type:
+   * <ul>
+   * <li>fieldType
+   * <li>fieldTypePattern
+   * </ul>
+   *
+   * @return The class constant for the field type.
+   */
+  val fieldTypeConstant: KClass<*> = Object::class,
+
+  /**
+   * Define the field-type pattern by a pattern on types.
+   *
+   * <p>
+   * Mutually exclusive with all method properties.
+   *
+   * <p>
+   * If none, and other properties define this item as a field, the default matches any type.
+   *
+   * <p>
+   * Mutually exclusive with the following other properties defining field-type:
+   * <ul>
+   * <li>fieldType
+   * <li>fieldTypeConstant
+   * </ul>
+   *
+   * @return The type pattern for the field type.
+   */
+  val fieldTypePattern: TypePattern = TypePattern(name = ""),
+)
diff --git a/src/keepanno/java/androidx/annotation/keep/KeepItemKind.java b/src/keepanno/java/androidx/annotation/keep/KeepItemKind.kt
similarity index 92%
rename from src/keepanno/java/androidx/annotation/keep/KeepItemKind.java
rename to src/keepanno/java/androidx/annotation/keep/KeepItemKind.kt
index 5ffc9d7..90afbff 100644
--- a/src/keepanno/java/androidx/annotation/keep/KeepItemKind.java
+++ b/src/keepanno/java/androidx/annotation/keep/KeepItemKind.kt
@@ -18,9 +18,9 @@
 // MAINTAINED AND TESTED IN THE R8 REPO. PLEASE MAKE CHANGES THERE AND REPLICATE.
 // ***********************************************************************************
 
-package androidx.annotation.keep;
+package androidx.annotation.keep
 
-public enum KeepItemKind {
+enum class KeepItemKind {
   ONLY_CLASS,
   ONLY_MEMBERS,
   ONLY_METHODS,
@@ -28,5 +28,5 @@
   CLASS_AND_MEMBERS,
   CLASS_AND_METHODS,
   CLASS_AND_FIELDS,
-  DEFAULT
+  DEFAULT,
 }
diff --git a/src/keepanno/java/androidx/annotation/keep/KeepOption.java b/src/keepanno/java/androidx/annotation/keep/KeepOption.kt
similarity index 93%
rename from src/keepanno/java/androidx/annotation/keep/KeepOption.java
rename to src/keepanno/java/androidx/annotation/keep/KeepOption.kt
index b635d1c..13ef7f6 100644
--- a/src/keepanno/java/androidx/annotation/keep/KeepOption.java
+++ b/src/keepanno/java/androidx/annotation/keep/KeepOption.kt
@@ -18,9 +18,9 @@
 // MAINTAINED AND TESTED IN THE R8 REPO. PLEASE MAKE CHANGES THERE AND REPLICATE.
 // ***********************************************************************************
 
-package androidx.annotation.keep;
+package androidx.annotation.keep
 
-public enum KeepOption {
+enum class KeepOption {
   SHRINKING,
   OPTIMIZATION,
   OBFUSCATION,
diff --git a/src/keepanno/java/androidx/annotation/keep/KeepTarget.java b/src/keepanno/java/androidx/annotation/keep/KeepTarget.java
deleted file mode 100644
index 96196a9..0000000
--- a/src/keepanno/java/androidx/annotation/keep/KeepTarget.java
+++ /dev/null
@@ -1,842 +0,0 @@
-/*
- * Copyright 2025 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.
- */
-
-// ***********************************************************************************
-// GENERATED FILE. DO NOT EDIT! See KeepItemAnnotationGenerator.java.
-// ***********************************************************************************
-
-// ***********************************************************************************
-// MAINTAINED AND TESTED IN THE R8 REPO. PLEASE MAKE CHANGES THERE AND REPLICATE.
-// ***********************************************************************************
-
-package androidx.annotation.keep;
-
-import java.lang.annotation.ElementType;
-import java.lang.annotation.Retention;
-import java.lang.annotation.RetentionPolicy;
-import java.lang.annotation.Target;
-
-/**
- * A target for a keep edge.
- *
- * <p>The target denotes an item along with options for what to keep. An item can be:
- *
- * <ul>
- *   <li>a pattern on classes;
- *   <li>a pattern on methods; or
- *   <li>a pattern on fields.
- * </ul>
- */
-@Target(ElementType.ANNOTATION_TYPE)
-@Retention(RetentionPolicy.CLASS)
-public @interface KeepTarget {
-
-  /**
-   * Specify the kind of this item pattern.
-   *
-   * <p>Possible values are:
-   *
-   * <ul>
-   *   <li>{@link KeepItemKind#ONLY_CLASS}
-   *   <li>{@link KeepItemKind#ONLY_MEMBERS}
-   *   <li>{@link KeepItemKind#ONLY_METHODS}
-   *   <li>{@link KeepItemKind#ONLY_FIELDS}
-   *   <li>{@link KeepItemKind#CLASS_AND_MEMBERS}
-   *   <li>{@link KeepItemKind#CLASS_AND_METHODS}
-   *   <li>{@link KeepItemKind#CLASS_AND_FIELDS}
-   * </ul>
-   *
-   * <p>If unspecified the default kind for an item depends on its member patterns:
-   *
-   * <ul>
-   *   <li>{@link KeepItemKind#ONLY_CLASS} if no member patterns are defined
-   *   <li>{@link KeepItemKind#ONLY_METHODS} if method patterns are defined
-   *   <li>{@link KeepItemKind#ONLY_FIELDS} if field patterns are defined
-   *   <li>{@link KeepItemKind#ONLY_MEMBERS} otherwise.
-   * </ul>
-   *
-   * @return The kind for this pattern.
-   */
-  KeepItemKind kind() default KeepItemKind.DEFAULT;
-
-  /**
-   * Define the usage constraints of the target.
-   *
-   * <p>The specified constraints must remain valid for the target.
-   *
-   * <p>The default constraints depend on the kind of the target. For all targets the default
-   * constraints include:
-   *
-   * <ul>
-   *   <li>{@link KeepConstraint#LOOKUP}
-   *   <li>{@link KeepConstraint#NAME}
-   *   <li>{@link KeepConstraint#VISIBILITY_RELAX}
-   * </ul>
-   *
-   * <p>For classes the default constraints also include:
-   *
-   * <ul>
-   *   <li>{@link KeepConstraint#CLASS_INSTANTIATE}
-   * </ul>
-   *
-   * <p>For methods the default constraints also include:
-   *
-   * <ul>
-   *   <li>{@link KeepConstraint#METHOD_INVOKE}
-   * </ul>
-   *
-   * <p>For fields the default constraints also include:
-   *
-   * <ul>
-   *   <li>{@link KeepConstraint#FIELD_GET}
-   *   <li>{@link KeepConstraint#FIELD_SET}
-   * </ul>
-   *
-   * <p>Mutually exclusive with the property `constraintAdditions` also defining constraints.
-   *
-   * @return Usage constraints for the target.
-   */
-  KeepConstraint[] constraints() default {};
-
-  /**
-   * Add additional usage constraints of the target.
-   *
-   * <p>The specified constraints must remain valid for the target in addition to the default
-   * constraints.
-   *
-   * <p>The default constraints are documented in {@link #constraints}
-   *
-   * <p>Mutually exclusive with the property `constraints` also defining constraints.
-   *
-   * @return Additional usage constraints for the target.
-   */
-  KeepConstraint[] constraintAdditions() default {};
-
-  /**
-   * Patterns for annotations that must remain on the item.
-   *
-   * <p>The annotations matching any of the patterns must remain on the item if the annotation types
-   * remain in the program.
-   *
-   * <p>Note that if the annotation types themselves are unused/removed, then their references on
-   * the item will be removed too. If the annotation types themselves are used reflectively then
-   * they too need a keep annotation or rule to ensure they remain in the program.
-   *
-   * <p>By default no annotation patterns are defined and no annotations are required to remain.
-   *
-   * @return Annotation patterns
-   */
-  AnnotationPattern[] constrainAnnotations() default {};
-
-  /**
-   * Define the class pattern by reference to a binding.
-   *
-   * <p>Mutually exclusive with the following other properties defining class:
-   *
-   * <ul>
-   *   <li>className
-   *   <li>classConstant
-   *   <li>classNamePattern
-   *   <li>instanceOfClassName
-   *   <li>instanceOfClassNameExclusive
-   *   <li>instanceOfClassConstant
-   *   <li>instanceOfClassConstantExclusive
-   *   <li>instanceOfPattern
-   *   <li>classAnnotatedByClassName
-   *   <li>classAnnotatedByClassConstant
-   *   <li>classAnnotatedByClassNamePattern
-   * </ul>
-   *
-   * <p>If none are specified the default is to match any class.
-   *
-   * @return The name of the binding that defines the class.
-   */
-  String classFromBinding() default "";
-
-  /**
-   * Define the class-name pattern by fully qualified class name.
-   *
-   * <p>Mutually exclusive with the following other properties defining class-name:
-   *
-   * <ul>
-   *   <li>classConstant
-   *   <li>classNamePattern
-   *   <li>classFromBinding
-   * </ul>
-   *
-   * <p>If none are specified the default is to match any class name.
-   *
-   * @return The qualified class name that defines the class.
-   */
-  String className() default "";
-
-  /**
-   * Define the class-name pattern by reference to a Class constant.
-   *
-   * <p>Mutually exclusive with the following other properties defining class-name:
-   *
-   * <ul>
-   *   <li>className
-   *   <li>classNamePattern
-   *   <li>classFromBinding
-   * </ul>
-   *
-   * <p>If none are specified the default is to match any class name.
-   *
-   * @return The class-constant that defines the class.
-   */
-  Class<?> classConstant() default Object.class;
-
-  /**
-   * Define the class-name pattern by reference to a class-name pattern.
-   *
-   * <p>Mutually exclusive with the following other properties defining class-name:
-   *
-   * <ul>
-   *   <li>className
-   *   <li>classConstant
-   *   <li>classFromBinding
-   * </ul>
-   *
-   * <p>If none are specified the default is to match any class name.
-   *
-   * @return The class-name pattern that defines the class.
-   */
-  ClassNamePattern classNamePattern() default @ClassNamePattern(unqualifiedName = "");
-
-  /**
-   * Define the instance-of pattern as classes that are instances of the fully qualified class name.
-   *
-   * <p>Mutually exclusive with the following other properties defining instance-of:
-   *
-   * <ul>
-   *   <li>instanceOfClassNameExclusive
-   *   <li>instanceOfClassConstant
-   *   <li>instanceOfClassConstantExclusive
-   *   <li>instanceOfPattern
-   *   <li>classFromBinding
-   * </ul>
-   *
-   * <p>If none are specified the default is to match any class instance.
-   *
-   * @return The qualified class name that defines what instance-of the class must be.
-   */
-  String instanceOfClassName() default "";
-
-  /**
-   * Define the instance-of pattern as classes that are instances of the fully qualified class name.
-   *
-   * <p>The pattern is exclusive in that it does not match classes that are instances of the
-   * pattern, but only those that are instances of classes that are subclasses of the pattern.
-   *
-   * <p>Mutually exclusive with the following other properties defining instance-of:
-   *
-   * <ul>
-   *   <li>instanceOfClassName
-   *   <li>instanceOfClassConstant
-   *   <li>instanceOfClassConstantExclusive
-   *   <li>instanceOfPattern
-   *   <li>classFromBinding
-   * </ul>
-   *
-   * <p>If none are specified the default is to match any class instance.
-   *
-   * @return The qualified class name that defines what instance-of the class must be.
-   */
-  String instanceOfClassNameExclusive() default "";
-
-  /**
-   * Define the instance-of pattern as classes that are instances the referenced Class constant.
-   *
-   * <p>Mutually exclusive with the following other properties defining instance-of:
-   *
-   * <ul>
-   *   <li>instanceOfClassName
-   *   <li>instanceOfClassNameExclusive
-   *   <li>instanceOfClassConstantExclusive
-   *   <li>instanceOfPattern
-   *   <li>classFromBinding
-   * </ul>
-   *
-   * <p>If none are specified the default is to match any class instance.
-   *
-   * @return The class constant that defines what instance-of the class must be.
-   */
-  Class<?> instanceOfClassConstant() default Object.class;
-
-  /**
-   * Define the instance-of pattern as classes that are instances the referenced Class constant.
-   *
-   * <p>The pattern is exclusive in that it does not match classes that are instances of the
-   * pattern, but only those that are instances of classes that are subclasses of the pattern.
-   *
-   * <p>Mutually exclusive with the following other properties defining instance-of:
-   *
-   * <ul>
-   *   <li>instanceOfClassName
-   *   <li>instanceOfClassNameExclusive
-   *   <li>instanceOfClassConstant
-   *   <li>instanceOfPattern
-   *   <li>classFromBinding
-   * </ul>
-   *
-   * <p>If none are specified the default is to match any class instance.
-   *
-   * @return The class constant that defines what instance-of the class must be.
-   */
-  Class<?> instanceOfClassConstantExclusive() default Object.class;
-
-  /**
-   * Define the instance-of with a pattern.
-   *
-   * <p>Mutually exclusive with the following other properties defining instance-of:
-   *
-   * <ul>
-   *   <li>instanceOfClassName
-   *   <li>instanceOfClassNameExclusive
-   *   <li>instanceOfClassConstant
-   *   <li>instanceOfClassConstantExclusive
-   *   <li>classFromBinding
-   * </ul>
-   *
-   * <p>If none are specified the default is to match any class instance.
-   *
-   * @return The pattern that defines what instance-of the class must be.
-   */
-  InstanceOfPattern instanceOfPattern() default @InstanceOfPattern();
-
-  /**
-   * Define the class-annotated-by pattern by fully qualified class name.
-   *
-   * <p>Mutually exclusive with the following other properties defining class-annotated-by:
-   *
-   * <ul>
-   *   <li>classAnnotatedByClassConstant
-   *   <li>classAnnotatedByClassNamePattern
-   *   <li>classFromBinding
-   * </ul>
-   *
-   * <p>If none are specified the default is to match any class regardless of what the class is
-   * annotated by.
-   *
-   * @return The qualified class name that defines the annotation.
-   */
-  String classAnnotatedByClassName() default "";
-
-  /**
-   * Define the class-annotated-by pattern by reference to a Class constant.
-   *
-   * <p>Mutually exclusive with the following other properties defining class-annotated-by:
-   *
-   * <ul>
-   *   <li>classAnnotatedByClassName
-   *   <li>classAnnotatedByClassNamePattern
-   *   <li>classFromBinding
-   * </ul>
-   *
-   * <p>If none are specified the default is to match any class regardless of what the class is
-   * annotated by.
-   *
-   * @return The class-constant that defines the annotation.
-   */
-  Class<?> classAnnotatedByClassConstant() default Object.class;
-
-  /**
-   * Define the class-annotated-by pattern by reference to a class-name pattern.
-   *
-   * <p>Mutually exclusive with the following other properties defining class-annotated-by:
-   *
-   * <ul>
-   *   <li>classAnnotatedByClassName
-   *   <li>classAnnotatedByClassConstant
-   *   <li>classFromBinding
-   * </ul>
-   *
-   * <p>If none are specified the default is to match any class regardless of what the class is
-   * annotated by.
-   *
-   * @return The class-name pattern that defines the annotation.
-   */
-  ClassNamePattern classAnnotatedByClassNamePattern() default
-      @ClassNamePattern(unqualifiedName = "");
-
-  /**
-   * Define the member pattern in full by a reference to a binding.
-   *
-   * <p>Mutually exclusive with all other class and member pattern properties. When a member binding
-   * is referenced this item is defined to be that item, including its class and member patterns.
-   *
-   * @return The binding name that defines the member.
-   */
-  String memberFromBinding() default "";
-
-  /**
-   * Define the member-annotated-by pattern by fully qualified class name.
-   *
-   * <p>Mutually exclusive with the following other properties defining member-annotated-by:
-   *
-   * <ul>
-   *   <li>memberAnnotatedByClassConstant
-   *   <li>memberAnnotatedByClassNamePattern
-   *   <li>memberFromBinding
-   * </ul>
-   *
-   * <p>Mutually exclusive with all field and method properties as use restricts the match to both
-   * types of members.
-   *
-   * <p>If none are specified the default is to match any member regardless of what the member is
-   * annotated by.
-   *
-   * @return The qualified class name that defines the annotation.
-   */
-  String memberAnnotatedByClassName() default "";
-
-  /**
-   * Define the member-annotated-by pattern by reference to a Class constant.
-   *
-   * <p>Mutually exclusive with the following other properties defining member-annotated-by:
-   *
-   * <ul>
-   *   <li>memberAnnotatedByClassName
-   *   <li>memberAnnotatedByClassNamePattern
-   *   <li>memberFromBinding
-   * </ul>
-   *
-   * <p>Mutually exclusive with all field and method properties as use restricts the match to both
-   * types of members.
-   *
-   * <p>If none are specified the default is to match any member regardless of what the member is
-   * annotated by.
-   *
-   * @return The class-constant that defines the annotation.
-   */
-  Class<?> memberAnnotatedByClassConstant() default Object.class;
-
-  /**
-   * Define the member-annotated-by pattern by reference to a class-name pattern.
-   *
-   * <p>Mutually exclusive with the following other properties defining member-annotated-by:
-   *
-   * <ul>
-   *   <li>memberAnnotatedByClassName
-   *   <li>memberAnnotatedByClassConstant
-   *   <li>memberFromBinding
-   * </ul>
-   *
-   * <p>Mutually exclusive with all field and method properties as use restricts the match to both
-   * types of members.
-   *
-   * <p>If none are specified the default is to match any member regardless of what the member is
-   * annotated by.
-   *
-   * @return The class-name pattern that defines the annotation.
-   */
-  ClassNamePattern memberAnnotatedByClassNamePattern() default
-      @ClassNamePattern(unqualifiedName = "");
-
-  /**
-   * Define the member-access pattern by matching on access flags.
-   *
-   * <p>Mutually exclusive with all field and method properties as use restricts the match to both
-   * types of members.
-   *
-   * <p>Mutually exclusive with the property `memberFromBinding` also defining member-access.
-   *
-   * @return The member access-flag constraints that must be met.
-   */
-  MemberAccessFlags[] memberAccess() default {};
-
-  /**
-   * Define the method-annotated-by pattern by fully qualified class name.
-   *
-   * <p>Mutually exclusive with the following other properties defining method-annotated-by:
-   *
-   * <ul>
-   *   <li>methodAnnotatedByClassConstant
-   *   <li>methodAnnotatedByClassNamePattern
-   *   <li>memberFromBinding
-   * </ul>
-   *
-   * <p>Mutually exclusive with all field properties.
-   *
-   * <p>If none are specified the default is to match any method regardless of what the method is
-   * annotated by.
-   *
-   * @return The qualified class name that defines the annotation.
-   */
-  String methodAnnotatedByClassName() default "";
-
-  /**
-   * Define the method-annotated-by pattern by reference to a Class constant.
-   *
-   * <p>Mutually exclusive with the following other properties defining method-annotated-by:
-   *
-   * <ul>
-   *   <li>methodAnnotatedByClassName
-   *   <li>methodAnnotatedByClassNamePattern
-   *   <li>memberFromBinding
-   * </ul>
-   *
-   * <p>Mutually exclusive with all field properties.
-   *
-   * <p>If none are specified the default is to match any method regardless of what the method is
-   * annotated by.
-   *
-   * @return The class-constant that defines the annotation.
-   */
-  Class<?> methodAnnotatedByClassConstant() default Object.class;
-
-  /**
-   * Define the method-annotated-by pattern by reference to a class-name pattern.
-   *
-   * <p>Mutually exclusive with the following other properties defining method-annotated-by:
-   *
-   * <ul>
-   *   <li>methodAnnotatedByClassName
-   *   <li>methodAnnotatedByClassConstant
-   *   <li>memberFromBinding
-   * </ul>
-   *
-   * <p>Mutually exclusive with all field properties.
-   *
-   * <p>If none are specified the default is to match any method regardless of what the method is
-   * annotated by.
-   *
-   * @return The class-name pattern that defines the annotation.
-   */
-  ClassNamePattern methodAnnotatedByClassNamePattern() default
-      @ClassNamePattern(unqualifiedName = "");
-
-  /**
-   * Define the method-access pattern by matching on access flags.
-   *
-   * <p>Mutually exclusive with all field properties.
-   *
-   * <p>If none, and other properties define this item as a method, the default matches any
-   * method-access flags.
-   *
-   * <p>Mutually exclusive with the property `memberFromBinding` also defining method-access.
-   *
-   * @return The method access-flag constraints that must be met.
-   */
-  MethodAccessFlags[] methodAccess() default {};
-
-  /**
-   * Define the method-name pattern by an exact method name.
-   *
-   * <p>Mutually exclusive with all field properties.
-   *
-   * <p>If none, and other properties define this item as a method, the default matches any method
-   * name.
-   *
-   * <p>Mutually exclusive with the following other properties defining method-name:
-   *
-   * <ul>
-   *   <li>methodNamePattern
-   *   <li>memberFromBinding
-   * </ul>
-   *
-   * @return The exact method name of the method.
-   */
-  String methodName() default "";
-
-  /**
-   * Define the method-name pattern by a string pattern.
-   *
-   * <p>Mutually exclusive with all field properties.
-   *
-   * <p>If none, and other properties define this item as a method, the default matches any method
-   * name.
-   *
-   * <p>Mutually exclusive with the following other properties defining method-name:
-   *
-   * <ul>
-   *   <li>methodName
-   *   <li>memberFromBinding
-   * </ul>
-   *
-   * @return The string pattern of the method name.
-   */
-  StringPattern methodNamePattern() default @StringPattern(exact = "");
-
-  /**
-   * Define the method return-type pattern by a fully qualified type or 'void'.
-   *
-   * <p>Mutually exclusive with all field properties.
-   *
-   * <p>If none, and other properties define this item as a method, the default matches any return
-   * type.
-   *
-   * <p>Mutually exclusive with the following other properties defining return-type:
-   *
-   * <ul>
-   *   <li>methodReturnTypeConstant
-   *   <li>methodReturnTypePattern
-   *   <li>memberFromBinding
-   * </ul>
-   *
-   * @return The qualified type name of the method return type.
-   */
-  String methodReturnType() default "";
-
-  /**
-   * Define the method return-type pattern by a class constant.
-   *
-   * <p>Mutually exclusive with all field properties.
-   *
-   * <p>If none, and other properties define this item as a method, the default matches any return
-   * type.
-   *
-   * <p>Mutually exclusive with the following other properties defining return-type:
-   *
-   * <ul>
-   *   <li>methodReturnType
-   *   <li>methodReturnTypePattern
-   *   <li>memberFromBinding
-   * </ul>
-   *
-   * @return A class constant denoting the type of the method return type.
-   */
-  Class<?> methodReturnTypeConstant() default Object.class;
-
-  /**
-   * Define the method return-type pattern by a type pattern.
-   *
-   * <p>Mutually exclusive with all field properties.
-   *
-   * <p>If none, and other properties define this item as a method, the default matches any return
-   * type.
-   *
-   * <p>Mutually exclusive with the following other properties defining return-type:
-   *
-   * <ul>
-   *   <li>methodReturnType
-   *   <li>methodReturnTypeConstant
-   *   <li>memberFromBinding
-   * </ul>
-   *
-   * @return The pattern of the method return type.
-   */
-  TypePattern methodReturnTypePattern() default @TypePattern(name = "");
-
-  /**
-   * Define the method parameters pattern by a list of fully qualified types.
-   *
-   * <p>Mutually exclusive with all field properties.
-   *
-   * <p>If none, and other properties define this item as a method, the default matches any
-   * parameters.
-   *
-   * <p>Mutually exclusive with the following other properties defining parameters:
-   *
-   * <ul>
-   *   <li>methodParameterTypePatterns
-   *   <li>memberFromBinding
-   * </ul>
-   *
-   * @return The list of qualified type names of the method parameters.
-   */
-  String[] methodParameters() default {""};
-
-  /**
-   * Define the method parameters pattern by a list of patterns on types.
-   *
-   * <p>Mutually exclusive with all field properties.
-   *
-   * <p>If none, and other properties define this item as a method, the default matches any
-   * parameters.
-   *
-   * <p>Mutually exclusive with the following other properties defining parameters:
-   *
-   * <ul>
-   *   <li>methodParameters
-   *   <li>memberFromBinding
-   * </ul>
-   *
-   * @return The list of type patterns for the method parameters.
-   */
-  TypePattern[] methodParameterTypePatterns() default {@TypePattern(name = "")};
-
-  /**
-   * Define the field-annotated-by pattern by fully qualified class name.
-   *
-   * <p>Mutually exclusive with the following other properties defining field-annotated-by:
-   *
-   * <ul>
-   *   <li>fieldAnnotatedByClassConstant
-   *   <li>fieldAnnotatedByClassNamePattern
-   *   <li>memberFromBinding
-   * </ul>
-   *
-   * <p>Mutually exclusive with all method properties.
-   *
-   * <p>If none are specified the default is to match any field regardless of what the field is
-   * annotated by.
-   *
-   * @return The qualified class name that defines the annotation.
-   */
-  String fieldAnnotatedByClassName() default "";
-
-  /**
-   * Define the field-annotated-by pattern by reference to a Class constant.
-   *
-   * <p>Mutually exclusive with the following other properties defining field-annotated-by:
-   *
-   * <ul>
-   *   <li>fieldAnnotatedByClassName
-   *   <li>fieldAnnotatedByClassNamePattern
-   *   <li>memberFromBinding
-   * </ul>
-   *
-   * <p>Mutually exclusive with all method properties.
-   *
-   * <p>If none are specified the default is to match any field regardless of what the field is
-   * annotated by.
-   *
-   * @return The class-constant that defines the annotation.
-   */
-  Class<?> fieldAnnotatedByClassConstant() default Object.class;
-
-  /**
-   * Define the field-annotated-by pattern by reference to a class-name pattern.
-   *
-   * <p>Mutually exclusive with the following other properties defining field-annotated-by:
-   *
-   * <ul>
-   *   <li>fieldAnnotatedByClassName
-   *   <li>fieldAnnotatedByClassConstant
-   *   <li>memberFromBinding
-   * </ul>
-   *
-   * <p>Mutually exclusive with all method properties.
-   *
-   * <p>If none are specified the default is to match any field regardless of what the field is
-   * annotated by.
-   *
-   * @return The class-name pattern that defines the annotation.
-   */
-  ClassNamePattern fieldAnnotatedByClassNamePattern() default
-      @ClassNamePattern(unqualifiedName = "");
-
-  /**
-   * Define the field-access pattern by matching on access flags.
-   *
-   * <p>Mutually exclusive with all method properties.
-   *
-   * <p>If none, and other properties define this item as a field, the default matches any
-   * field-access flags.
-   *
-   * <p>Mutually exclusive with the property `memberFromBinding` also defining field-access.
-   *
-   * @return The field access-flag constraints that must be met.
-   */
-  FieldAccessFlags[] fieldAccess() default {};
-
-  /**
-   * Define the field-name pattern by an exact field name.
-   *
-   * <p>Mutually exclusive with all method properties.
-   *
-   * <p>If none, and other properties define this item as a field, the default matches any field
-   * name.
-   *
-   * <p>Mutually exclusive with the following other properties defining field-name:
-   *
-   * <ul>
-   *   <li>fieldNamePattern
-   *   <li>memberFromBinding
-   * </ul>
-   *
-   * @return The exact field name of the field.
-   */
-  String fieldName() default "";
-
-  /**
-   * Define the field-name pattern by a string pattern.
-   *
-   * <p>Mutually exclusive with all method properties.
-   *
-   * <p>If none, and other properties define this item as a field, the default matches any field
-   * name.
-   *
-   * <p>Mutually exclusive with the following other properties defining field-name:
-   *
-   * <ul>
-   *   <li>fieldName
-   *   <li>memberFromBinding
-   * </ul>
-   *
-   * @return The string pattern of the field name.
-   */
-  StringPattern fieldNamePattern() default @StringPattern(exact = "");
-
-  /**
-   * Define the field-type pattern by a fully qualified type.
-   *
-   * <p>Mutually exclusive with all method properties.
-   *
-   * <p>If none, and other properties define this item as a field, the default matches any type.
-   *
-   * <p>Mutually exclusive with the following other properties defining field-type:
-   *
-   * <ul>
-   *   <li>fieldTypeConstant
-   *   <li>fieldTypePattern
-   *   <li>memberFromBinding
-   * </ul>
-   *
-   * @return The qualified type name for the field type.
-   */
-  String fieldType() default "";
-
-  /**
-   * Define the field-type pattern by a class constant.
-   *
-   * <p>Mutually exclusive with all method properties.
-   *
-   * <p>If none, and other properties define this item as a field, the default matches any type.
-   *
-   * <p>Mutually exclusive with the following other properties defining field-type:
-   *
-   * <ul>
-   *   <li>fieldType
-   *   <li>fieldTypePattern
-   *   <li>memberFromBinding
-   * </ul>
-   *
-   * @return The class constant for the field type.
-   */
-  Class<?> fieldTypeConstant() default Object.class;
-
-  /**
-   * Define the field-type pattern by a pattern on types.
-   *
-   * <p>Mutually exclusive with all method properties.
-   *
-   * <p>If none, and other properties define this item as a field, the default matches any type.
-   *
-   * <p>Mutually exclusive with the following other properties defining field-type:
-   *
-   * <ul>
-   *   <li>fieldType
-   *   <li>fieldTypeConstant
-   *   <li>memberFromBinding
-   * </ul>
-   *
-   * @return The type pattern for the field type.
-   */
-  TypePattern fieldTypePattern() default @TypePattern(name = "");
-}
diff --git a/src/keepanno/java/androidx/annotation/keep/KeepTarget.kt b/src/keepanno/java/androidx/annotation/keep/KeepTarget.kt
new file mode 100644
index 0000000..7dbb4a2
--- /dev/null
+++ b/src/keepanno/java/androidx/annotation/keep/KeepTarget.kt
@@ -0,0 +1,906 @@
+/*
+ * Copyright 2025 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.
+ */
+
+// ***********************************************************************************
+// GENERATED FILE. DO NOT EDIT! See KeepItemAnnotationGenerator.java.
+// ***********************************************************************************
+
+// ***********************************************************************************
+// MAINTAINED AND TESTED IN THE R8 REPO. PLEASE MAKE CHANGES THERE AND REPLICATE.
+// ***********************************************************************************
+
+package androidx.annotation.keep
+
+import kotlin.annotation.Retention
+import kotlin.annotation.Target
+import kotlin.reflect.KClass
+
+/**
+ * A target for a keep edge.
+ *
+ * <p>
+ * The target denotes an item along with options for what to keep. An item can be:
+ * <ul>
+ * <li>a pattern on classes;
+ * <li>a pattern on methods; or
+ * <li>a pattern on fields.
+ * </ul>
+ */
+@Retention(AnnotationRetention.BINARY)
+@Target(AnnotationTarget.ANNOTATION_CLASS)
+annotation class KeepTarget(
+
+  /**
+   * Specify the kind of this item pattern.
+   *
+   * <p>
+   * Possible values are:
+   * <ul>
+   * <li>{@link KeepItemKind#ONLY_CLASS}
+   * <li>{@link KeepItemKind#ONLY_MEMBERS}
+   * <li>{@link KeepItemKind#ONLY_METHODS}
+   * <li>{@link KeepItemKind#ONLY_FIELDS}
+   * <li>{@link KeepItemKind#CLASS_AND_MEMBERS}
+   * <li>{@link KeepItemKind#CLASS_AND_METHODS}
+   * <li>{@link KeepItemKind#CLASS_AND_FIELDS}
+   * </ul>
+   *
+   * <p>
+   * If unspecified the default kind for an item depends on its member patterns:
+   * <ul>
+   * <li>{@link KeepItemKind#ONLY_CLASS} if no member patterns are defined
+   * <li>{@link KeepItemKind#ONLY_METHODS} if method patterns are defined
+   * <li>{@link KeepItemKind#ONLY_FIELDS} if field patterns are defined
+   * <li>{@link KeepItemKind#ONLY_MEMBERS} otherwise.
+   * </ul>
+   *
+   * @return The kind for this pattern.
+   */
+  val kind: KeepItemKind = KeepItemKind.DEFAULT,
+
+  /**
+   * Define the usage constraints of the target.
+   *
+   * <p>
+   * The specified constraints must remain valid for the target.
+   *
+   * <p>
+   * The default constraints depend on the kind of the target. For all targets the default
+   * constraints include:
+   * <ul>
+   * <li>{@link KeepConstraint#LOOKUP}
+   * <li>{@link KeepConstraint#NAME}
+   * <li>{@link KeepConstraint#VISIBILITY_RELAX}
+   * </ul>
+   *
+   * <p>
+   * For classes the default constraints also include:
+   * <ul>
+   * <li>{@link KeepConstraint#CLASS_INSTANTIATE}
+   * </ul>
+   *
+   * <p>
+   * For methods the default constraints also include:
+   * <ul>
+   * <li>{@link KeepConstraint#METHOD_INVOKE}
+   * </ul>
+   *
+   * <p>
+   * For fields the default constraints also include:
+   * <ul>
+   * <li>{@link KeepConstraint#FIELD_GET}
+   * <li>{@link KeepConstraint#FIELD_SET}
+   * </ul>
+   *
+   * <p>
+   * Mutually exclusive with the property `constraintAdditions` also defining constraints.
+   *
+   * @return Usage constraints for the target.
+   */
+  val constraints: Array<KeepConstraint> = [],
+
+  /**
+   * Add additional usage constraints of the target.
+   *
+   * <p>
+   * The specified constraints must remain valid for the target in addition to the default
+   * constraints.
+   *
+   * <p>
+   * The default constraints are documented in {@link #constraints}
+   *
+   * <p>
+   * Mutually exclusive with the property `constraints` also defining constraints.
+   *
+   * @return Additional usage constraints for the target.
+   */
+  val constraintAdditions: Array<KeepConstraint> = [],
+
+  /**
+   * Patterns for annotations that must remain on the item.
+   *
+   * <p>
+   * The annotations matching any of the patterns must remain on the item if the annotation types
+   * remain in the program.
+   *
+   * <p>
+   * Note that if the annotation types themselves are unused/removed, then their references on the
+   * item will be removed too. If the annotation types themselves are used reflectively then they
+   * too need a keep annotation or rule to ensure they remain in the program.
+   *
+   * <p>
+   * By default no annotation patterns are defined and no annotations are required to remain.
+   *
+   * @return Annotation patterns
+   */
+  val constrainAnnotations: Array<AnnotationPattern> = [],
+
+  /**
+   * Define the class pattern by reference to a binding.
+   *
+   * <p>
+   * Mutually exclusive with the following other properties defining class:
+   * <ul>
+   * <li>className
+   * <li>classConstant
+   * <li>classNamePattern
+   * <li>instanceOfClassName
+   * <li>instanceOfClassNameExclusive
+   * <li>instanceOfClassConstant
+   * <li>instanceOfClassConstantExclusive
+   * <li>instanceOfPattern
+   * <li>classAnnotatedByClassName
+   * <li>classAnnotatedByClassConstant
+   * <li>classAnnotatedByClassNamePattern
+   * </ul>
+   *
+   * <p>
+   * If none are specified the default is to match any class.
+   *
+   * @return The name of the binding that defines the class.
+   */
+  val classFromBinding: String = "",
+
+  /**
+   * Define the class-name pattern by fully qualified class name.
+   *
+   * <p>
+   * Mutually exclusive with the following other properties defining class-name:
+   * <ul>
+   * <li>classConstant
+   * <li>classNamePattern
+   * <li>classFromBinding
+   * </ul>
+   *
+   * <p>
+   * If none are specified the default is to match any class name.
+   *
+   * @return The qualified class name that defines the class.
+   */
+  val className: String = "",
+
+  /**
+   * Define the class-name pattern by reference to a Class constant.
+   *
+   * <p>
+   * Mutually exclusive with the following other properties defining class-name:
+   * <ul>
+   * <li>className
+   * <li>classNamePattern
+   * <li>classFromBinding
+   * </ul>
+   *
+   * <p>
+   * If none are specified the default is to match any class name.
+   *
+   * @return The class-constant that defines the class.
+   */
+  val classConstant: KClass<*> = Object::class,
+
+  /**
+   * Define the class-name pattern by reference to a class-name pattern.
+   *
+   * <p>
+   * Mutually exclusive with the following other properties defining class-name:
+   * <ul>
+   * <li>className
+   * <li>classConstant
+   * <li>classFromBinding
+   * </ul>
+   *
+   * <p>
+   * If none are specified the default is to match any class name.
+   *
+   * @return The class-name pattern that defines the class.
+   */
+  val classNamePattern: ClassNamePattern = ClassNamePattern(unqualifiedName = ""),
+
+  /**
+   * Define the instance-of pattern as classes that are instances of the fully qualified class name.
+   *
+   * <p>
+   * Mutually exclusive with the following other properties defining instance-of:
+   * <ul>
+   * <li>instanceOfClassNameExclusive
+   * <li>instanceOfClassConstant
+   * <li>instanceOfClassConstantExclusive
+   * <li>instanceOfPattern
+   * <li>classFromBinding
+   * </ul>
+   *
+   * <p>
+   * If none are specified the default is to match any class instance.
+   *
+   * @return The qualified class name that defines what instance-of the class must be.
+   */
+  val instanceOfClassName: String = "",
+
+  /**
+   * Define the instance-of pattern as classes that are instances of the fully qualified class name.
+   *
+   * <p>
+   * The pattern is exclusive in that it does not match classes that are instances of the pattern,
+   * but only those that are instances of classes that are subclasses of the pattern.
+   *
+   * <p>
+   * Mutually exclusive with the following other properties defining instance-of:
+   * <ul>
+   * <li>instanceOfClassName
+   * <li>instanceOfClassConstant
+   * <li>instanceOfClassConstantExclusive
+   * <li>instanceOfPattern
+   * <li>classFromBinding
+   * </ul>
+   *
+   * <p>
+   * If none are specified the default is to match any class instance.
+   *
+   * @return The qualified class name that defines what instance-of the class must be.
+   */
+  val instanceOfClassNameExclusive: String = "",
+
+  /**
+   * Define the instance-of pattern as classes that are instances the referenced Class constant.
+   *
+   * <p>
+   * Mutually exclusive with the following other properties defining instance-of:
+   * <ul>
+   * <li>instanceOfClassName
+   * <li>instanceOfClassNameExclusive
+   * <li>instanceOfClassConstantExclusive
+   * <li>instanceOfPattern
+   * <li>classFromBinding
+   * </ul>
+   *
+   * <p>
+   * If none are specified the default is to match any class instance.
+   *
+   * @return The class constant that defines what instance-of the class must be.
+   */
+  val instanceOfClassConstant: KClass<*> = Object::class,
+
+  /**
+   * Define the instance-of pattern as classes that are instances the referenced Class constant.
+   *
+   * <p>
+   * The pattern is exclusive in that it does not match classes that are instances of the pattern,
+   * but only those that are instances of classes that are subclasses of the pattern.
+   *
+   * <p>
+   * Mutually exclusive with the following other properties defining instance-of:
+   * <ul>
+   * <li>instanceOfClassName
+   * <li>instanceOfClassNameExclusive
+   * <li>instanceOfClassConstant
+   * <li>instanceOfPattern
+   * <li>classFromBinding
+   * </ul>
+   *
+   * <p>
+   * If none are specified the default is to match any class instance.
+   *
+   * @return The class constant that defines what instance-of the class must be.
+   */
+  val instanceOfClassConstantExclusive: KClass<*> = Object::class,
+
+  /**
+   * Define the instance-of with a pattern.
+   *
+   * <p>
+   * Mutually exclusive with the following other properties defining instance-of:
+   * <ul>
+   * <li>instanceOfClassName
+   * <li>instanceOfClassNameExclusive
+   * <li>instanceOfClassConstant
+   * <li>instanceOfClassConstantExclusive
+   * <li>classFromBinding
+   * </ul>
+   *
+   * <p>
+   * If none are specified the default is to match any class instance.
+   *
+   * @return The pattern that defines what instance-of the class must be.
+   */
+  val instanceOfPattern: InstanceOfPattern = InstanceOfPattern(),
+
+  /**
+   * Define the class-annotated-by pattern by fully qualified class name.
+   *
+   * <p>
+   * Mutually exclusive with the following other properties defining class-annotated-by:
+   * <ul>
+   * <li>classAnnotatedByClassConstant
+   * <li>classAnnotatedByClassNamePattern
+   * <li>classFromBinding
+   * </ul>
+   *
+   * <p>
+   * If none are specified the default is to match any class regardless of what the class is
+   * annotated by.
+   *
+   * @return The qualified class name that defines the annotation.
+   */
+  val classAnnotatedByClassName: String = "",
+
+  /**
+   * Define the class-annotated-by pattern by reference to a Class constant.
+   *
+   * <p>
+   * Mutually exclusive with the following other properties defining class-annotated-by:
+   * <ul>
+   * <li>classAnnotatedByClassName
+   * <li>classAnnotatedByClassNamePattern
+   * <li>classFromBinding
+   * </ul>
+   *
+   * <p>
+   * If none are specified the default is to match any class regardless of what the class is
+   * annotated by.
+   *
+   * @return The class-constant that defines the annotation.
+   */
+  val classAnnotatedByClassConstant: KClass<*> = Object::class,
+
+  /**
+   * Define the class-annotated-by pattern by reference to a class-name pattern.
+   *
+   * <p>
+   * Mutually exclusive with the following other properties defining class-annotated-by:
+   * <ul>
+   * <li>classAnnotatedByClassName
+   * <li>classAnnotatedByClassConstant
+   * <li>classFromBinding
+   * </ul>
+   *
+   * <p>
+   * If none are specified the default is to match any class regardless of what the class is
+   * annotated by.
+   *
+   * @return The class-name pattern that defines the annotation.
+   */
+  val classAnnotatedByClassNamePattern: ClassNamePattern = ClassNamePattern(unqualifiedName = ""),
+
+  /**
+   * Define the member pattern in full by a reference to a binding.
+   *
+   * <p>
+   * Mutually exclusive with all other class and member pattern properties. When a member binding is
+   * referenced this item is defined to be that item, including its class and member patterns.
+   *
+   * @return The binding name that defines the member.
+   */
+  val memberFromBinding: String = "",
+
+  /**
+   * Define the member-annotated-by pattern by fully qualified class name.
+   *
+   * <p>
+   * Mutually exclusive with the following other properties defining member-annotated-by:
+   * <ul>
+   * <li>memberAnnotatedByClassConstant
+   * <li>memberAnnotatedByClassNamePattern
+   * <li>memberFromBinding
+   * </ul>
+   *
+   * <p>
+   * Mutually exclusive with all field and method properties as use restricts the match to both
+   * types of members.
+   *
+   * <p>
+   * If none are specified the default is to match any member regardless of what the member is
+   * annotated by.
+   *
+   * @return The qualified class name that defines the annotation.
+   */
+  val memberAnnotatedByClassName: String = "",
+
+  /**
+   * Define the member-annotated-by pattern by reference to a Class constant.
+   *
+   * <p>
+   * Mutually exclusive with the following other properties defining member-annotated-by:
+   * <ul>
+   * <li>memberAnnotatedByClassName
+   * <li>memberAnnotatedByClassNamePattern
+   * <li>memberFromBinding
+   * </ul>
+   *
+   * <p>
+   * Mutually exclusive with all field and method properties as use restricts the match to both
+   * types of members.
+   *
+   * <p>
+   * If none are specified the default is to match any member regardless of what the member is
+   * annotated by.
+   *
+   * @return The class-constant that defines the annotation.
+   */
+  val memberAnnotatedByClassConstant: KClass<*> = Object::class,
+
+  /**
+   * Define the member-annotated-by pattern by reference to a class-name pattern.
+   *
+   * <p>
+   * Mutually exclusive with the following other properties defining member-annotated-by:
+   * <ul>
+   * <li>memberAnnotatedByClassName
+   * <li>memberAnnotatedByClassConstant
+   * <li>memberFromBinding
+   * </ul>
+   *
+   * <p>
+   * Mutually exclusive with all field and method properties as use restricts the match to both
+   * types of members.
+   *
+   * <p>
+   * If none are specified the default is to match any member regardless of what the member is
+   * annotated by.
+   *
+   * @return The class-name pattern that defines the annotation.
+   */
+  val memberAnnotatedByClassNamePattern: ClassNamePattern = ClassNamePattern(unqualifiedName = ""),
+
+  /**
+   * Define the member-access pattern by matching on access flags.
+   *
+   * <p>
+   * Mutually exclusive with all field and method properties as use restricts the match to both
+   * types of members.
+   *
+   * <p>
+   * Mutually exclusive with the property `memberFromBinding` also defining member-access.
+   *
+   * @return The member access-flag constraints that must be met.
+   */
+  val memberAccess: Array<MemberAccessFlags> = [],
+
+  /**
+   * Define the method-annotated-by pattern by fully qualified class name.
+   *
+   * <p>
+   * Mutually exclusive with the following other properties defining method-annotated-by:
+   * <ul>
+   * <li>methodAnnotatedByClassConstant
+   * <li>methodAnnotatedByClassNamePattern
+   * <li>memberFromBinding
+   * </ul>
+   *
+   * <p>
+   * Mutually exclusive with all field properties.
+   *
+   * <p>
+   * If none are specified the default is to match any method regardless of what the method is
+   * annotated by.
+   *
+   * @return The qualified class name that defines the annotation.
+   */
+  val methodAnnotatedByClassName: String = "",
+
+  /**
+   * Define the method-annotated-by pattern by reference to a Class constant.
+   *
+   * <p>
+   * Mutually exclusive with the following other properties defining method-annotated-by:
+   * <ul>
+   * <li>methodAnnotatedByClassName
+   * <li>methodAnnotatedByClassNamePattern
+   * <li>memberFromBinding
+   * </ul>
+   *
+   * <p>
+   * Mutually exclusive with all field properties.
+   *
+   * <p>
+   * If none are specified the default is to match any method regardless of what the method is
+   * annotated by.
+   *
+   * @return The class-constant that defines the annotation.
+   */
+  val methodAnnotatedByClassConstant: KClass<*> = Object::class,
+
+  /**
+   * Define the method-annotated-by pattern by reference to a class-name pattern.
+   *
+   * <p>
+   * Mutually exclusive with the following other properties defining method-annotated-by:
+   * <ul>
+   * <li>methodAnnotatedByClassName
+   * <li>methodAnnotatedByClassConstant
+   * <li>memberFromBinding
+   * </ul>
+   *
+   * <p>
+   * Mutually exclusive with all field properties.
+   *
+   * <p>
+   * If none are specified the default is to match any method regardless of what the method is
+   * annotated by.
+   *
+   * @return The class-name pattern that defines the annotation.
+   */
+  val methodAnnotatedByClassNamePattern: ClassNamePattern = ClassNamePattern(unqualifiedName = ""),
+
+  /**
+   * Define the method-access pattern by matching on access flags.
+   *
+   * <p>
+   * Mutually exclusive with all field properties.
+   *
+   * <p>
+   * If none, and other properties define this item as a method, the default matches any
+   * method-access flags.
+   *
+   * <p>
+   * Mutually exclusive with the property `memberFromBinding` also defining method-access.
+   *
+   * @return The method access-flag constraints that must be met.
+   */
+  val methodAccess: Array<MethodAccessFlags> = [],
+
+  /**
+   * Define the method-name pattern by an exact method name.
+   *
+   * <p>
+   * Mutually exclusive with all field properties.
+   *
+   * <p>
+   * If none, and other properties define this item as a method, the default matches any method
+   * name.
+   *
+   * <p>
+   * Mutually exclusive with the following other properties defining method-name:
+   * <ul>
+   * <li>methodNamePattern
+   * <li>memberFromBinding
+   * </ul>
+   *
+   * @return The exact method name of the method.
+   */
+  val methodName: String = "",
+
+  /**
+   * Define the method-name pattern by a string pattern.
+   *
+   * <p>
+   * Mutually exclusive with all field properties.
+   *
+   * <p>
+   * If none, and other properties define this item as a method, the default matches any method
+   * name.
+   *
+   * <p>
+   * Mutually exclusive with the following other properties defining method-name:
+   * <ul>
+   * <li>methodName
+   * <li>memberFromBinding
+   * </ul>
+   *
+   * @return The string pattern of the method name.
+   */
+  val methodNamePattern: StringPattern = StringPattern(exact = ""),
+
+  /**
+   * Define the method return-type pattern by a fully qualified type or 'void'.
+   *
+   * <p>
+   * Mutually exclusive with all field properties.
+   *
+   * <p>
+   * If none, and other properties define this item as a method, the default matches any return
+   * type.
+   *
+   * <p>
+   * Mutually exclusive with the following other properties defining return-type:
+   * <ul>
+   * <li>methodReturnTypeConstant
+   * <li>methodReturnTypePattern
+   * <li>memberFromBinding
+   * </ul>
+   *
+   * @return The qualified type name of the method return type.
+   */
+  val methodReturnType: String = "",
+
+  /**
+   * Define the method return-type pattern by a class constant.
+   *
+   * <p>
+   * Mutually exclusive with all field properties.
+   *
+   * <p>
+   * If none, and other properties define this item as a method, the default matches any return
+   * type.
+   *
+   * <p>
+   * Mutually exclusive with the following other properties defining return-type:
+   * <ul>
+   * <li>methodReturnType
+   * <li>methodReturnTypePattern
+   * <li>memberFromBinding
+   * </ul>
+   *
+   * @return A class constant denoting the type of the method return type.
+   */
+  val methodReturnTypeConstant: KClass<*> = Object::class,
+
+  /**
+   * Define the method return-type pattern by a type pattern.
+   *
+   * <p>
+   * Mutually exclusive with all field properties.
+   *
+   * <p>
+   * If none, and other properties define this item as a method, the default matches any return
+   * type.
+   *
+   * <p>
+   * Mutually exclusive with the following other properties defining return-type:
+   * <ul>
+   * <li>methodReturnType
+   * <li>methodReturnTypeConstant
+   * <li>memberFromBinding
+   * </ul>
+   *
+   * @return The pattern of the method return type.
+   */
+  val methodReturnTypePattern: TypePattern = TypePattern(name = ""),
+
+  /**
+   * Define the method parameters pattern by a list of fully qualified types.
+   *
+   * <p>
+   * Mutually exclusive with all field properties.
+   *
+   * <p>
+   * If none, and other properties define this item as a method, the default matches any parameters.
+   *
+   * <p>
+   * Mutually exclusive with the following other properties defining parameters:
+   * <ul>
+   * <li>methodParameterTypePatterns
+   * <li>memberFromBinding
+   * </ul>
+   *
+   * @return The list of qualified type names of the method parameters.
+   */
+  val methodParameters: Array<String> = [""],
+
+  /**
+   * Define the method parameters pattern by a list of patterns on types.
+   *
+   * <p>
+   * Mutually exclusive with all field properties.
+   *
+   * <p>
+   * If none, and other properties define this item as a method, the default matches any parameters.
+   *
+   * <p>
+   * Mutually exclusive with the following other properties defining parameters:
+   * <ul>
+   * <li>methodParameters
+   * <li>memberFromBinding
+   * </ul>
+   *
+   * @return The list of type patterns for the method parameters.
+   */
+  val methodParameterTypePatterns: Array<TypePattern> = [TypePattern(name = "")],
+
+  /**
+   * Define the field-annotated-by pattern by fully qualified class name.
+   *
+   * <p>
+   * Mutually exclusive with the following other properties defining field-annotated-by:
+   * <ul>
+   * <li>fieldAnnotatedByClassConstant
+   * <li>fieldAnnotatedByClassNamePattern
+   * <li>memberFromBinding
+   * </ul>
+   *
+   * <p>
+   * Mutually exclusive with all method properties.
+   *
+   * <p>
+   * If none are specified the default is to match any field regardless of what the field is
+   * annotated by.
+   *
+   * @return The qualified class name that defines the annotation.
+   */
+  val fieldAnnotatedByClassName: String = "",
+
+  /**
+   * Define the field-annotated-by pattern by reference to a Class constant.
+   *
+   * <p>
+   * Mutually exclusive with the following other properties defining field-annotated-by:
+   * <ul>
+   * <li>fieldAnnotatedByClassName
+   * <li>fieldAnnotatedByClassNamePattern
+   * <li>memberFromBinding
+   * </ul>
+   *
+   * <p>
+   * Mutually exclusive with all method properties.
+   *
+   * <p>
+   * If none are specified the default is to match any field regardless of what the field is
+   * annotated by.
+   *
+   * @return The class-constant that defines the annotation.
+   */
+  val fieldAnnotatedByClassConstant: KClass<*> = Object::class,
+
+  /**
+   * Define the field-annotated-by pattern by reference to a class-name pattern.
+   *
+   * <p>
+   * Mutually exclusive with the following other properties defining field-annotated-by:
+   * <ul>
+   * <li>fieldAnnotatedByClassName
+   * <li>fieldAnnotatedByClassConstant
+   * <li>memberFromBinding
+   * </ul>
+   *
+   * <p>
+   * Mutually exclusive with all method properties.
+   *
+   * <p>
+   * If none are specified the default is to match any field regardless of what the field is
+   * annotated by.
+   *
+   * @return The class-name pattern that defines the annotation.
+   */
+  val fieldAnnotatedByClassNamePattern: ClassNamePattern = ClassNamePattern(unqualifiedName = ""),
+
+  /**
+   * Define the field-access pattern by matching on access flags.
+   *
+   * <p>
+   * Mutually exclusive with all method properties.
+   *
+   * <p>
+   * If none, and other properties define this item as a field, the default matches any field-access
+   * flags.
+   *
+   * <p>
+   * Mutually exclusive with the property `memberFromBinding` also defining field-access.
+   *
+   * @return The field access-flag constraints that must be met.
+   */
+  val fieldAccess: Array<FieldAccessFlags> = [],
+
+  /**
+   * Define the field-name pattern by an exact field name.
+   *
+   * <p>
+   * Mutually exclusive with all method properties.
+   *
+   * <p>
+   * If none, and other properties define this item as a field, the default matches any field name.
+   *
+   * <p>
+   * Mutually exclusive with the following other properties defining field-name:
+   * <ul>
+   * <li>fieldNamePattern
+   * <li>memberFromBinding
+   * </ul>
+   *
+   * @return The exact field name of the field.
+   */
+  val fieldName: String = "",
+
+  /**
+   * Define the field-name pattern by a string pattern.
+   *
+   * <p>
+   * Mutually exclusive with all method properties.
+   *
+   * <p>
+   * If none, and other properties define this item as a field, the default matches any field name.
+   *
+   * <p>
+   * Mutually exclusive with the following other properties defining field-name:
+   * <ul>
+   * <li>fieldName
+   * <li>memberFromBinding
+   * </ul>
+   *
+   * @return The string pattern of the field name.
+   */
+  val fieldNamePattern: StringPattern = StringPattern(exact = ""),
+
+  /**
+   * Define the field-type pattern by a fully qualified type.
+   *
+   * <p>
+   * Mutually exclusive with all method properties.
+   *
+   * <p>
+   * If none, and other properties define this item as a field, the default matches any type.
+   *
+   * <p>
+   * Mutually exclusive with the following other properties defining field-type:
+   * <ul>
+   * <li>fieldTypeConstant
+   * <li>fieldTypePattern
+   * <li>memberFromBinding
+   * </ul>
+   *
+   * @return The qualified type name for the field type.
+   */
+  val fieldType: String = "",
+
+  /**
+   * Define the field-type pattern by a class constant.
+   *
+   * <p>
+   * Mutually exclusive with all method properties.
+   *
+   * <p>
+   * If none, and other properties define this item as a field, the default matches any type.
+   *
+   * <p>
+   * Mutually exclusive with the following other properties defining field-type:
+   * <ul>
+   * <li>fieldType
+   * <li>fieldTypePattern
+   * <li>memberFromBinding
+   * </ul>
+   *
+   * @return The class constant for the field type.
+   */
+  val fieldTypeConstant: KClass<*> = Object::class,
+
+  /**
+   * Define the field-type pattern by a pattern on types.
+   *
+   * <p>
+   * Mutually exclusive with all method properties.
+   *
+   * <p>
+   * If none, and other properties define this item as a field, the default matches any type.
+   *
+   * <p>
+   * Mutually exclusive with the following other properties defining field-type:
+   * <ul>
+   * <li>fieldType
+   * <li>fieldTypeConstant
+   * <li>memberFromBinding
+   * </ul>
+   *
+   * @return The type pattern for the field type.
+   */
+  val fieldTypePattern: TypePattern = TypePattern(name = ""),
+)
diff --git a/src/keepanno/java/androidx/annotation/keep/MemberAccessFlags.java b/src/keepanno/java/androidx/annotation/keep/MemberAccessFlags.kt
similarity index 93%
rename from src/keepanno/java/androidx/annotation/keep/MemberAccessFlags.java
rename to src/keepanno/java/androidx/annotation/keep/MemberAccessFlags.kt
index dd6c1d6..4985630 100644
--- a/src/keepanno/java/androidx/annotation/keep/MemberAccessFlags.java
+++ b/src/keepanno/java/androidx/annotation/keep/MemberAccessFlags.kt
@@ -18,7 +18,7 @@
 // MAINTAINED AND TESTED IN THE R8 REPO. PLEASE MAKE CHANGES THERE AND REPLICATE.
 // ***********************************************************************************
 
-package androidx.annotation.keep;
+package androidx.annotation.keep
 
 /**
  * Valid matches on member access flags and their negations.
@@ -26,7 +26,7 @@
  * <p>The negated elements make it easier to express the inverse as we cannot use a "not/negation"
  * operation syntactically.
  */
-public enum MemberAccessFlags {
+enum class MemberAccessFlags {
   PUBLIC,
   NON_PUBLIC,
   PROTECTED,
@@ -40,5 +40,5 @@
   FINAL,
   NON_FINAL,
   SYNTHETIC,
-  NON_SYNTHETIC
+  NON_SYNTHETIC,
 }
diff --git a/src/keepanno/java/androidx/annotation/keep/MethodAccessFlags.java b/src/keepanno/java/androidx/annotation/keep/MethodAccessFlags.kt
similarity index 94%
rename from src/keepanno/java/androidx/annotation/keep/MethodAccessFlags.java
rename to src/keepanno/java/androidx/annotation/keep/MethodAccessFlags.kt
index 9b9fca0..a3fa2f7 100644
--- a/src/keepanno/java/androidx/annotation/keep/MethodAccessFlags.java
+++ b/src/keepanno/java/androidx/annotation/keep/MethodAccessFlags.kt
@@ -18,7 +18,7 @@
 // MAINTAINED AND TESTED IN THE R8 REPO. PLEASE MAKE CHANGES THERE AND REPLICATE.
 // ***********************************************************************************
 
-package androidx.annotation.keep;
+package androidx.annotation.keep
 
 /**
  * Valid matches on method access flags and their negations.
@@ -26,7 +26,7 @@
  * <p>The negated elements make it easier to express the inverse as we cannot use a "not/negation"
  * operation syntactically.
  */
-public enum MethodAccessFlags {
+enum class MethodAccessFlags {
   // General member flags.
   PUBLIC,
   NON_PUBLIC,
@@ -53,5 +53,5 @@
   ABSTRACT,
   NON_ABSTRACT,
   STRICT_FP,
-  NON_STRICT_FP
+  NON_STRICT_FP,
 }
diff --git a/src/keepanno/java/androidx/annotation/keep/StringPattern.java b/src/keepanno/java/androidx/annotation/keep/StringPattern.java
deleted file mode 100644
index 0a0d803..0000000
--- a/src/keepanno/java/androidx/annotation/keep/StringPattern.java
+++ /dev/null
@@ -1,72 +0,0 @@
-/*
- * Copyright 2025 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.
- */
-
-// ***********************************************************************************
-// GENERATED FILE. DO NOT EDIT! See KeepItemAnnotationGenerator.java.
-// ***********************************************************************************
-
-// ***********************************************************************************
-// MAINTAINED AND TESTED IN THE R8 REPO. PLEASE MAKE CHANGES THERE AND REPLICATE.
-// ***********************************************************************************
-
-package androidx.annotation.keep;
-
-import java.lang.annotation.ElementType;
-import java.lang.annotation.Retention;
-import java.lang.annotation.RetentionPolicy;
-import java.lang.annotation.Target;
-
-/**
- * A pattern structure for matching strings.
- *
- * <p>If no properties are set, the default pattern matches any string.
- */
-@Target(ElementType.ANNOTATION_TYPE)
-@Retention(RetentionPolicy.CLASS)
-public @interface StringPattern {
-
-  /**
-   * Exact string content.
-   *
-   * <p>For example, {@code "foo"} or {@code "java.lang.String"}.
-   *
-   * <p>Mutually exclusive with the following other properties defining string-exact-pattern:
-   *
-   * <ul>
-   *   <li>startsWith
-   *   <li>endsWith
-   * </ul>
-   */
-  String exact() default "";
-
-  /**
-   * Matches strings beginning with the given prefix.
-   *
-   * <p>For example, {@code "get"} to match strings such as {@code "getMyValue"}.
-   *
-   * <p>Mutually exclusive with the property `exact` also defining string-prefix-pattern.
-   */
-  String startsWith() default "";
-
-  /**
-   * Matches strings ending with the given suffix.
-   *
-   * <p>For example, {@code "Setter"} to match strings such as {@code "myValueSetter"}.
-   *
-   * <p>Mutually exclusive with the property `exact` also defining string-suffix-pattern.
-   */
-  String endsWith() default "";
-}
diff --git a/src/keepanno/java/androidx/annotation/keep/StringPattern.kt b/src/keepanno/java/androidx/annotation/keep/StringPattern.kt
new file mode 100644
index 0000000..bb872ec
--- /dev/null
+++ b/src/keepanno/java/androidx/annotation/keep/StringPattern.kt
@@ -0,0 +1,76 @@
+/*
+ * Copyright 2025 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.
+ */
+
+// ***********************************************************************************
+// GENERATED FILE. DO NOT EDIT! See KeepItemAnnotationGenerator.java.
+// ***********************************************************************************
+
+// ***********************************************************************************
+// MAINTAINED AND TESTED IN THE R8 REPO. PLEASE MAKE CHANGES THERE AND REPLICATE.
+// ***********************************************************************************
+
+package androidx.annotation.keep
+
+import kotlin.annotation.Retention
+import kotlin.annotation.Target
+
+/**
+ * A pattern structure for matching strings.
+ *
+ * <p>
+ * If no properties are set, the default pattern matches any string.
+ */
+@Retention(AnnotationRetention.BINARY)
+@Target(AnnotationTarget.ANNOTATION_CLASS)
+annotation class StringPattern(
+
+  /**
+   * Exact string content.
+   *
+   * <p>
+   * For example, {@code "foo"} or {@code "java.lang.String"}.
+   *
+   * <p>
+   * Mutually exclusive with the following other properties defining string-exact-pattern:
+   * <ul>
+   * <li>startsWith
+   * <li>endsWith
+   * </ul>
+   */
+  val exact: String = "",
+
+  /**
+   * Matches strings beginning with the given prefix.
+   *
+   * <p>
+   * For example, {@code "get"} to match strings such as {@code "getMyValue"}.
+   *
+   * <p>
+   * Mutually exclusive with the property `exact` also defining string-prefix-pattern.
+   */
+  val startsWith: String = "",
+
+  /**
+   * Matches strings ending with the given suffix.
+   *
+   * <p>
+   * For example, {@code "Setter"} to match strings such as {@code "myValueSetter"}.
+   *
+   * <p>
+   * Mutually exclusive with the property `exact` also defining string-suffix-pattern.
+   */
+  val endsWith: String = "",
+)
diff --git a/src/keepanno/java/androidx/annotation/keep/TypePattern.java b/src/keepanno/java/androidx/annotation/keep/TypePattern.java
deleted file mode 100644
index 71b41aa..0000000
--- a/src/keepanno/java/androidx/annotation/keep/TypePattern.java
+++ /dev/null
@@ -1,100 +0,0 @@
-/*
- * Copyright 2025 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.
- */
-
-// ***********************************************************************************
-// GENERATED FILE. DO NOT EDIT! See KeepItemAnnotationGenerator.java.
-// ***********************************************************************************
-
-// ***********************************************************************************
-// MAINTAINED AND TESTED IN THE R8 REPO. PLEASE MAKE CHANGES THERE AND REPLICATE.
-// ***********************************************************************************
-
-package androidx.annotation.keep;
-
-import java.lang.annotation.ElementType;
-import java.lang.annotation.Retention;
-import java.lang.annotation.RetentionPolicy;
-import java.lang.annotation.Target;
-
-/**
- * A pattern structure for matching types.
- *
- * <p>If no properties are set, the default pattern matches any type.
- *
- * <p>All properties on this annotation are mutually exclusive.
- */
-@Target(ElementType.ANNOTATION_TYPE)
-@Retention(RetentionPolicy.CLASS)
-public @interface TypePattern {
-
-  /**
-   * Exact type name as a string.
-   *
-   * <p>For example, {@code "long"} or {@code "java.lang.String"}.
-   *
-   * <p>Mutually exclusive with the following other properties defining type-pattern:
-   *
-   * <ul>
-   *   <li>constant
-   *   <li>classNamePattern
-   *   <li>instanceOfPattern
-   * </ul>
-   */
-  String name() default "";
-
-  /**
-   * Exact type from a class constant.
-   *
-   * <p>For example, {@code String.class}.
-   *
-   * <p>Mutually exclusive with the following other properties defining type-pattern:
-   *
-   * <ul>
-   *   <li>name
-   *   <li>classNamePattern
-   *   <li>instanceOfPattern
-   * </ul>
-   */
-  Class<?> constant() default Object.class;
-
-  /**
-   * Classes matching the class-name pattern.
-   *
-   * <p>Mutually exclusive with the following other properties defining type-pattern:
-   *
-   * <ul>
-   *   <li>name
-   *   <li>constant
-   *   <li>instanceOfPattern
-   * </ul>
-   */
-  ClassNamePattern classNamePattern() default @ClassNamePattern(unqualifiedName = "");
-
-  /**
-   * Define the instance-of with a pattern.
-   *
-   * <p>Mutually exclusive with the following other properties defining type-pattern:
-   *
-   * <ul>
-   *   <li>name
-   *   <li>constant
-   *   <li>classNamePattern
-   * </ul>
-   *
-   * @return The pattern that defines what instance-of the class must be.
-   */
-  InstanceOfPattern instanceOfPattern() default @InstanceOfPattern();
-}
diff --git a/src/keepanno/java/androidx/annotation/keep/TypePattern.kt b/src/keepanno/java/androidx/annotation/keep/TypePattern.kt
new file mode 100644
index 0000000..0e87702
--- /dev/null
+++ b/src/keepanno/java/androidx/annotation/keep/TypePattern.kt
@@ -0,0 +1,103 @@
+/*
+ * Copyright 2025 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.
+ */
+
+// ***********************************************************************************
+// GENERATED FILE. DO NOT EDIT! See KeepItemAnnotationGenerator.java.
+// ***********************************************************************************
+
+// ***********************************************************************************
+// MAINTAINED AND TESTED IN THE R8 REPO. PLEASE MAKE CHANGES THERE AND REPLICATE.
+// ***********************************************************************************
+
+package androidx.annotation.keep
+
+import kotlin.annotation.Retention
+import kotlin.annotation.Target
+import kotlin.reflect.KClass
+
+/**
+ * A pattern structure for matching types.
+ *
+ * <p>
+ * If no properties are set, the default pattern matches any type.
+ *
+ * <p>
+ * All properties on this annotation are mutually exclusive.
+ */
+@Retention(AnnotationRetention.BINARY)
+@Target(AnnotationTarget.ANNOTATION_CLASS)
+annotation class TypePattern(
+
+  /**
+   * Exact type name as a string.
+   *
+   * <p>
+   * For example, {@code "long"} or {@code "java.lang.String"}.
+   *
+   * <p>
+   * Mutually exclusive with the following other properties defining type-pattern:
+   * <ul>
+   * <li>constant
+   * <li>classNamePattern
+   * <li>instanceOfPattern
+   * </ul>
+   */
+  val name: String = "",
+
+  /**
+   * Exact type from a class constant.
+   *
+   * <p>
+   * For example, {@code String.class}.
+   *
+   * <p>
+   * Mutually exclusive with the following other properties defining type-pattern:
+   * <ul>
+   * <li>name
+   * <li>classNamePattern
+   * <li>instanceOfPattern
+   * </ul>
+   */
+  val constant: KClass<*> = Object::class,
+
+  /**
+   * Classes matching the class-name pattern.
+   *
+   * <p>
+   * Mutually exclusive with the following other properties defining type-pattern:
+   * <ul>
+   * <li>name
+   * <li>constant
+   * <li>instanceOfPattern
+   * </ul>
+   */
+  val classNamePattern: ClassNamePattern = ClassNamePattern(unqualifiedName = ""),
+
+  /**
+   * Define the instance-of with a pattern.
+   *
+   * <p>
+   * Mutually exclusive with the following other properties defining type-pattern:
+   * <ul>
+   * <li>name
+   * <li>constant
+   * <li>classNamePattern
+   * </ul>
+   *
+   * @return The pattern that defines what instance-of the class must be.
+   */
+  val instanceOfPattern: InstanceOfPattern = InstanceOfPattern(),
+)
diff --git a/src/keepanno/java/androidx/annotation/keep/UsedByNative.java b/src/keepanno/java/androidx/annotation/keep/UsedByNative.java
deleted file mode 100644
index 955bc95..0000000
--- a/src/keepanno/java/androidx/annotation/keep/UsedByNative.java
+++ /dev/null
@@ -1,571 +0,0 @@
-/*
- * Copyright 2025 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.
- */
-
-// ***********************************************************************************
-// GENERATED FILE. DO NOT EDIT! See KeepItemAnnotationGenerator.java.
-// ***********************************************************************************
-
-// ***********************************************************************************
-// MAINTAINED AND TESTED IN THE R8 REPO. PLEASE MAKE CHANGES THERE AND REPLICATE.
-// ***********************************************************************************
-
-package androidx.annotation.keep;
-
-import java.lang.annotation.ElementType;
-import java.lang.annotation.Retention;
-import java.lang.annotation.RetentionPolicy;
-import java.lang.annotation.Target;
-
-/**
- * Annotation to mark a class, field or method as being accessed from native code via JNI.
- *
- * <p>Note: Before using this annotation, consider if instead you can annotate the code that is
- * doing reflection with {@link UsesReflection}. Annotating the reflecting code is generally more
- * clear and maintainable, and it also naturally gives rise to edges that describe just the
- * reflected aspects of the program. The {@link UsedByReflection} annotation is suitable for cases
- * where the reflecting code is not under user control, or in migrating away from rules.
- *
- * <p>When a class is annotated, member patterns can be used to define which members are to be kept.
- * When no member patterns are specified the default pattern is to match just the class.
- *
- * <p>When a member is annotated, the member patterns cannot be used as the annotated member itself
- * fully defines the item to be kept (i.e., itself).
- */
-@Target({ElementType.TYPE, ElementType.FIELD, ElementType.METHOD, ElementType.CONSTRUCTOR})
-@Retention(RetentionPolicy.CLASS)
-public @interface UsedByNative {
-
-  /**
-   * Optional description to document the reason for this annotation.
-   *
-   * @return The descriptive message. Defaults to no description.
-   */
-  String description() default "";
-
-  /**
-   * Conditions that should be satisfied for the annotation to be in effect.
-   *
-   * @return The list of preconditions. Defaults to no conditions, thus trivially/unconditionally
-   *     satisfied.
-   */
-  KeepCondition[] preconditions() default {};
-
-  /**
-   * Additional targets to be kept in addition to the annotated class/members.
-   *
-   * @return List of additional target consequences. Defaults to no additional target consequences.
-   */
-  KeepTarget[] additionalTargets() default {};
-
-  /**
-   * Specify the kind of this item pattern.
-   *
-   * <p>If unspecified the default kind depends on the annotated item.
-   *
-   * <p>When annotating a class the default kind is:
-   *
-   * <ul>
-   *   <li>{@link KeepItemKind#ONLY_CLASS} if no member patterns are defined;
-   *   <li>{@link KeepItemKind#CLASS_AND_METHODS} if method patterns are defined;
-   *   <li>{@link KeepItemKind#CLASS_AND_FIELDS} if field patterns are defined;
-   *   <li>{@link KeepItemKind#CLASS_AND_MEMBERS} otherwise.
-   * </ul>
-   *
-   * <p>When annotating a method the default kind is: {@link KeepItemKind#ONLY_METHODS}
-   *
-   * <p>When annotating a field the default kind is: {@link KeepItemKind#ONLY_FIELDS}
-   *
-   * <p>It is not possible to use {@link KeepItemKind#ONLY_CLASS} if annotating a member.
-   *
-   * @return The kind for this pattern.
-   */
-  KeepItemKind kind() default KeepItemKind.DEFAULT;
-
-  /**
-   * Define the usage constraints of the target.
-   *
-   * <p>The specified constraints must remain valid for the target.
-   *
-   * <p>The default constraints depend on the kind of the target. For all targets the default
-   * constraints include:
-   *
-   * <ul>
-   *   <li>{@link KeepConstraint#LOOKUP}
-   *   <li>{@link KeepConstraint#NAME}
-   *   <li>{@link KeepConstraint#VISIBILITY_RELAX}
-   * </ul>
-   *
-   * <p>For classes the default constraints also include:
-   *
-   * <ul>
-   *   <li>{@link KeepConstraint#CLASS_INSTANTIATE}
-   * </ul>
-   *
-   * <p>For methods the default constraints also include:
-   *
-   * <ul>
-   *   <li>{@link KeepConstraint#METHOD_INVOKE}
-   * </ul>
-   *
-   * <p>For fields the default constraints also include:
-   *
-   * <ul>
-   *   <li>{@link KeepConstraint#FIELD_GET}
-   *   <li>{@link KeepConstraint#FIELD_SET}
-   * </ul>
-   *
-   * <p>Mutually exclusive with the property `constraintAdditions` also defining constraints.
-   *
-   * @return Usage constraints for the target.
-   */
-  KeepConstraint[] constraints() default {};
-
-  /**
-   * Add additional usage constraints of the target.
-   *
-   * <p>The specified constraints must remain valid for the target in addition to the default
-   * constraints.
-   *
-   * <p>The default constraints are documented in {@link #constraints}
-   *
-   * <p>Mutually exclusive with the property `constraints` also defining constraints.
-   *
-   * @return Additional usage constraints for the target.
-   */
-  KeepConstraint[] constraintAdditions() default {};
-
-  /**
-   * Patterns for annotations that must remain on the item.
-   *
-   * <p>The annotations matching any of the patterns must remain on the item if the annotation types
-   * remain in the program.
-   *
-   * <p>Note that if the annotation types themselves are unused/removed, then their references on
-   * the item will be removed too. If the annotation types themselves are used reflectively then
-   * they too need a keep annotation or rule to ensure they remain in the program.
-   *
-   * <p>By default no annotation patterns are defined and no annotations are required to remain.
-   *
-   * @return Annotation patterns
-   */
-  AnnotationPattern[] constrainAnnotations() default {};
-
-  /**
-   * Define the member-annotated-by pattern by fully qualified class name.
-   *
-   * <p>Mutually exclusive with the following other properties defining member-annotated-by:
-   *
-   * <ul>
-   *   <li>memberAnnotatedByClassConstant
-   *   <li>memberAnnotatedByClassNamePattern
-   * </ul>
-   *
-   * <p>Mutually exclusive with all field and method properties as use restricts the match to both
-   * types of members.
-   *
-   * <p>If none are specified the default is to match any member regardless of what the member is
-   * annotated by.
-   *
-   * @return The qualified class name that defines the annotation.
-   */
-  String memberAnnotatedByClassName() default "";
-
-  /**
-   * Define the member-annotated-by pattern by reference to a Class constant.
-   *
-   * <p>Mutually exclusive with the following other properties defining member-annotated-by:
-   *
-   * <ul>
-   *   <li>memberAnnotatedByClassName
-   *   <li>memberAnnotatedByClassNamePattern
-   * </ul>
-   *
-   * <p>Mutually exclusive with all field and method properties as use restricts the match to both
-   * types of members.
-   *
-   * <p>If none are specified the default is to match any member regardless of what the member is
-   * annotated by.
-   *
-   * @return The class-constant that defines the annotation.
-   */
-  Class<?> memberAnnotatedByClassConstant() default Object.class;
-
-  /**
-   * Define the member-annotated-by pattern by reference to a class-name pattern.
-   *
-   * <p>Mutually exclusive with the following other properties defining member-annotated-by:
-   *
-   * <ul>
-   *   <li>memberAnnotatedByClassName
-   *   <li>memberAnnotatedByClassConstant
-   * </ul>
-   *
-   * <p>Mutually exclusive with all field and method properties as use restricts the match to both
-   * types of members.
-   *
-   * <p>If none are specified the default is to match any member regardless of what the member is
-   * annotated by.
-   *
-   * @return The class-name pattern that defines the annotation.
-   */
-  ClassNamePattern memberAnnotatedByClassNamePattern() default
-      @ClassNamePattern(unqualifiedName = "");
-
-  /**
-   * Define the member-access pattern by matching on access flags.
-   *
-   * <p>Mutually exclusive with all field and method properties as use restricts the match to both
-   * types of members.
-   *
-   * @return The member access-flag constraints that must be met.
-   */
-  MemberAccessFlags[] memberAccess() default {};
-
-  /**
-   * Define the method-annotated-by pattern by fully qualified class name.
-   *
-   * <p>Mutually exclusive with the following other properties defining method-annotated-by:
-   *
-   * <ul>
-   *   <li>methodAnnotatedByClassConstant
-   *   <li>methodAnnotatedByClassNamePattern
-   * </ul>
-   *
-   * <p>Mutually exclusive with all field properties.
-   *
-   * <p>If none are specified the default is to match any method regardless of what the method is
-   * annotated by.
-   *
-   * @return The qualified class name that defines the annotation.
-   */
-  String methodAnnotatedByClassName() default "";
-
-  /**
-   * Define the method-annotated-by pattern by reference to a Class constant.
-   *
-   * <p>Mutually exclusive with the following other properties defining method-annotated-by:
-   *
-   * <ul>
-   *   <li>methodAnnotatedByClassName
-   *   <li>methodAnnotatedByClassNamePattern
-   * </ul>
-   *
-   * <p>Mutually exclusive with all field properties.
-   *
-   * <p>If none are specified the default is to match any method regardless of what the method is
-   * annotated by.
-   *
-   * @return The class-constant that defines the annotation.
-   */
-  Class<?> methodAnnotatedByClassConstant() default Object.class;
-
-  /**
-   * Define the method-annotated-by pattern by reference to a class-name pattern.
-   *
-   * <p>Mutually exclusive with the following other properties defining method-annotated-by:
-   *
-   * <ul>
-   *   <li>methodAnnotatedByClassName
-   *   <li>methodAnnotatedByClassConstant
-   * </ul>
-   *
-   * <p>Mutually exclusive with all field properties.
-   *
-   * <p>If none are specified the default is to match any method regardless of what the method is
-   * annotated by.
-   *
-   * @return The class-name pattern that defines the annotation.
-   */
-  ClassNamePattern methodAnnotatedByClassNamePattern() default
-      @ClassNamePattern(unqualifiedName = "");
-
-  /**
-   * Define the method-access pattern by matching on access flags.
-   *
-   * <p>Mutually exclusive with all field properties.
-   *
-   * <p>If none, and other properties define this item as a method, the default matches any
-   * method-access flags.
-   *
-   * @return The method access-flag constraints that must be met.
-   */
-  MethodAccessFlags[] methodAccess() default {};
-
-  /**
-   * Define the method-name pattern by an exact method name.
-   *
-   * <p>Mutually exclusive with all field properties.
-   *
-   * <p>If none, and other properties define this item as a method, the default matches any method
-   * name.
-   *
-   * <p>Mutually exclusive with the property `methodNamePattern` also defining method-name.
-   *
-   * @return The exact method name of the method.
-   */
-  String methodName() default "";
-
-  /**
-   * Define the method-name pattern by a string pattern.
-   *
-   * <p>Mutually exclusive with all field properties.
-   *
-   * <p>If none, and other properties define this item as a method, the default matches any method
-   * name.
-   *
-   * <p>Mutually exclusive with the property `methodName` also defining method-name.
-   *
-   * @return The string pattern of the method name.
-   */
-  StringPattern methodNamePattern() default @StringPattern(exact = "");
-
-  /**
-   * Define the method return-type pattern by a fully qualified type or 'void'.
-   *
-   * <p>Mutually exclusive with all field properties.
-   *
-   * <p>If none, and other properties define this item as a method, the default matches any return
-   * type.
-   *
-   * <p>Mutually exclusive with the following other properties defining return-type:
-   *
-   * <ul>
-   *   <li>methodReturnTypeConstant
-   *   <li>methodReturnTypePattern
-   * </ul>
-   *
-   * @return The qualified type name of the method return type.
-   */
-  String methodReturnType() default "";
-
-  /**
-   * Define the method return-type pattern by a class constant.
-   *
-   * <p>Mutually exclusive with all field properties.
-   *
-   * <p>If none, and other properties define this item as a method, the default matches any return
-   * type.
-   *
-   * <p>Mutually exclusive with the following other properties defining return-type:
-   *
-   * <ul>
-   *   <li>methodReturnType
-   *   <li>methodReturnTypePattern
-   * </ul>
-   *
-   * @return A class constant denoting the type of the method return type.
-   */
-  Class<?> methodReturnTypeConstant() default Object.class;
-
-  /**
-   * Define the method return-type pattern by a type pattern.
-   *
-   * <p>Mutually exclusive with all field properties.
-   *
-   * <p>If none, and other properties define this item as a method, the default matches any return
-   * type.
-   *
-   * <p>Mutually exclusive with the following other properties defining return-type:
-   *
-   * <ul>
-   *   <li>methodReturnType
-   *   <li>methodReturnTypeConstant
-   * </ul>
-   *
-   * @return The pattern of the method return type.
-   */
-  TypePattern methodReturnTypePattern() default @TypePattern(name = "");
-
-  /**
-   * Define the method parameters pattern by a list of fully qualified types.
-   *
-   * <p>Mutually exclusive with all field properties.
-   *
-   * <p>If none, and other properties define this item as a method, the default matches any
-   * parameters.
-   *
-   * <p>Mutually exclusive with the property `methodParameterTypePatterns` also defining parameters.
-   *
-   * @return The list of qualified type names of the method parameters.
-   */
-  String[] methodParameters() default {""};
-
-  /**
-   * Define the method parameters pattern by a list of patterns on types.
-   *
-   * <p>Mutually exclusive with all field properties.
-   *
-   * <p>If none, and other properties define this item as a method, the default matches any
-   * parameters.
-   *
-   * <p>Mutually exclusive with the property `methodParameters` also defining parameters.
-   *
-   * @return The list of type patterns for the method parameters.
-   */
-  TypePattern[] methodParameterTypePatterns() default {@TypePattern(name = "")};
-
-  /**
-   * Define the field-annotated-by pattern by fully qualified class name.
-   *
-   * <p>Mutually exclusive with the following other properties defining field-annotated-by:
-   *
-   * <ul>
-   *   <li>fieldAnnotatedByClassConstant
-   *   <li>fieldAnnotatedByClassNamePattern
-   * </ul>
-   *
-   * <p>Mutually exclusive with all method properties.
-   *
-   * <p>If none are specified the default is to match any field regardless of what the field is
-   * annotated by.
-   *
-   * @return The qualified class name that defines the annotation.
-   */
-  String fieldAnnotatedByClassName() default "";
-
-  /**
-   * Define the field-annotated-by pattern by reference to a Class constant.
-   *
-   * <p>Mutually exclusive with the following other properties defining field-annotated-by:
-   *
-   * <ul>
-   *   <li>fieldAnnotatedByClassName
-   *   <li>fieldAnnotatedByClassNamePattern
-   * </ul>
-   *
-   * <p>Mutually exclusive with all method properties.
-   *
-   * <p>If none are specified the default is to match any field regardless of what the field is
-   * annotated by.
-   *
-   * @return The class-constant that defines the annotation.
-   */
-  Class<?> fieldAnnotatedByClassConstant() default Object.class;
-
-  /**
-   * Define the field-annotated-by pattern by reference to a class-name pattern.
-   *
-   * <p>Mutually exclusive with the following other properties defining field-annotated-by:
-   *
-   * <ul>
-   *   <li>fieldAnnotatedByClassName
-   *   <li>fieldAnnotatedByClassConstant
-   * </ul>
-   *
-   * <p>Mutually exclusive with all method properties.
-   *
-   * <p>If none are specified the default is to match any field regardless of what the field is
-   * annotated by.
-   *
-   * @return The class-name pattern that defines the annotation.
-   */
-  ClassNamePattern fieldAnnotatedByClassNamePattern() default
-      @ClassNamePattern(unqualifiedName = "");
-
-  /**
-   * Define the field-access pattern by matching on access flags.
-   *
-   * <p>Mutually exclusive with all method properties.
-   *
-   * <p>If none, and other properties define this item as a field, the default matches any
-   * field-access flags.
-   *
-   * @return The field access-flag constraints that must be met.
-   */
-  FieldAccessFlags[] fieldAccess() default {};
-
-  /**
-   * Define the field-name pattern by an exact field name.
-   *
-   * <p>Mutually exclusive with all method properties.
-   *
-   * <p>If none, and other properties define this item as a field, the default matches any field
-   * name.
-   *
-   * <p>Mutually exclusive with the property `fieldNamePattern` also defining field-name.
-   *
-   * @return The exact field name of the field.
-   */
-  String fieldName() default "";
-
-  /**
-   * Define the field-name pattern by a string pattern.
-   *
-   * <p>Mutually exclusive with all method properties.
-   *
-   * <p>If none, and other properties define this item as a field, the default matches any field
-   * name.
-   *
-   * <p>Mutually exclusive with the property `fieldName` also defining field-name.
-   *
-   * @return The string pattern of the field name.
-   */
-  StringPattern fieldNamePattern() default @StringPattern(exact = "");
-
-  /**
-   * Define the field-type pattern by a fully qualified type.
-   *
-   * <p>Mutually exclusive with all method properties.
-   *
-   * <p>If none, and other properties define this item as a field, the default matches any type.
-   *
-   * <p>Mutually exclusive with the following other properties defining field-type:
-   *
-   * <ul>
-   *   <li>fieldTypeConstant
-   *   <li>fieldTypePattern
-   * </ul>
-   *
-   * @return The qualified type name for the field type.
-   */
-  String fieldType() default "";
-
-  /**
-   * Define the field-type pattern by a class constant.
-   *
-   * <p>Mutually exclusive with all method properties.
-   *
-   * <p>If none, and other properties define this item as a field, the default matches any type.
-   *
-   * <p>Mutually exclusive with the following other properties defining field-type:
-   *
-   * <ul>
-   *   <li>fieldType
-   *   <li>fieldTypePattern
-   * </ul>
-   *
-   * @return The class constant for the field type.
-   */
-  Class<?> fieldTypeConstant() default Object.class;
-
-  /**
-   * Define the field-type pattern by a pattern on types.
-   *
-   * <p>Mutually exclusive with all method properties.
-   *
-   * <p>If none, and other properties define this item as a field, the default matches any type.
-   *
-   * <p>Mutually exclusive with the following other properties defining field-type:
-   *
-   * <ul>
-   *   <li>fieldType
-   *   <li>fieldTypeConstant
-   * </ul>
-   *
-   * @return The type pattern for the field type.
-   */
-  TypePattern fieldTypePattern() default @TypePattern(name = "");
-}
diff --git a/src/keepanno/java/androidx/annotation/keep/UsedByNative.kt b/src/keepanno/java/androidx/annotation/keep/UsedByNative.kt
new file mode 100644
index 0000000..677a344
--- /dev/null
+++ b/src/keepanno/java/androidx/annotation/keep/UsedByNative.kt
@@ -0,0 +1,636 @@
+/*
+ * Copyright 2025 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.
+ */
+
+// ***********************************************************************************
+// GENERATED FILE. DO NOT EDIT! See KeepItemAnnotationGenerator.java.
+// ***********************************************************************************
+
+// ***********************************************************************************
+// MAINTAINED AND TESTED IN THE R8 REPO. PLEASE MAKE CHANGES THERE AND REPLICATE.
+// ***********************************************************************************
+
+package androidx.annotation.keep
+
+import kotlin.annotation.Retention
+import kotlin.annotation.Target
+import kotlin.reflect.KClass
+
+/**
+ * Annotation to mark a class, field or method as being accessed from native code via JNI.
+ *
+ * <p>
+ * Note: Before using this annotation, consider if instead you can annotate the code that is doing
+ * reflection with {@link UsesReflection}. Annotating the reflecting code is generally more clear
+ * and maintainable, and it also naturally gives rise to edges that describe just the reflected
+ * aspects of the program. The {@link UsedByReflection} annotation is suitable for cases where the
+ * reflecting code is not under user control, or in migrating away from rules.
+ *
+ * <p>
+ * When a class is annotated, member patterns can be used to define which members are to be kept.
+ * When no member patterns are specified the default pattern is to match just the class.
+ *
+ * <p>
+ * When a member is annotated, the member patterns cannot be used as the annotated member itself
+ * fully defines the item to be kept (i.e., itself).
+ */
+@Retention(AnnotationRetention.BINARY)
+@Target(
+  AnnotationTarget.CLASS,
+  AnnotationTarget.FIELD,
+  AnnotationTarget.FUNCTION,
+  AnnotationTarget.CONSTRUCTOR,
+)
+annotation class UsedByNative(
+
+  /**
+   * Optional description to document the reason for this annotation.
+   *
+   * @return The descriptive message. Defaults to no description.
+   */
+  val description: String = "",
+
+  /**
+   * Conditions that should be satisfied for the annotation to be in effect.
+   *
+   * @return The list of preconditions. Defaults to no conditions, thus trivially/unconditionally
+   *   satisfied.
+   */
+  val preconditions: Array<KeepCondition> = [],
+
+  /**
+   * Additional targets to be kept in addition to the annotated class/members.
+   *
+   * @return List of additional target consequences. Defaults to no additional target consequences.
+   */
+  val additionalTargets: Array<KeepTarget> = [],
+
+  /**
+   * Specify the kind of this item pattern.
+   *
+   * <p>
+   * If unspecified the default kind depends on the annotated item.
+   *
+   * <p>
+   * When annotating a class the default kind is:
+   * <ul>
+   * <li>{@link KeepItemKind#ONLY_CLASS} if no member patterns are defined;
+   * <li>{@link KeepItemKind#CLASS_AND_METHODS} if method patterns are defined;
+   * <li>{@link KeepItemKind#CLASS_AND_FIELDS} if field patterns are defined;
+   * <li>{@link KeepItemKind#CLASS_AND_MEMBERS} otherwise.
+   * </ul>
+   *
+   * <p>
+   * When annotating a method the default kind is: {@link KeepItemKind#ONLY_METHODS}
+   *
+   * <p>
+   * When annotating a field the default kind is: {@link KeepItemKind#ONLY_FIELDS}
+   *
+   * <p>
+   * It is not possible to use {@link KeepItemKind#ONLY_CLASS} if annotating a member.
+   *
+   * @return The kind for this pattern.
+   */
+  val kind: KeepItemKind = KeepItemKind.DEFAULT,
+
+  /**
+   * Define the usage constraints of the target.
+   *
+   * <p>
+   * The specified constraints must remain valid for the target.
+   *
+   * <p>
+   * The default constraints depend on the kind of the target. For all targets the default
+   * constraints include:
+   * <ul>
+   * <li>{@link KeepConstraint#LOOKUP}
+   * <li>{@link KeepConstraint#NAME}
+   * <li>{@link KeepConstraint#VISIBILITY_RELAX}
+   * </ul>
+   *
+   * <p>
+   * For classes the default constraints also include:
+   * <ul>
+   * <li>{@link KeepConstraint#CLASS_INSTANTIATE}
+   * </ul>
+   *
+   * <p>
+   * For methods the default constraints also include:
+   * <ul>
+   * <li>{@link KeepConstraint#METHOD_INVOKE}
+   * </ul>
+   *
+   * <p>
+   * For fields the default constraints also include:
+   * <ul>
+   * <li>{@link KeepConstraint#FIELD_GET}
+   * <li>{@link KeepConstraint#FIELD_SET}
+   * </ul>
+   *
+   * <p>
+   * Mutually exclusive with the property `constraintAdditions` also defining constraints.
+   *
+   * @return Usage constraints for the target.
+   */
+  val constraints: Array<KeepConstraint> = [],
+
+  /**
+   * Add additional usage constraints of the target.
+   *
+   * <p>
+   * The specified constraints must remain valid for the target in addition to the default
+   * constraints.
+   *
+   * <p>
+   * The default constraints are documented in {@link #constraints}
+   *
+   * <p>
+   * Mutually exclusive with the property `constraints` also defining constraints.
+   *
+   * @return Additional usage constraints for the target.
+   */
+  val constraintAdditions: Array<KeepConstraint> = [],
+
+  /**
+   * Patterns for annotations that must remain on the item.
+   *
+   * <p>
+   * The annotations matching any of the patterns must remain on the item if the annotation types
+   * remain in the program.
+   *
+   * <p>
+   * Note that if the annotation types themselves are unused/removed, then their references on the
+   * item will be removed too. If the annotation types themselves are used reflectively then they
+   * too need a keep annotation or rule to ensure they remain in the program.
+   *
+   * <p>
+   * By default no annotation patterns are defined and no annotations are required to remain.
+   *
+   * @return Annotation patterns
+   */
+  val constrainAnnotations: Array<AnnotationPattern> = [],
+
+  /**
+   * Define the member-annotated-by pattern by fully qualified class name.
+   *
+   * <p>
+   * Mutually exclusive with the following other properties defining member-annotated-by:
+   * <ul>
+   * <li>memberAnnotatedByClassConstant
+   * <li>memberAnnotatedByClassNamePattern
+   * </ul>
+   *
+   * <p>
+   * Mutually exclusive with all field and method properties as use restricts the match to both
+   * types of members.
+   *
+   * <p>
+   * If none are specified the default is to match any member regardless of what the member is
+   * annotated by.
+   *
+   * @return The qualified class name that defines the annotation.
+   */
+  val memberAnnotatedByClassName: String = "",
+
+  /**
+   * Define the member-annotated-by pattern by reference to a Class constant.
+   *
+   * <p>
+   * Mutually exclusive with the following other properties defining member-annotated-by:
+   * <ul>
+   * <li>memberAnnotatedByClassName
+   * <li>memberAnnotatedByClassNamePattern
+   * </ul>
+   *
+   * <p>
+   * Mutually exclusive with all field and method properties as use restricts the match to both
+   * types of members.
+   *
+   * <p>
+   * If none are specified the default is to match any member regardless of what the member is
+   * annotated by.
+   *
+   * @return The class-constant that defines the annotation.
+   */
+  val memberAnnotatedByClassConstant: KClass<*> = Object::class,
+
+  /**
+   * Define the member-annotated-by pattern by reference to a class-name pattern.
+   *
+   * <p>
+   * Mutually exclusive with the following other properties defining member-annotated-by:
+   * <ul>
+   * <li>memberAnnotatedByClassName
+   * <li>memberAnnotatedByClassConstant
+   * </ul>
+   *
+   * <p>
+   * Mutually exclusive with all field and method properties as use restricts the match to both
+   * types of members.
+   *
+   * <p>
+   * If none are specified the default is to match any member regardless of what the member is
+   * annotated by.
+   *
+   * @return The class-name pattern that defines the annotation.
+   */
+  val memberAnnotatedByClassNamePattern: ClassNamePattern = ClassNamePattern(unqualifiedName = ""),
+
+  /**
+   * Define the member-access pattern by matching on access flags.
+   *
+   * <p>
+   * Mutually exclusive with all field and method properties as use restricts the match to both
+   * types of members.
+   *
+   * @return The member access-flag constraints that must be met.
+   */
+  val memberAccess: Array<MemberAccessFlags> = [],
+
+  /**
+   * Define the method-annotated-by pattern by fully qualified class name.
+   *
+   * <p>
+   * Mutually exclusive with the following other properties defining method-annotated-by:
+   * <ul>
+   * <li>methodAnnotatedByClassConstant
+   * <li>methodAnnotatedByClassNamePattern
+   * </ul>
+   *
+   * <p>
+   * Mutually exclusive with all field properties.
+   *
+   * <p>
+   * If none are specified the default is to match any method regardless of what the method is
+   * annotated by.
+   *
+   * @return The qualified class name that defines the annotation.
+   */
+  val methodAnnotatedByClassName: String = "",
+
+  /**
+   * Define the method-annotated-by pattern by reference to a Class constant.
+   *
+   * <p>
+   * Mutually exclusive with the following other properties defining method-annotated-by:
+   * <ul>
+   * <li>methodAnnotatedByClassName
+   * <li>methodAnnotatedByClassNamePattern
+   * </ul>
+   *
+   * <p>
+   * Mutually exclusive with all field properties.
+   *
+   * <p>
+   * If none are specified the default is to match any method regardless of what the method is
+   * annotated by.
+   *
+   * @return The class-constant that defines the annotation.
+   */
+  val methodAnnotatedByClassConstant: KClass<*> = Object::class,
+
+  /**
+   * Define the method-annotated-by pattern by reference to a class-name pattern.
+   *
+   * <p>
+   * Mutually exclusive with the following other properties defining method-annotated-by:
+   * <ul>
+   * <li>methodAnnotatedByClassName
+   * <li>methodAnnotatedByClassConstant
+   * </ul>
+   *
+   * <p>
+   * Mutually exclusive with all field properties.
+   *
+   * <p>
+   * If none are specified the default is to match any method regardless of what the method is
+   * annotated by.
+   *
+   * @return The class-name pattern that defines the annotation.
+   */
+  val methodAnnotatedByClassNamePattern: ClassNamePattern = ClassNamePattern(unqualifiedName = ""),
+
+  /**
+   * Define the method-access pattern by matching on access flags.
+   *
+   * <p>
+   * Mutually exclusive with all field properties.
+   *
+   * <p>
+   * If none, and other properties define this item as a method, the default matches any
+   * method-access flags.
+   *
+   * @return The method access-flag constraints that must be met.
+   */
+  val methodAccess: Array<MethodAccessFlags> = [],
+
+  /**
+   * Define the method-name pattern by an exact method name.
+   *
+   * <p>
+   * Mutually exclusive with all field properties.
+   *
+   * <p>
+   * If none, and other properties define this item as a method, the default matches any method
+   * name.
+   *
+   * <p>
+   * Mutually exclusive with the property `methodNamePattern` also defining method-name.
+   *
+   * @return The exact method name of the method.
+   */
+  val methodName: String = "",
+
+  /**
+   * Define the method-name pattern by a string pattern.
+   *
+   * <p>
+   * Mutually exclusive with all field properties.
+   *
+   * <p>
+   * If none, and other properties define this item as a method, the default matches any method
+   * name.
+   *
+   * <p>
+   * Mutually exclusive with the property `methodName` also defining method-name.
+   *
+   * @return The string pattern of the method name.
+   */
+  val methodNamePattern: StringPattern = StringPattern(exact = ""),
+
+  /**
+   * Define the method return-type pattern by a fully qualified type or 'void'.
+   *
+   * <p>
+   * Mutually exclusive with all field properties.
+   *
+   * <p>
+   * If none, and other properties define this item as a method, the default matches any return
+   * type.
+   *
+   * <p>
+   * Mutually exclusive with the following other properties defining return-type:
+   * <ul>
+   * <li>methodReturnTypeConstant
+   * <li>methodReturnTypePattern
+   * </ul>
+   *
+   * @return The qualified type name of the method return type.
+   */
+  val methodReturnType: String = "",
+
+  /**
+   * Define the method return-type pattern by a class constant.
+   *
+   * <p>
+   * Mutually exclusive with all field properties.
+   *
+   * <p>
+   * If none, and other properties define this item as a method, the default matches any return
+   * type.
+   *
+   * <p>
+   * Mutually exclusive with the following other properties defining return-type:
+   * <ul>
+   * <li>methodReturnType
+   * <li>methodReturnTypePattern
+   * </ul>
+   *
+   * @return A class constant denoting the type of the method return type.
+   */
+  val methodReturnTypeConstant: KClass<*> = Object::class,
+
+  /**
+   * Define the method return-type pattern by a type pattern.
+   *
+   * <p>
+   * Mutually exclusive with all field properties.
+   *
+   * <p>
+   * If none, and other properties define this item as a method, the default matches any return
+   * type.
+   *
+   * <p>
+   * Mutually exclusive with the following other properties defining return-type:
+   * <ul>
+   * <li>methodReturnType
+   * <li>methodReturnTypeConstant
+   * </ul>
+   *
+   * @return The pattern of the method return type.
+   */
+  val methodReturnTypePattern: TypePattern = TypePattern(name = ""),
+
+  /**
+   * Define the method parameters pattern by a list of fully qualified types.
+   *
+   * <p>
+   * Mutually exclusive with all field properties.
+   *
+   * <p>
+   * If none, and other properties define this item as a method, the default matches any parameters.
+   *
+   * <p>
+   * Mutually exclusive with the property `methodParameterTypePatterns` also defining parameters.
+   *
+   * @return The list of qualified type names of the method parameters.
+   */
+  val methodParameters: Array<String> = [""],
+
+  /**
+   * Define the method parameters pattern by a list of patterns on types.
+   *
+   * <p>
+   * Mutually exclusive with all field properties.
+   *
+   * <p>
+   * If none, and other properties define this item as a method, the default matches any parameters.
+   *
+   * <p>
+   * Mutually exclusive with the property `methodParameters` also defining parameters.
+   *
+   * @return The list of type patterns for the method parameters.
+   */
+  val methodParameterTypePatterns: Array<TypePattern> = [TypePattern(name = "")],
+
+  /**
+   * Define the field-annotated-by pattern by fully qualified class name.
+   *
+   * <p>
+   * Mutually exclusive with the following other properties defining field-annotated-by:
+   * <ul>
+   * <li>fieldAnnotatedByClassConstant
+   * <li>fieldAnnotatedByClassNamePattern
+   * </ul>
+   *
+   * <p>
+   * Mutually exclusive with all method properties.
+   *
+   * <p>
+   * If none are specified the default is to match any field regardless of what the field is
+   * annotated by.
+   *
+   * @return The qualified class name that defines the annotation.
+   */
+  val fieldAnnotatedByClassName: String = "",
+
+  /**
+   * Define the field-annotated-by pattern by reference to a Class constant.
+   *
+   * <p>
+   * Mutually exclusive with the following other properties defining field-annotated-by:
+   * <ul>
+   * <li>fieldAnnotatedByClassName
+   * <li>fieldAnnotatedByClassNamePattern
+   * </ul>
+   *
+   * <p>
+   * Mutually exclusive with all method properties.
+   *
+   * <p>
+   * If none are specified the default is to match any field regardless of what the field is
+   * annotated by.
+   *
+   * @return The class-constant that defines the annotation.
+   */
+  val fieldAnnotatedByClassConstant: KClass<*> = Object::class,
+
+  /**
+   * Define the field-annotated-by pattern by reference to a class-name pattern.
+   *
+   * <p>
+   * Mutually exclusive with the following other properties defining field-annotated-by:
+   * <ul>
+   * <li>fieldAnnotatedByClassName
+   * <li>fieldAnnotatedByClassConstant
+   * </ul>
+   *
+   * <p>
+   * Mutually exclusive with all method properties.
+   *
+   * <p>
+   * If none are specified the default is to match any field regardless of what the field is
+   * annotated by.
+   *
+   * @return The class-name pattern that defines the annotation.
+   */
+  val fieldAnnotatedByClassNamePattern: ClassNamePattern = ClassNamePattern(unqualifiedName = ""),
+
+  /**
+   * Define the field-access pattern by matching on access flags.
+   *
+   * <p>
+   * Mutually exclusive with all method properties.
+   *
+   * <p>
+   * If none, and other properties define this item as a field, the default matches any field-access
+   * flags.
+   *
+   * @return The field access-flag constraints that must be met.
+   */
+  val fieldAccess: Array<FieldAccessFlags> = [],
+
+  /**
+   * Define the field-name pattern by an exact field name.
+   *
+   * <p>
+   * Mutually exclusive with all method properties.
+   *
+   * <p>
+   * If none, and other properties define this item as a field, the default matches any field name.
+   *
+   * <p>
+   * Mutually exclusive with the property `fieldNamePattern` also defining field-name.
+   *
+   * @return The exact field name of the field.
+   */
+  val fieldName: String = "",
+
+  /**
+   * Define the field-name pattern by a string pattern.
+   *
+   * <p>
+   * Mutually exclusive with all method properties.
+   *
+   * <p>
+   * If none, and other properties define this item as a field, the default matches any field name.
+   *
+   * <p>
+   * Mutually exclusive with the property `fieldName` also defining field-name.
+   *
+   * @return The string pattern of the field name.
+   */
+  val fieldNamePattern: StringPattern = StringPattern(exact = ""),
+
+  /**
+   * Define the field-type pattern by a fully qualified type.
+   *
+   * <p>
+   * Mutually exclusive with all method properties.
+   *
+   * <p>
+   * If none, and other properties define this item as a field, the default matches any type.
+   *
+   * <p>
+   * Mutually exclusive with the following other properties defining field-type:
+   * <ul>
+   * <li>fieldTypeConstant
+   * <li>fieldTypePattern
+   * </ul>
+   *
+   * @return The qualified type name for the field type.
+   */
+  val fieldType: String = "",
+
+  /**
+   * Define the field-type pattern by a class constant.
+   *
+   * <p>
+   * Mutually exclusive with all method properties.
+   *
+   * <p>
+   * If none, and other properties define this item as a field, the default matches any type.
+   *
+   * <p>
+   * Mutually exclusive with the following other properties defining field-type:
+   * <ul>
+   * <li>fieldType
+   * <li>fieldTypePattern
+   * </ul>
+   *
+   * @return The class constant for the field type.
+   */
+  val fieldTypeConstant: KClass<*> = Object::class,
+
+  /**
+   * Define the field-type pattern by a pattern on types.
+   *
+   * <p>
+   * Mutually exclusive with all method properties.
+   *
+   * <p>
+   * If none, and other properties define this item as a field, the default matches any type.
+   *
+   * <p>
+   * Mutually exclusive with the following other properties defining field-type:
+   * <ul>
+   * <li>fieldType
+   * <li>fieldTypeConstant
+   * </ul>
+   *
+   * @return The type pattern for the field type.
+   */
+  val fieldTypePattern: TypePattern = TypePattern(name = ""),
+)
diff --git a/src/keepanno/java/androidx/annotation/keep/UsedByReflection.java b/src/keepanno/java/androidx/annotation/keep/UsedByReflection.java
deleted file mode 100644
index 7cf8b09..0000000
--- a/src/keepanno/java/androidx/annotation/keep/UsedByReflection.java
+++ /dev/null
@@ -1,571 +0,0 @@
-/*
- * Copyright 2025 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.
- */
-
-// ***********************************************************************************
-// GENERATED FILE. DO NOT EDIT! See KeepItemAnnotationGenerator.java.
-// ***********************************************************************************
-
-// ***********************************************************************************
-// MAINTAINED AND TESTED IN THE R8 REPO. PLEASE MAKE CHANGES THERE AND REPLICATE.
-// ***********************************************************************************
-
-package androidx.annotation.keep;
-
-import java.lang.annotation.ElementType;
-import java.lang.annotation.Retention;
-import java.lang.annotation.RetentionPolicy;
-import java.lang.annotation.Target;
-
-/**
- * Annotation to mark a class, field or method as being accessed reflectively.
- *
- * <p>Note: Before using this annotation, consider if instead you can annotate the code that is
- * doing reflection with {@link UsesReflection}. Annotating the reflecting code is generally more
- * clear and maintainable, and it also naturally gives rise to edges that describe just the
- * reflected aspects of the program. The {@link UsedByReflection} annotation is suitable for cases
- * where the reflecting code is not under user control, or in migrating away from rules.
- *
- * <p>When a class is annotated, member patterns can be used to define which members are to be kept.
- * When no member patterns are specified the default pattern is to match just the class.
- *
- * <p>When a member is annotated, the member patterns cannot be used as the annotated member itself
- * fully defines the item to be kept (i.e., itself).
- */
-@Target({ElementType.TYPE, ElementType.FIELD, ElementType.METHOD, ElementType.CONSTRUCTOR})
-@Retention(RetentionPolicy.CLASS)
-public @interface UsedByReflection {
-
-  /**
-   * Optional description to document the reason for this annotation.
-   *
-   * @return The descriptive message. Defaults to no description.
-   */
-  String description() default "";
-
-  /**
-   * Conditions that should be satisfied for the annotation to be in effect.
-   *
-   * @return The list of preconditions. Defaults to no conditions, thus trivially/unconditionally
-   *     satisfied.
-   */
-  KeepCondition[] preconditions() default {};
-
-  /**
-   * Additional targets to be kept in addition to the annotated class/members.
-   *
-   * @return List of additional target consequences. Defaults to no additional target consequences.
-   */
-  KeepTarget[] additionalTargets() default {};
-
-  /**
-   * Specify the kind of this item pattern.
-   *
-   * <p>If unspecified the default kind depends on the annotated item.
-   *
-   * <p>When annotating a class the default kind is:
-   *
-   * <ul>
-   *   <li>{@link KeepItemKind#ONLY_CLASS} if no member patterns are defined;
-   *   <li>{@link KeepItemKind#CLASS_AND_METHODS} if method patterns are defined;
-   *   <li>{@link KeepItemKind#CLASS_AND_FIELDS} if field patterns are defined;
-   *   <li>{@link KeepItemKind#CLASS_AND_MEMBERS} otherwise.
-   * </ul>
-   *
-   * <p>When annotating a method the default kind is: {@link KeepItemKind#ONLY_METHODS}
-   *
-   * <p>When annotating a field the default kind is: {@link KeepItemKind#ONLY_FIELDS}
-   *
-   * <p>It is not possible to use {@link KeepItemKind#ONLY_CLASS} if annotating a member.
-   *
-   * @return The kind for this pattern.
-   */
-  KeepItemKind kind() default KeepItemKind.DEFAULT;
-
-  /**
-   * Define the usage constraints of the target.
-   *
-   * <p>The specified constraints must remain valid for the target.
-   *
-   * <p>The default constraints depend on the kind of the target. For all targets the default
-   * constraints include:
-   *
-   * <ul>
-   *   <li>{@link KeepConstraint#LOOKUP}
-   *   <li>{@link KeepConstraint#NAME}
-   *   <li>{@link KeepConstraint#VISIBILITY_RELAX}
-   * </ul>
-   *
-   * <p>For classes the default constraints also include:
-   *
-   * <ul>
-   *   <li>{@link KeepConstraint#CLASS_INSTANTIATE}
-   * </ul>
-   *
-   * <p>For methods the default constraints also include:
-   *
-   * <ul>
-   *   <li>{@link KeepConstraint#METHOD_INVOKE}
-   * </ul>
-   *
-   * <p>For fields the default constraints also include:
-   *
-   * <ul>
-   *   <li>{@link KeepConstraint#FIELD_GET}
-   *   <li>{@link KeepConstraint#FIELD_SET}
-   * </ul>
-   *
-   * <p>Mutually exclusive with the property `constraintAdditions` also defining constraints.
-   *
-   * @return Usage constraints for the target.
-   */
-  KeepConstraint[] constraints() default {};
-
-  /**
-   * Add additional usage constraints of the target.
-   *
-   * <p>The specified constraints must remain valid for the target in addition to the default
-   * constraints.
-   *
-   * <p>The default constraints are documented in {@link #constraints}
-   *
-   * <p>Mutually exclusive with the property `constraints` also defining constraints.
-   *
-   * @return Additional usage constraints for the target.
-   */
-  KeepConstraint[] constraintAdditions() default {};
-
-  /**
-   * Patterns for annotations that must remain on the item.
-   *
-   * <p>The annotations matching any of the patterns must remain on the item if the annotation types
-   * remain in the program.
-   *
-   * <p>Note that if the annotation types themselves are unused/removed, then their references on
-   * the item will be removed too. If the annotation types themselves are used reflectively then
-   * they too need a keep annotation or rule to ensure they remain in the program.
-   *
-   * <p>By default no annotation patterns are defined and no annotations are required to remain.
-   *
-   * @return Annotation patterns
-   */
-  AnnotationPattern[] constrainAnnotations() default {};
-
-  /**
-   * Define the member-annotated-by pattern by fully qualified class name.
-   *
-   * <p>Mutually exclusive with the following other properties defining member-annotated-by:
-   *
-   * <ul>
-   *   <li>memberAnnotatedByClassConstant
-   *   <li>memberAnnotatedByClassNamePattern
-   * </ul>
-   *
-   * <p>Mutually exclusive with all field and method properties as use restricts the match to both
-   * types of members.
-   *
-   * <p>If none are specified the default is to match any member regardless of what the member is
-   * annotated by.
-   *
-   * @return The qualified class name that defines the annotation.
-   */
-  String memberAnnotatedByClassName() default "";
-
-  /**
-   * Define the member-annotated-by pattern by reference to a Class constant.
-   *
-   * <p>Mutually exclusive with the following other properties defining member-annotated-by:
-   *
-   * <ul>
-   *   <li>memberAnnotatedByClassName
-   *   <li>memberAnnotatedByClassNamePattern
-   * </ul>
-   *
-   * <p>Mutually exclusive with all field and method properties as use restricts the match to both
-   * types of members.
-   *
-   * <p>If none are specified the default is to match any member regardless of what the member is
-   * annotated by.
-   *
-   * @return The class-constant that defines the annotation.
-   */
-  Class<?> memberAnnotatedByClassConstant() default Object.class;
-
-  /**
-   * Define the member-annotated-by pattern by reference to a class-name pattern.
-   *
-   * <p>Mutually exclusive with the following other properties defining member-annotated-by:
-   *
-   * <ul>
-   *   <li>memberAnnotatedByClassName
-   *   <li>memberAnnotatedByClassConstant
-   * </ul>
-   *
-   * <p>Mutually exclusive with all field and method properties as use restricts the match to both
-   * types of members.
-   *
-   * <p>If none are specified the default is to match any member regardless of what the member is
-   * annotated by.
-   *
-   * @return The class-name pattern that defines the annotation.
-   */
-  ClassNamePattern memberAnnotatedByClassNamePattern() default
-      @ClassNamePattern(unqualifiedName = "");
-
-  /**
-   * Define the member-access pattern by matching on access flags.
-   *
-   * <p>Mutually exclusive with all field and method properties as use restricts the match to both
-   * types of members.
-   *
-   * @return The member access-flag constraints that must be met.
-   */
-  MemberAccessFlags[] memberAccess() default {};
-
-  /**
-   * Define the method-annotated-by pattern by fully qualified class name.
-   *
-   * <p>Mutually exclusive with the following other properties defining method-annotated-by:
-   *
-   * <ul>
-   *   <li>methodAnnotatedByClassConstant
-   *   <li>methodAnnotatedByClassNamePattern
-   * </ul>
-   *
-   * <p>Mutually exclusive with all field properties.
-   *
-   * <p>If none are specified the default is to match any method regardless of what the method is
-   * annotated by.
-   *
-   * @return The qualified class name that defines the annotation.
-   */
-  String methodAnnotatedByClassName() default "";
-
-  /**
-   * Define the method-annotated-by pattern by reference to a Class constant.
-   *
-   * <p>Mutually exclusive with the following other properties defining method-annotated-by:
-   *
-   * <ul>
-   *   <li>methodAnnotatedByClassName
-   *   <li>methodAnnotatedByClassNamePattern
-   * </ul>
-   *
-   * <p>Mutually exclusive with all field properties.
-   *
-   * <p>If none are specified the default is to match any method regardless of what the method is
-   * annotated by.
-   *
-   * @return The class-constant that defines the annotation.
-   */
-  Class<?> methodAnnotatedByClassConstant() default Object.class;
-
-  /**
-   * Define the method-annotated-by pattern by reference to a class-name pattern.
-   *
-   * <p>Mutually exclusive with the following other properties defining method-annotated-by:
-   *
-   * <ul>
-   *   <li>methodAnnotatedByClassName
-   *   <li>methodAnnotatedByClassConstant
-   * </ul>
-   *
-   * <p>Mutually exclusive with all field properties.
-   *
-   * <p>If none are specified the default is to match any method regardless of what the method is
-   * annotated by.
-   *
-   * @return The class-name pattern that defines the annotation.
-   */
-  ClassNamePattern methodAnnotatedByClassNamePattern() default
-      @ClassNamePattern(unqualifiedName = "");
-
-  /**
-   * Define the method-access pattern by matching on access flags.
-   *
-   * <p>Mutually exclusive with all field properties.
-   *
-   * <p>If none, and other properties define this item as a method, the default matches any
-   * method-access flags.
-   *
-   * @return The method access-flag constraints that must be met.
-   */
-  MethodAccessFlags[] methodAccess() default {};
-
-  /**
-   * Define the method-name pattern by an exact method name.
-   *
-   * <p>Mutually exclusive with all field properties.
-   *
-   * <p>If none, and other properties define this item as a method, the default matches any method
-   * name.
-   *
-   * <p>Mutually exclusive with the property `methodNamePattern` also defining method-name.
-   *
-   * @return The exact method name of the method.
-   */
-  String methodName() default "";
-
-  /**
-   * Define the method-name pattern by a string pattern.
-   *
-   * <p>Mutually exclusive with all field properties.
-   *
-   * <p>If none, and other properties define this item as a method, the default matches any method
-   * name.
-   *
-   * <p>Mutually exclusive with the property `methodName` also defining method-name.
-   *
-   * @return The string pattern of the method name.
-   */
-  StringPattern methodNamePattern() default @StringPattern(exact = "");
-
-  /**
-   * Define the method return-type pattern by a fully qualified type or 'void'.
-   *
-   * <p>Mutually exclusive with all field properties.
-   *
-   * <p>If none, and other properties define this item as a method, the default matches any return
-   * type.
-   *
-   * <p>Mutually exclusive with the following other properties defining return-type:
-   *
-   * <ul>
-   *   <li>methodReturnTypeConstant
-   *   <li>methodReturnTypePattern
-   * </ul>
-   *
-   * @return The qualified type name of the method return type.
-   */
-  String methodReturnType() default "";
-
-  /**
-   * Define the method return-type pattern by a class constant.
-   *
-   * <p>Mutually exclusive with all field properties.
-   *
-   * <p>If none, and other properties define this item as a method, the default matches any return
-   * type.
-   *
-   * <p>Mutually exclusive with the following other properties defining return-type:
-   *
-   * <ul>
-   *   <li>methodReturnType
-   *   <li>methodReturnTypePattern
-   * </ul>
-   *
-   * @return A class constant denoting the type of the method return type.
-   */
-  Class<?> methodReturnTypeConstant() default Object.class;
-
-  /**
-   * Define the method return-type pattern by a type pattern.
-   *
-   * <p>Mutually exclusive with all field properties.
-   *
-   * <p>If none, and other properties define this item as a method, the default matches any return
-   * type.
-   *
-   * <p>Mutually exclusive with the following other properties defining return-type:
-   *
-   * <ul>
-   *   <li>methodReturnType
-   *   <li>methodReturnTypeConstant
-   * </ul>
-   *
-   * @return The pattern of the method return type.
-   */
-  TypePattern methodReturnTypePattern() default @TypePattern(name = "");
-
-  /**
-   * Define the method parameters pattern by a list of fully qualified types.
-   *
-   * <p>Mutually exclusive with all field properties.
-   *
-   * <p>If none, and other properties define this item as a method, the default matches any
-   * parameters.
-   *
-   * <p>Mutually exclusive with the property `methodParameterTypePatterns` also defining parameters.
-   *
-   * @return The list of qualified type names of the method parameters.
-   */
-  String[] methodParameters() default {""};
-
-  /**
-   * Define the method parameters pattern by a list of patterns on types.
-   *
-   * <p>Mutually exclusive with all field properties.
-   *
-   * <p>If none, and other properties define this item as a method, the default matches any
-   * parameters.
-   *
-   * <p>Mutually exclusive with the property `methodParameters` also defining parameters.
-   *
-   * @return The list of type patterns for the method parameters.
-   */
-  TypePattern[] methodParameterTypePatterns() default {@TypePattern(name = "")};
-
-  /**
-   * Define the field-annotated-by pattern by fully qualified class name.
-   *
-   * <p>Mutually exclusive with the following other properties defining field-annotated-by:
-   *
-   * <ul>
-   *   <li>fieldAnnotatedByClassConstant
-   *   <li>fieldAnnotatedByClassNamePattern
-   * </ul>
-   *
-   * <p>Mutually exclusive with all method properties.
-   *
-   * <p>If none are specified the default is to match any field regardless of what the field is
-   * annotated by.
-   *
-   * @return The qualified class name that defines the annotation.
-   */
-  String fieldAnnotatedByClassName() default "";
-
-  /**
-   * Define the field-annotated-by pattern by reference to a Class constant.
-   *
-   * <p>Mutually exclusive with the following other properties defining field-annotated-by:
-   *
-   * <ul>
-   *   <li>fieldAnnotatedByClassName
-   *   <li>fieldAnnotatedByClassNamePattern
-   * </ul>
-   *
-   * <p>Mutually exclusive with all method properties.
-   *
-   * <p>If none are specified the default is to match any field regardless of what the field is
-   * annotated by.
-   *
-   * @return The class-constant that defines the annotation.
-   */
-  Class<?> fieldAnnotatedByClassConstant() default Object.class;
-
-  /**
-   * Define the field-annotated-by pattern by reference to a class-name pattern.
-   *
-   * <p>Mutually exclusive with the following other properties defining field-annotated-by:
-   *
-   * <ul>
-   *   <li>fieldAnnotatedByClassName
-   *   <li>fieldAnnotatedByClassConstant
-   * </ul>
-   *
-   * <p>Mutually exclusive with all method properties.
-   *
-   * <p>If none are specified the default is to match any field regardless of what the field is
-   * annotated by.
-   *
-   * @return The class-name pattern that defines the annotation.
-   */
-  ClassNamePattern fieldAnnotatedByClassNamePattern() default
-      @ClassNamePattern(unqualifiedName = "");
-
-  /**
-   * Define the field-access pattern by matching on access flags.
-   *
-   * <p>Mutually exclusive with all method properties.
-   *
-   * <p>If none, and other properties define this item as a field, the default matches any
-   * field-access flags.
-   *
-   * @return The field access-flag constraints that must be met.
-   */
-  FieldAccessFlags[] fieldAccess() default {};
-
-  /**
-   * Define the field-name pattern by an exact field name.
-   *
-   * <p>Mutually exclusive with all method properties.
-   *
-   * <p>If none, and other properties define this item as a field, the default matches any field
-   * name.
-   *
-   * <p>Mutually exclusive with the property `fieldNamePattern` also defining field-name.
-   *
-   * @return The exact field name of the field.
-   */
-  String fieldName() default "";
-
-  /**
-   * Define the field-name pattern by a string pattern.
-   *
-   * <p>Mutually exclusive with all method properties.
-   *
-   * <p>If none, and other properties define this item as a field, the default matches any field
-   * name.
-   *
-   * <p>Mutually exclusive with the property `fieldName` also defining field-name.
-   *
-   * @return The string pattern of the field name.
-   */
-  StringPattern fieldNamePattern() default @StringPattern(exact = "");
-
-  /**
-   * Define the field-type pattern by a fully qualified type.
-   *
-   * <p>Mutually exclusive with all method properties.
-   *
-   * <p>If none, and other properties define this item as a field, the default matches any type.
-   *
-   * <p>Mutually exclusive with the following other properties defining field-type:
-   *
-   * <ul>
-   *   <li>fieldTypeConstant
-   *   <li>fieldTypePattern
-   * </ul>
-   *
-   * @return The qualified type name for the field type.
-   */
-  String fieldType() default "";
-
-  /**
-   * Define the field-type pattern by a class constant.
-   *
-   * <p>Mutually exclusive with all method properties.
-   *
-   * <p>If none, and other properties define this item as a field, the default matches any type.
-   *
-   * <p>Mutually exclusive with the following other properties defining field-type:
-   *
-   * <ul>
-   *   <li>fieldType
-   *   <li>fieldTypePattern
-   * </ul>
-   *
-   * @return The class constant for the field type.
-   */
-  Class<?> fieldTypeConstant() default Object.class;
-
-  /**
-   * Define the field-type pattern by a pattern on types.
-   *
-   * <p>Mutually exclusive with all method properties.
-   *
-   * <p>If none, and other properties define this item as a field, the default matches any type.
-   *
-   * <p>Mutually exclusive with the following other properties defining field-type:
-   *
-   * <ul>
-   *   <li>fieldType
-   *   <li>fieldTypeConstant
-   * </ul>
-   *
-   * @return The type pattern for the field type.
-   */
-  TypePattern fieldTypePattern() default @TypePattern(name = "");
-}
diff --git a/src/keepanno/java/androidx/annotation/keep/UsedByReflection.kt b/src/keepanno/java/androidx/annotation/keep/UsedByReflection.kt
new file mode 100644
index 0000000..7c9f85f
--- /dev/null
+++ b/src/keepanno/java/androidx/annotation/keep/UsedByReflection.kt
@@ -0,0 +1,636 @@
+/*
+ * Copyright 2025 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.
+ */
+
+// ***********************************************************************************
+// GENERATED FILE. DO NOT EDIT! See KeepItemAnnotationGenerator.java.
+// ***********************************************************************************
+
+// ***********************************************************************************
+// MAINTAINED AND TESTED IN THE R8 REPO. PLEASE MAKE CHANGES THERE AND REPLICATE.
+// ***********************************************************************************
+
+package androidx.annotation.keep
+
+import kotlin.annotation.Retention
+import kotlin.annotation.Target
+import kotlin.reflect.KClass
+
+/**
+ * Annotation to mark a class, field or method as being accessed reflectively.
+ *
+ * <p>
+ * Note: Before using this annotation, consider if instead you can annotate the code that is doing
+ * reflection with {@link UsesReflection}. Annotating the reflecting code is generally more clear
+ * and maintainable, and it also naturally gives rise to edges that describe just the reflected
+ * aspects of the program. The {@link UsedByReflection} annotation is suitable for cases where the
+ * reflecting code is not under user control, or in migrating away from rules.
+ *
+ * <p>
+ * When a class is annotated, member patterns can be used to define which members are to be kept.
+ * When no member patterns are specified the default pattern is to match just the class.
+ *
+ * <p>
+ * When a member is annotated, the member patterns cannot be used as the annotated member itself
+ * fully defines the item to be kept (i.e., itself).
+ */
+@Retention(AnnotationRetention.BINARY)
+@Target(
+  AnnotationTarget.CLASS,
+  AnnotationTarget.FIELD,
+  AnnotationTarget.FUNCTION,
+  AnnotationTarget.CONSTRUCTOR,
+)
+annotation class UsedByReflection(
+
+  /**
+   * Optional description to document the reason for this annotation.
+   *
+   * @return The descriptive message. Defaults to no description.
+   */
+  val description: String = "",
+
+  /**
+   * Conditions that should be satisfied for the annotation to be in effect.
+   *
+   * @return The list of preconditions. Defaults to no conditions, thus trivially/unconditionally
+   *   satisfied.
+   */
+  val preconditions: Array<KeepCondition> = [],
+
+  /**
+   * Additional targets to be kept in addition to the annotated class/members.
+   *
+   * @return List of additional target consequences. Defaults to no additional target consequences.
+   */
+  val additionalTargets: Array<KeepTarget> = [],
+
+  /**
+   * Specify the kind of this item pattern.
+   *
+   * <p>
+   * If unspecified the default kind depends on the annotated item.
+   *
+   * <p>
+   * When annotating a class the default kind is:
+   * <ul>
+   * <li>{@link KeepItemKind#ONLY_CLASS} if no member patterns are defined;
+   * <li>{@link KeepItemKind#CLASS_AND_METHODS} if method patterns are defined;
+   * <li>{@link KeepItemKind#CLASS_AND_FIELDS} if field patterns are defined;
+   * <li>{@link KeepItemKind#CLASS_AND_MEMBERS} otherwise.
+   * </ul>
+   *
+   * <p>
+   * When annotating a method the default kind is: {@link KeepItemKind#ONLY_METHODS}
+   *
+   * <p>
+   * When annotating a field the default kind is: {@link KeepItemKind#ONLY_FIELDS}
+   *
+   * <p>
+   * It is not possible to use {@link KeepItemKind#ONLY_CLASS} if annotating a member.
+   *
+   * @return The kind for this pattern.
+   */
+  val kind: KeepItemKind = KeepItemKind.DEFAULT,
+
+  /**
+   * Define the usage constraints of the target.
+   *
+   * <p>
+   * The specified constraints must remain valid for the target.
+   *
+   * <p>
+   * The default constraints depend on the kind of the target. For all targets the default
+   * constraints include:
+   * <ul>
+   * <li>{@link KeepConstraint#LOOKUP}
+   * <li>{@link KeepConstraint#NAME}
+   * <li>{@link KeepConstraint#VISIBILITY_RELAX}
+   * </ul>
+   *
+   * <p>
+   * For classes the default constraints also include:
+   * <ul>
+   * <li>{@link KeepConstraint#CLASS_INSTANTIATE}
+   * </ul>
+   *
+   * <p>
+   * For methods the default constraints also include:
+   * <ul>
+   * <li>{@link KeepConstraint#METHOD_INVOKE}
+   * </ul>
+   *
+   * <p>
+   * For fields the default constraints also include:
+   * <ul>
+   * <li>{@link KeepConstraint#FIELD_GET}
+   * <li>{@link KeepConstraint#FIELD_SET}
+   * </ul>
+   *
+   * <p>
+   * Mutually exclusive with the property `constraintAdditions` also defining constraints.
+   *
+   * @return Usage constraints for the target.
+   */
+  val constraints: Array<KeepConstraint> = [],
+
+  /**
+   * Add additional usage constraints of the target.
+   *
+   * <p>
+   * The specified constraints must remain valid for the target in addition to the default
+   * constraints.
+   *
+   * <p>
+   * The default constraints are documented in {@link #constraints}
+   *
+   * <p>
+   * Mutually exclusive with the property `constraints` also defining constraints.
+   *
+   * @return Additional usage constraints for the target.
+   */
+  val constraintAdditions: Array<KeepConstraint> = [],
+
+  /**
+   * Patterns for annotations that must remain on the item.
+   *
+   * <p>
+   * The annotations matching any of the patterns must remain on the item if the annotation types
+   * remain in the program.
+   *
+   * <p>
+   * Note that if the annotation types themselves are unused/removed, then their references on the
+   * item will be removed too. If the annotation types themselves are used reflectively then they
+   * too need a keep annotation or rule to ensure they remain in the program.
+   *
+   * <p>
+   * By default no annotation patterns are defined and no annotations are required to remain.
+   *
+   * @return Annotation patterns
+   */
+  val constrainAnnotations: Array<AnnotationPattern> = [],
+
+  /**
+   * Define the member-annotated-by pattern by fully qualified class name.
+   *
+   * <p>
+   * Mutually exclusive with the following other properties defining member-annotated-by:
+   * <ul>
+   * <li>memberAnnotatedByClassConstant
+   * <li>memberAnnotatedByClassNamePattern
+   * </ul>
+   *
+   * <p>
+   * Mutually exclusive with all field and method properties as use restricts the match to both
+   * types of members.
+   *
+   * <p>
+   * If none are specified the default is to match any member regardless of what the member is
+   * annotated by.
+   *
+   * @return The qualified class name that defines the annotation.
+   */
+  val memberAnnotatedByClassName: String = "",
+
+  /**
+   * Define the member-annotated-by pattern by reference to a Class constant.
+   *
+   * <p>
+   * Mutually exclusive with the following other properties defining member-annotated-by:
+   * <ul>
+   * <li>memberAnnotatedByClassName
+   * <li>memberAnnotatedByClassNamePattern
+   * </ul>
+   *
+   * <p>
+   * Mutually exclusive with all field and method properties as use restricts the match to both
+   * types of members.
+   *
+   * <p>
+   * If none are specified the default is to match any member regardless of what the member is
+   * annotated by.
+   *
+   * @return The class-constant that defines the annotation.
+   */
+  val memberAnnotatedByClassConstant: KClass<*> = Object::class,
+
+  /**
+   * Define the member-annotated-by pattern by reference to a class-name pattern.
+   *
+   * <p>
+   * Mutually exclusive with the following other properties defining member-annotated-by:
+   * <ul>
+   * <li>memberAnnotatedByClassName
+   * <li>memberAnnotatedByClassConstant
+   * </ul>
+   *
+   * <p>
+   * Mutually exclusive with all field and method properties as use restricts the match to both
+   * types of members.
+   *
+   * <p>
+   * If none are specified the default is to match any member regardless of what the member is
+   * annotated by.
+   *
+   * @return The class-name pattern that defines the annotation.
+   */
+  val memberAnnotatedByClassNamePattern: ClassNamePattern = ClassNamePattern(unqualifiedName = ""),
+
+  /**
+   * Define the member-access pattern by matching on access flags.
+   *
+   * <p>
+   * Mutually exclusive with all field and method properties as use restricts the match to both
+   * types of members.
+   *
+   * @return The member access-flag constraints that must be met.
+   */
+  val memberAccess: Array<MemberAccessFlags> = [],
+
+  /**
+   * Define the method-annotated-by pattern by fully qualified class name.
+   *
+   * <p>
+   * Mutually exclusive with the following other properties defining method-annotated-by:
+   * <ul>
+   * <li>methodAnnotatedByClassConstant
+   * <li>methodAnnotatedByClassNamePattern
+   * </ul>
+   *
+   * <p>
+   * Mutually exclusive with all field properties.
+   *
+   * <p>
+   * If none are specified the default is to match any method regardless of what the method is
+   * annotated by.
+   *
+   * @return The qualified class name that defines the annotation.
+   */
+  val methodAnnotatedByClassName: String = "",
+
+  /**
+   * Define the method-annotated-by pattern by reference to a Class constant.
+   *
+   * <p>
+   * Mutually exclusive with the following other properties defining method-annotated-by:
+   * <ul>
+   * <li>methodAnnotatedByClassName
+   * <li>methodAnnotatedByClassNamePattern
+   * </ul>
+   *
+   * <p>
+   * Mutually exclusive with all field properties.
+   *
+   * <p>
+   * If none are specified the default is to match any method regardless of what the method is
+   * annotated by.
+   *
+   * @return The class-constant that defines the annotation.
+   */
+  val methodAnnotatedByClassConstant: KClass<*> = Object::class,
+
+  /**
+   * Define the method-annotated-by pattern by reference to a class-name pattern.
+   *
+   * <p>
+   * Mutually exclusive with the following other properties defining method-annotated-by:
+   * <ul>
+   * <li>methodAnnotatedByClassName
+   * <li>methodAnnotatedByClassConstant
+   * </ul>
+   *
+   * <p>
+   * Mutually exclusive with all field properties.
+   *
+   * <p>
+   * If none are specified the default is to match any method regardless of what the method is
+   * annotated by.
+   *
+   * @return The class-name pattern that defines the annotation.
+   */
+  val methodAnnotatedByClassNamePattern: ClassNamePattern = ClassNamePattern(unqualifiedName = ""),
+
+  /**
+   * Define the method-access pattern by matching on access flags.
+   *
+   * <p>
+   * Mutually exclusive with all field properties.
+   *
+   * <p>
+   * If none, and other properties define this item as a method, the default matches any
+   * method-access flags.
+   *
+   * @return The method access-flag constraints that must be met.
+   */
+  val methodAccess: Array<MethodAccessFlags> = [],
+
+  /**
+   * Define the method-name pattern by an exact method name.
+   *
+   * <p>
+   * Mutually exclusive with all field properties.
+   *
+   * <p>
+   * If none, and other properties define this item as a method, the default matches any method
+   * name.
+   *
+   * <p>
+   * Mutually exclusive with the property `methodNamePattern` also defining method-name.
+   *
+   * @return The exact method name of the method.
+   */
+  val methodName: String = "",
+
+  /**
+   * Define the method-name pattern by a string pattern.
+   *
+   * <p>
+   * Mutually exclusive with all field properties.
+   *
+   * <p>
+   * If none, and other properties define this item as a method, the default matches any method
+   * name.
+   *
+   * <p>
+   * Mutually exclusive with the property `methodName` also defining method-name.
+   *
+   * @return The string pattern of the method name.
+   */
+  val methodNamePattern: StringPattern = StringPattern(exact = ""),
+
+  /**
+   * Define the method return-type pattern by a fully qualified type or 'void'.
+   *
+   * <p>
+   * Mutually exclusive with all field properties.
+   *
+   * <p>
+   * If none, and other properties define this item as a method, the default matches any return
+   * type.
+   *
+   * <p>
+   * Mutually exclusive with the following other properties defining return-type:
+   * <ul>
+   * <li>methodReturnTypeConstant
+   * <li>methodReturnTypePattern
+   * </ul>
+   *
+   * @return The qualified type name of the method return type.
+   */
+  val methodReturnType: String = "",
+
+  /**
+   * Define the method return-type pattern by a class constant.
+   *
+   * <p>
+   * Mutually exclusive with all field properties.
+   *
+   * <p>
+   * If none, and other properties define this item as a method, the default matches any return
+   * type.
+   *
+   * <p>
+   * Mutually exclusive with the following other properties defining return-type:
+   * <ul>
+   * <li>methodReturnType
+   * <li>methodReturnTypePattern
+   * </ul>
+   *
+   * @return A class constant denoting the type of the method return type.
+   */
+  val methodReturnTypeConstant: KClass<*> = Object::class,
+
+  /**
+   * Define the method return-type pattern by a type pattern.
+   *
+   * <p>
+   * Mutually exclusive with all field properties.
+   *
+   * <p>
+   * If none, and other properties define this item as a method, the default matches any return
+   * type.
+   *
+   * <p>
+   * Mutually exclusive with the following other properties defining return-type:
+   * <ul>
+   * <li>methodReturnType
+   * <li>methodReturnTypeConstant
+   * </ul>
+   *
+   * @return The pattern of the method return type.
+   */
+  val methodReturnTypePattern: TypePattern = TypePattern(name = ""),
+
+  /**
+   * Define the method parameters pattern by a list of fully qualified types.
+   *
+   * <p>
+   * Mutually exclusive with all field properties.
+   *
+   * <p>
+   * If none, and other properties define this item as a method, the default matches any parameters.
+   *
+   * <p>
+   * Mutually exclusive with the property `methodParameterTypePatterns` also defining parameters.
+   *
+   * @return The list of qualified type names of the method parameters.
+   */
+  val methodParameters: Array<String> = [""],
+
+  /**
+   * Define the method parameters pattern by a list of patterns on types.
+   *
+   * <p>
+   * Mutually exclusive with all field properties.
+   *
+   * <p>
+   * If none, and other properties define this item as a method, the default matches any parameters.
+   *
+   * <p>
+   * Mutually exclusive with the property `methodParameters` also defining parameters.
+   *
+   * @return The list of type patterns for the method parameters.
+   */
+  val methodParameterTypePatterns: Array<TypePattern> = [TypePattern(name = "")],
+
+  /**
+   * Define the field-annotated-by pattern by fully qualified class name.
+   *
+   * <p>
+   * Mutually exclusive with the following other properties defining field-annotated-by:
+   * <ul>
+   * <li>fieldAnnotatedByClassConstant
+   * <li>fieldAnnotatedByClassNamePattern
+   * </ul>
+   *
+   * <p>
+   * Mutually exclusive with all method properties.
+   *
+   * <p>
+   * If none are specified the default is to match any field regardless of what the field is
+   * annotated by.
+   *
+   * @return The qualified class name that defines the annotation.
+   */
+  val fieldAnnotatedByClassName: String = "",
+
+  /**
+   * Define the field-annotated-by pattern by reference to a Class constant.
+   *
+   * <p>
+   * Mutually exclusive with the following other properties defining field-annotated-by:
+   * <ul>
+   * <li>fieldAnnotatedByClassName
+   * <li>fieldAnnotatedByClassNamePattern
+   * </ul>
+   *
+   * <p>
+   * Mutually exclusive with all method properties.
+   *
+   * <p>
+   * If none are specified the default is to match any field regardless of what the field is
+   * annotated by.
+   *
+   * @return The class-constant that defines the annotation.
+   */
+  val fieldAnnotatedByClassConstant: KClass<*> = Object::class,
+
+  /**
+   * Define the field-annotated-by pattern by reference to a class-name pattern.
+   *
+   * <p>
+   * Mutually exclusive with the following other properties defining field-annotated-by:
+   * <ul>
+   * <li>fieldAnnotatedByClassName
+   * <li>fieldAnnotatedByClassConstant
+   * </ul>
+   *
+   * <p>
+   * Mutually exclusive with all method properties.
+   *
+   * <p>
+   * If none are specified the default is to match any field regardless of what the field is
+   * annotated by.
+   *
+   * @return The class-name pattern that defines the annotation.
+   */
+  val fieldAnnotatedByClassNamePattern: ClassNamePattern = ClassNamePattern(unqualifiedName = ""),
+
+  /**
+   * Define the field-access pattern by matching on access flags.
+   *
+   * <p>
+   * Mutually exclusive with all method properties.
+   *
+   * <p>
+   * If none, and other properties define this item as a field, the default matches any field-access
+   * flags.
+   *
+   * @return The field access-flag constraints that must be met.
+   */
+  val fieldAccess: Array<FieldAccessFlags> = [],
+
+  /**
+   * Define the field-name pattern by an exact field name.
+   *
+   * <p>
+   * Mutually exclusive with all method properties.
+   *
+   * <p>
+   * If none, and other properties define this item as a field, the default matches any field name.
+   *
+   * <p>
+   * Mutually exclusive with the property `fieldNamePattern` also defining field-name.
+   *
+   * @return The exact field name of the field.
+   */
+  val fieldName: String = "",
+
+  /**
+   * Define the field-name pattern by a string pattern.
+   *
+   * <p>
+   * Mutually exclusive with all method properties.
+   *
+   * <p>
+   * If none, and other properties define this item as a field, the default matches any field name.
+   *
+   * <p>
+   * Mutually exclusive with the property `fieldName` also defining field-name.
+   *
+   * @return The string pattern of the field name.
+   */
+  val fieldNamePattern: StringPattern = StringPattern(exact = ""),
+
+  /**
+   * Define the field-type pattern by a fully qualified type.
+   *
+   * <p>
+   * Mutually exclusive with all method properties.
+   *
+   * <p>
+   * If none, and other properties define this item as a field, the default matches any type.
+   *
+   * <p>
+   * Mutually exclusive with the following other properties defining field-type:
+   * <ul>
+   * <li>fieldTypeConstant
+   * <li>fieldTypePattern
+   * </ul>
+   *
+   * @return The qualified type name for the field type.
+   */
+  val fieldType: String = "",
+
+  /**
+   * Define the field-type pattern by a class constant.
+   *
+   * <p>
+   * Mutually exclusive with all method properties.
+   *
+   * <p>
+   * If none, and other properties define this item as a field, the default matches any type.
+   *
+   * <p>
+   * Mutually exclusive with the following other properties defining field-type:
+   * <ul>
+   * <li>fieldType
+   * <li>fieldTypePattern
+   * </ul>
+   *
+   * @return The class constant for the field type.
+   */
+  val fieldTypeConstant: KClass<*> = Object::class,
+
+  /**
+   * Define the field-type pattern by a pattern on types.
+   *
+   * <p>
+   * Mutually exclusive with all method properties.
+   *
+   * <p>
+   * If none, and other properties define this item as a field, the default matches any type.
+   *
+   * <p>
+   * Mutually exclusive with the following other properties defining field-type:
+   * <ul>
+   * <li>fieldType
+   * <li>fieldTypeConstant
+   * </ul>
+   *
+   * @return The type pattern for the field type.
+   */
+  val fieldTypePattern: TypePattern = TypePattern(name = ""),
+)
diff --git a/src/keepanno/java/androidx/annotation/keep/UsesReflection.java b/src/keepanno/java/androidx/annotation/keep/UsesReflection.kt
similarity index 75%
rename from src/keepanno/java/androidx/annotation/keep/UsesReflection.java
rename to src/keepanno/java/androidx/annotation/keep/UsesReflection.kt
index 0d7ca88..ced4530 100644
--- a/src/keepanno/java/androidx/annotation/keep/UsesReflection.java
+++ b/src/keepanno/java/androidx/annotation/keep/UsesReflection.kt
@@ -22,29 +22,29 @@
 // MAINTAINED AND TESTED IN THE R8 REPO. PLEASE MAKE CHANGES THERE AND REPLICATE.
 // ***********************************************************************************
 
-package androidx.annotation.keep;
+package androidx.annotation.keep
 
-import java.lang.annotation.ElementType;
-import java.lang.annotation.Retention;
-import java.lang.annotation.RetentionPolicy;
-import java.lang.annotation.Target;
+import kotlin.annotation.Retention
+import kotlin.annotation.Target
 
 /**
  * Annotation to declare the reflective usages made by a class, method or field.
  *
- * <p>The annotation's 'value' is a list of targets to be kept if the annotated item is used. The
+ * <p>
+ * The annotation's 'value' is a list of targets to be kept if the annotated item is used. The
  * annotated item is a precondition for keeping any of the specified targets. Thus, if an annotated
  * method is determined to be unused by the program, the annotation itself will not be in effect and
  * the targets will not be kept (assuming nothing else is otherwise keeping them).
  *
- * <p>The annotation's 'additionalPreconditions' is optional and can specify additional conditions
- * that should be satisfied for the annotation to be in effect.
+ * <p>
+ * The annotation's 'additionalPreconditions' is optional and can specify additional conditions that
+ * should be satisfied for the annotation to be in effect.
  *
- * <p>The translation of the {@link UsesReflection} annotation into a {@link KeepEdge} is as
- * follows:
+ * <p>
+ * The translation of the {@link UsesReflection} annotation into a {@link KeepEdge} is as follows:
  *
- * <p>Assume the item of the annotation is denoted by 'CTX' and referred to as its context.
- *
+ * <p>
+ * Assume the item of the annotation is denoted by 'CTX' and referred to as its context.
  * <pre>
  * &#64;UsesReflection(value = targets, [additionalPreconditions = preconditions])
  * ==&gt;
@@ -75,28 +75,33 @@
  *   }
  * </pre>
  */
-@Target({ElementType.TYPE, ElementType.FIELD, ElementType.METHOD, ElementType.CONSTRUCTOR})
-@Retention(RetentionPolicy.CLASS)
-public @interface UsesReflection {
+@Retention(AnnotationRetention.BINARY)
+@Target(
+  AnnotationTarget.CLASS,
+  AnnotationTarget.FIELD,
+  AnnotationTarget.FUNCTION,
+  AnnotationTarget.CONSTRUCTOR,
+)
+annotation class UsesReflection(
 
   /**
    * Optional description to document the reason for this annotation.
    *
    * @return The descriptive message. Defaults to no description.
    */
-  String description() default "";
+  val description: String = "",
 
   /**
    * Consequences that must be kept if the annotation is in effect.
    *
    * @return The list of target consequences.
    */
-  KeepTarget[] value();
+  val value: Array<KeepTarget>,
 
   /**
    * Additional preconditions for the annotation to be in effect.
    *
    * @return The list of additional preconditions. Defaults to no additional preconditions.
    */
-  KeepCondition[] additionalPreconditions() default {};
-}
+  val additionalPreconditions: Array<KeepCondition> = [],
+)
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 a84a54e..1c27e1a 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
@@ -152,13 +152,47 @@
       if (isDeprecated()) {
         generator.println("@Deprecated");
       }
-      if (valueDefault == null) {
-        generator.println(valueType + " " + name + "();");
+      if (generator.generateKotlin()) {
+        if (kotlinValueDefault() == null) {
+          generator.println("val " + name + ": " + kotlinValueType() + ",");
+        } else {
+          generator.println(
+              "val " + name + ": " + kotlinValueType() + " = " + kotlinValueDefault() + ",");
+        }
       } else {
-        generator.println(valueType + " " + name + "() default " + valueDefault + ";");
+        if (valueDefault == null) {
+          generator.println(valueType + " " + name + "();");
+        } else {
+          generator.println(valueType + " " + name + "() default " + valueDefault + ";");
+        }
       }
     }
 
+    private String kotlinValueType() {
+      if (valueType.equals("Class<?>")) {
+        return "KClass<*>";
+      }
+      if (valueType.equals("boolean")) {
+        return "Boolean";
+      }
+      if (valueType.endsWith("[]")) {
+        return "Array<" + valueType.substring(0, valueType.length() - 2) + ">";
+      }
+      return valueType;
+    }
+
+    private String kotlinValueDefault() {
+      if (valueDefault != null) {
+        if (valueDefault.equals("Object.class")) {
+          return "Object::class";
+        }
+        if (valueDefault.startsWith("{") && valueDefault.endsWith("}")) {
+          return "[" + valueDefault.substring(1, valueDefault.length() - 1) + "]";
+        }
+      }
+      return valueDefault;
+    }
+
     public void generateConstants(Generator generator) {
       generator.println("public static final String " + name + " = " + quote(name) + ";");
     }
@@ -368,13 +402,19 @@
     final EnumReference FIELD_ACCESS_TRANSIENT;
     final List<EnumReference> FIELD_ACCESS_VALUES;
 
+    final String KOTLIN_DEFAULT_INVALID_STRING_PATTERN;
     final String DEFAULT_INVALID_STRING_PATTERN;
+    final String KOTLIN_DEFAULT_INVALID_TYPE_PATTERN;
     final String DEFAULT_INVALID_TYPE_PATTERN;
+    final String KOTLIN_DEFAULT_INVALID_CLASS_NAME_PATTERN;
     final String DEFAULT_INVALID_CLASS_NAME_PATTERN;
+    final String KOTLIN_DEFAULT_ANY_INSTANCE_OF_PATTERN;
     final String DEFAULT_ANY_INSTANCE_OF_PATTERN;
 
     final List<Class<?>> ANNOTATION_IMPORTS =
         ImmutableList.of(ElementType.class, Retention.class, RetentionPolicy.class, Target.class);
+    final List<Class<?>> KOTLIN_ANNOTATION_IMPORTS =
+        ImmutableList.of(kotlin.annotation.Retention.class, kotlin.annotation.Target.class);
 
     private final PrintStream writer;
     private final String pkg;
@@ -489,10 +529,15 @@
       FIELD_ACCESS_TRANSIENT = enumRef(FIELD_ACCESS_FLAGS, "TRANSIENT");
       FIELD_ACCESS_VALUES = ImmutableList.of(FIELD_ACCESS_VOLATILE, FIELD_ACCESS_TRANSIENT);
 
+      KOTLIN_DEFAULT_INVALID_STRING_PATTERN = getUnqualifiedName(STRING_PATTERN) + "(exact = \"\")";
       DEFAULT_INVALID_STRING_PATTERN = "@" + getUnqualifiedName(STRING_PATTERN) + "(exact = \"\")";
+      KOTLIN_DEFAULT_INVALID_TYPE_PATTERN = getUnqualifiedName(TYPE_PATTERN) + "(name = \"\")";
       DEFAULT_INVALID_TYPE_PATTERN = "@" + getUnqualifiedName(TYPE_PATTERN) + "(name = \"\")";
+      KOTLIN_DEFAULT_INVALID_CLASS_NAME_PATTERN =
+          getUnqualifiedName(CLASS_NAME_PATTERN) + "(unqualifiedName = \"\")";
       DEFAULT_INVALID_CLASS_NAME_PATTERN =
           "@" + getUnqualifiedName(CLASS_NAME_PATTERN) + "(unqualifiedName = \"\")";
+      KOTLIN_DEFAULT_ANY_INSTANCE_OF_PATTERN = getUnqualifiedName(INSTANCE_OF_PATTERN) + "()";
       DEFAULT_ANY_INSTANCE_OF_PATTERN = "@" + getUnqualifiedName(INSTANCE_OF_PATTERN) + "()";
     }
 
@@ -511,6 +556,10 @@
       indent -= 2;
     }
 
+    private boolean generateKotlin() {
+      return pkg.startsWith("androidx.");
+    }
+
     private void println() {
       println("");
     }
@@ -539,7 +588,7 @@
     }
 
     private void printPackage() {
-      println("package " + this.pkg + ";");
+      println("package " + this.pkg + (generateKotlin() ? "" : ";"));
       println();
     }
 
@@ -549,9 +598,67 @@
 
     private void printImports(List<Class<?>> imports) {
       for (Class<?> clazz : imports) {
-        println("import " + clazz.getCanonicalName() + ";");
+        println("import " + clazz.getCanonicalName() + (generateKotlin() ? "" : ";"));
       }
-      println();
+    }
+
+    private void printAnnotationImports() {
+      printImports(generateKotlin() ? KOTLIN_ANNOTATION_IMPORTS : ANNOTATION_IMPORTS);
+    }
+
+    private void printOpenAnnotationClassTargettingAnnotations(String clazz) {
+      if (generateKotlin()) {
+        println("@Retention(AnnotationRetention.BINARY)");
+        println("@Target(AnnotationTarget.ANNOTATION_CLASS)");
+        println("annotation class " + clazz + "(");
+      } else {
+        println("@Target(ElementType.ANNOTATION_TYPE)");
+        println("@Retention(RetentionPolicy.CLASS)");
+        println("public @interface " + clazz + " {");
+      }
+    }
+
+    private void printOpenAnnotationClassTargettingClassFieldlMethodCtor(String clazz) {
+      if (generateKotlin()) {
+        println("@Retention(AnnotationRetention.BINARY)");
+        println("@Target(");
+        println("  AnnotationTarget.CLASS,");
+        println("  AnnotationTarget.FIELD,");
+        println("  AnnotationTarget.FUNCTION,");
+        println("  AnnotationTarget.CONSTRUCTOR,");
+        println(")");
+        println("annotation class " + clazz + "(");
+      } else {
+        println(
+            "@Target({ElementType.TYPE, ElementType.FIELD, ElementType.METHOD,"
+                + " ElementType.CONSTRUCTOR})");
+        println("@Retention(RetentionPolicy.CLASS)");
+        println("public @interface " + clazz + " {");
+      }
+    }
+
+    private void printOpenAnnotationClassTargettingAnnotations(ClassReference clazz) {
+      printOpenAnnotationClassTargettingAnnotations(getUnqualifiedName(clazz));
+    }
+
+    private String defaultInvalidClassNamePattern() {
+      return generateKotlin()
+          ? KOTLIN_DEFAULT_INVALID_CLASS_NAME_PATTERN
+          : DEFAULT_INVALID_CLASS_NAME_PATTERN;
+    }
+
+    private String defaultInvalidStringPattern() {
+      return generateKotlin()
+          ? KOTLIN_DEFAULT_INVALID_STRING_PATTERN
+          : DEFAULT_INVALID_STRING_PATTERN;
+    }
+
+    private String defaultInvalidTypePattern() {
+      return generateKotlin() ? KOTLIN_DEFAULT_INVALID_TYPE_PATTERN : DEFAULT_INVALID_TYPE_PATTERN;
+    }
+
+    private void printCloseAnnotationClass() {
+      println(generateKotlin() ? ")" : "}");
     }
 
     private static String KIND_GROUP = "kind";
@@ -678,7 +785,7 @@
           .addMember(
               new GroupMember("classNamePattern")
                   .setDocTitle("Classes matching the class-name pattern.")
-                  .defaultValue(CLASS_NAME_PATTERN, DEFAULT_INVALID_CLASS_NAME_PATTERN))
+                  .defaultValue(CLASS_NAME_PATTERN, defaultInvalidClassNamePattern()))
           .addMember(instanceOfPattern());
       // TODO(b/248408342): Add more injections on type pattern variants.
       // /** Exact type name as a string to match any array with that type as member. */
@@ -716,7 +823,7 @@
           .addMember(
               new GroupMember("classNamePattern")
                   .setDocTitle("Instances of classes matching the class-name pattern.")
-                  .defaultValue(CLASS_NAME_PATTERN, DEFAULT_INVALID_CLASS_NAME_PATTERN));
+                  .defaultValue(CLASS_NAME_PATTERN, defaultInvalidClassNamePattern()));
     }
 
     private Group classNamePatternFullNameGroup() {
@@ -755,7 +862,7 @@
                   .setDocTitle("Define the unqualified class-name pattern by a string pattern.")
                   .setDocReturn("The string pattern of the unqualified class name.")
                   .addParagraph("The default matches any unqualified name.")
-                  .defaultValue(STRING_PATTERN, DEFAULT_INVALID_STRING_PATTERN));
+                  .defaultValue(STRING_PATTERN, defaultInvalidStringPattern()));
     }
 
     private Group classNamePatternPackageGroup() {
@@ -890,7 +997,7 @@
                   + ANNOTATION_NAME_GROUP
                   + " pattern by reference to a class-name pattern.")
           .setDocReturn("The class-name pattern that defines the annotation.")
-          .defaultValue(CLASS_NAME_PATTERN, DEFAULT_INVALID_CLASS_NAME_PATTERN);
+          .defaultValue(CLASS_NAME_PATTERN, defaultInvalidClassNamePattern());
     }
 
     private static GroupMember annotationRetention() {
@@ -944,7 +1051,7 @@
           .setDocTitle(
               "Define the " + CLASS_NAME_GROUP + " pattern by reference to a class-name pattern.")
           .setDocReturn("The class-name pattern that defines the class.")
-          .defaultValue(CLASS_NAME_PATTERN, DEFAULT_INVALID_CLASS_NAME_PATTERN);
+          .defaultValue(CLASS_NAME_PATTERN, defaultInvalidClassNamePattern());
     }
 
     private Group createClassNamePatternGroup() {
@@ -1007,7 +1114,11 @@
       return new GroupMember("instanceOfPattern")
           .setDocTitle("Define the " + INSTANCE_OF_GROUP + " with a pattern.")
           .setDocReturn("The pattern that defines what instance-of the class must be.")
-          .defaultValue(INSTANCE_OF_PATTERN, DEFAULT_ANY_INSTANCE_OF_PATTERN);
+          .defaultValue(
+              INSTANCE_OF_PATTERN,
+              generateKotlin()
+                  ? KOTLIN_DEFAULT_ANY_INSTANCE_OF_PATTERN
+                  : DEFAULT_ANY_INSTANCE_OF_PATTERN);
     }
 
     private Group createClassInstanceOfPatternGroup() {
@@ -1048,7 +1159,7 @@
                   .setDocTitle(
                       "Define the " + groupName + " pattern by reference to a class-name pattern.")
                   .setDocReturn("The class-name pattern that defines the annotation.")
-                  .defaultValue(CLASS_NAME_PATTERN, DEFAULT_INVALID_CLASS_NAME_PATTERN));
+                  .defaultValue(CLASS_NAME_PATTERN, defaultInvalidClassNamePattern()));
     }
 
     private Group createClassAnnotatedByPatternGroup() {
@@ -1146,7 +1257,7 @@
                   .addParagraph(getMutuallyExclusiveForMethodProperties())
                   .addParagraph(getMethodDefaultDoc("any method name"))
                   .setDocReturn("The string pattern of the method name.")
-                  .defaultValue(STRING_PATTERN, DEFAULT_INVALID_STRING_PATTERN));
+                  .defaultValue(STRING_PATTERN, defaultInvalidStringPattern()));
     }
 
     private Group createMethodReturnTypeGroup() {
@@ -1172,7 +1283,7 @@
                   .addParagraph(getMutuallyExclusiveForMethodProperties())
                   .addParagraph(getMethodDefaultDoc("any return type"))
                   .setDocReturn("The pattern of the method return type.")
-                  .defaultValue(TYPE_PATTERN, DEFAULT_INVALID_TYPE_PATTERN));
+                  .defaultValue(TYPE_PATTERN, defaultInvalidTypePattern()));
     }
 
     private Group createMethodParametersGroup() {
@@ -1192,7 +1303,7 @@
                   .addParagraph(getMutuallyExclusiveForMethodProperties())
                   .addParagraph(getMethodDefaultDoc("any parameters"))
                   .setDocReturn("The list of type patterns for the method parameters.")
-                  .defaultArrayValue(TYPE_PATTERN, DEFAULT_INVALID_TYPE_PATTERN));
+                  .defaultArrayValue(TYPE_PATTERN, defaultInvalidTypePattern()));
     }
 
     private Group createFieldAnnotatedByGroup() {
@@ -1228,7 +1339,7 @@
                   .addParagraph(getMutuallyExclusiveForFieldProperties())
                   .addParagraph(getFieldDefaultDoc("any field name"))
                   .setDocReturn("The string pattern of the field name.")
-                  .defaultValue(STRING_PATTERN, DEFAULT_INVALID_STRING_PATTERN));
+                  .defaultValue(STRING_PATTERN, defaultInvalidStringPattern()));
     }
 
     private Group createFieldTypeGroup() {
@@ -1253,7 +1364,7 @@
                   .addParagraph(getMutuallyExclusiveForFieldProperties())
                   .addParagraph(getFieldDefaultDoc("any type"))
                   .setDocReturn("The type pattern for the field type.")
-                  .defaultValue(TYPE_PATTERN, DEFAULT_INVALID_TYPE_PATTERN));
+                  .defaultValue(TYPE_PATTERN, defaultInvalidTypePattern()));
     }
 
     private void generateClassAndMemberPropertiesWithClassAndMemberBinding() {
@@ -1339,14 +1450,12 @@
     private void generateStringPattern() {
       printCopyRight(2024);
       printPackage();
-      printImports(ANNOTATION_IMPORTS);
+      printAnnotationImports();
       DocPrinter.printer()
           .setDocTitle("A pattern structure for matching strings.")
           .addParagraph("If no properties are set, the default pattern matches any string.")
           .printDoc(this::println);
-      println("@Target(ElementType.ANNOTATION_TYPE)");
-      println("@Retention(RetentionPolicy.CLASS)");
-      println("public @interface " + getUnqualifiedName(STRING_PATTERN) + " {");
+      printOpenAnnotationClassTargettingAnnotations(STRING_PATTERN);
       println();
       withIndent(
           () -> {
@@ -1360,41 +1469,41 @@
             println();
             suffixGroup.generate(this);
           });
-      println();
-      println("}");
+      printCloseAnnotationClass();
     }
 
     private void generateTypePattern() {
       printCopyRight(2023);
       printPackage();
-      printImports(ANNOTATION_IMPORTS);
+      printAnnotationImports();
+      if (generateKotlin()) {
+        println("import kotlin.reflect.KClass");
+      }
       DocPrinter.printer()
           .setDocTitle("A pattern structure for matching types.")
           .addParagraph("If no properties are set, the default pattern matches any type.")
           .addParagraph("All properties on this annotation are mutually exclusive.")
           .printDoc(this::println);
-      println("@Target(ElementType.ANNOTATION_TYPE)");
-      println("@Retention(RetentionPolicy.CLASS)");
-      println("public @interface " + getUnqualifiedName(TYPE_PATTERN) + " {");
+      printOpenAnnotationClassTargettingAnnotations(TYPE_PATTERN);
       println();
       withIndent(() -> typePatternGroup().generate(this));
-      println();
-      println("}");
+      printCloseAnnotationClass();
     }
 
     private void generateClassNamePattern() {
       printCopyRight(2023);
       printPackage();
-      printImports(ANNOTATION_IMPORTS);
+      printAnnotationImports();
+      if (generateKotlin()) {
+        println("import kotlin.reflect.KClass");
+      }
       DocPrinter.printer()
           .setDocTitle("A pattern structure for matching names of classes and interfaces.")
           .addParagraph(
               "If no properties are set, the default pattern matches any name of a class or"
                   + " interface.")
           .printDoc(this::println);
-      println("@Target(ElementType.ANNOTATION_TYPE)");
-      println("@Retention(RetentionPolicy.CLASS)");
-      println("public @interface " + getUnqualifiedName(CLASS_NAME_PATTERN) + " {");
+      printOpenAnnotationClassTargettingAnnotations(CLASS_NAME_PATTERN);
       println();
       withIndent(
           () -> {
@@ -1409,21 +1518,18 @@
             println();
             packageGroup.generate(this);
           });
-      println();
-      println("}");
+      printCloseAnnotationClass();
     }
 
     private void generateInstanceOfPattern() {
       printCopyRight(2024);
       printPackage();
-      printImports(ANNOTATION_IMPORTS);
+      printAnnotationImports();
       DocPrinter.printer()
           .setDocTitle("A pattern structure for matching instances of classes and interfaces.")
           .addParagraph("If no properties are set, the default pattern matches any instance.")
           .printDoc(this::println);
-      println("@Target(ElementType.ANNOTATION_TYPE)");
-      println("@Retention(RetentionPolicy.CLASS)");
-      println("public @interface " + getUnqualifiedName(INSTANCE_OF_PATTERN) + " {");
+      printOpenAnnotationClassTargettingAnnotations(INSTANCE_OF_PATTERN);
       println();
       withIndent(
           () -> {
@@ -1431,23 +1537,24 @@
             println();
             instanceOfPatternClassNamePattern().generate(this);
           });
-      println();
-      println("}");
+      printCloseAnnotationClass();
     }
 
     private void generateAnnotationPattern() {
       printCopyRight(2024);
       printPackage();
-      printImports(ANNOTATION_IMPORTS);
+      printImports(RetentionPolicy.class);
+      printAnnotationImports();
+      if (generateKotlin()) {
+        println("import kotlin.reflect.KClass");
+      }
       DocPrinter.printer()
           .setDocTitle("A pattern structure for matching annotations.")
           .addParagraph(
               "If no properties are set, the default pattern matches any annotation",
               "with a runtime retention policy.")
           .printDoc(this::println);
-      println("@Target(ElementType.ANNOTATION_TYPE)");
-      println("@Retention(RetentionPolicy.CLASS)");
-      println("public @interface " + getUnqualifiedName(ANNOTATION_PATTERN) + " {");
+      printOpenAnnotationClassTargettingAnnotations(ANNOTATION_PATTERN);
       println();
       withIndent(
           () -> {
@@ -1455,14 +1562,16 @@
             println();
             annotationRetention().generate(this);
           });
-      println();
-      println("}");
+      printCloseAnnotationClass();
     }
 
     private void generateKeepBinding() {
       printCopyRight(2022);
       printPackage();
-      printImports(ANNOTATION_IMPORTS);
+      printAnnotationImports();
+      if (generateKotlin()) {
+        println("import kotlin.reflect.KClass");
+      }
       DocPrinter.printer()
           .setDocTitle("A binding of a keep item.")
           .addParagraph(
@@ -1473,9 +1582,7 @@
           .addUnorderedList(
               "a pattern on classes;", "a pattern on methods; or", "a pattern on fields.")
           .printDoc(this::println);
-      println("@Target(ElementType.ANNOTATION_TYPE)");
-      println("@Retention(RetentionPolicy.CLASS)");
-      println("public @interface KeepBinding {");
+      printOpenAnnotationClassTargettingAnnotations("KeepBinding");
       println();
       withIndent(
           () -> {
@@ -1485,14 +1592,16 @@
             println();
             generateClassAndMemberPropertiesWithClassBinding();
           });
-      println();
-      println("}");
+      printCloseAnnotationClass();
     }
 
     private void generateKeepTarget() {
       printCopyRight(2022);
       printPackage();
-      printImports(ANNOTATION_IMPORTS);
+      printAnnotationImports();
+      if (generateKotlin()) {
+        println("import kotlin.reflect.KClass");
+      }
       DocPrinter.printer()
           .setDocTitle("A target for a keep edge.")
           .addParagraph(
@@ -1500,9 +1609,7 @@
           .addUnorderedList(
               "a pattern on classes;", "a pattern on methods; or", "a pattern on fields.")
           .printDoc(this::println);
-      println("@Target(ElementType.ANNOTATION_TYPE)");
-      println("@Retention(RetentionPolicy.CLASS)");
-      println("public @interface KeepTarget {");
+      printOpenAnnotationClassTargettingAnnotations("KeepTarget");
       println();
       withIndent(
           () -> {
@@ -1515,14 +1622,16 @@
                 });
             generateClassAndMemberPropertiesWithClassAndMemberBinding();
           });
-      println();
-      println("}");
+      printCloseAnnotationClass();
     }
 
     private void generateKeepCondition() {
       printCopyRight(2022);
       printPackage();
-      printImports(ANNOTATION_IMPORTS);
+      printAnnotationImports();
+      if (generateKotlin()) {
+        println("import kotlin.reflect.KClass");
+      }
       DocPrinter.printer()
           .setDocTitle("A condition for a keep edge.")
           .addParagraph(
@@ -1530,22 +1639,22 @@
           .addUnorderedList(
               "a pattern on classes;", "a pattern on methods; or", "a pattern on fields.")
           .printDoc(this::println);
-      println("@Target(ElementType.ANNOTATION_TYPE)");
-      println("@Retention(RetentionPolicy.CLASS)");
-      println("public @interface KeepCondition {");
+      printOpenAnnotationClassTargettingAnnotations("KeepCondition");
       println();
       withIndent(
           () -> {
             generateClassAndMemberPropertiesWithClassAndMemberBinding();
           });
-      println();
-      println("}");
+      printCloseAnnotationClass();
     }
 
     private void generateKeepForApi() {
       printCopyRight(2023);
       printPackage();
-      printImports(ANNOTATION_IMPORTS);
+      printAnnotationImports();
+      if (generateKotlin()) {
+        println("import kotlin.reflect.KClass");
+      }
       DocPrinter.printer()
           .setDocTitle(
               "Annotation to mark a class, field or method as part of a library API surface.")
@@ -1557,11 +1666,7 @@
               "When a member is annotated, the member patterns cannot be used as the annotated"
                   + " member itself fully defines the item to be kept (i.e., itself).")
           .printDoc(this::println);
-      println(
-          "@Target({ElementType.TYPE, ElementType.FIELD, ElementType.METHOD,"
-              + " ElementType.CONSTRUCTOR})");
-      println("@Retention(RetentionPolicy.CLASS)");
-      println("public @interface KeepForApi {");
+      printOpenAnnotationClassTargettingClassFieldlMethodCtor("KeepForApi");
       println();
       withIndent(
           () -> {
@@ -1592,14 +1697,13 @@
             println();
             generateMemberPropertiesNoBinding();
           });
-      println();
-      println("}");
+      printCloseAnnotationClass();
     }
 
     private void generateUsesReflection() {
       printCopyRight(2022);
       printPackage();
-      printImports(ANNOTATION_IMPORTS);
+      printAnnotationImports();
       DocPrinter.printer()
           .setDocTitle(
               "Annotation to declare the reflective usages made by a class, method or field.")
@@ -1651,11 +1755,7 @@
               "    // unreachable",
               "  }")
           .printDoc(this::println);
-      println(
-          "@Target({ElementType.TYPE, ElementType.FIELD, ElementType.METHOD,"
-              + " ElementType.CONSTRUCTOR})");
-      println("@Retention(RetentionPolicy.CLASS)");
-      println("public @interface " + getUnqualifiedName(USES_REFLECTION) + " {");
+      printOpenAnnotationClassTargettingClassFieldlMethodCtor(getUnqualifiedName(USES_REFLECTION));
       println();
       withIndent(
           () -> {
@@ -1665,13 +1765,16 @@
             println();
             createAdditionalPreconditionsGroup().generate(this);
           });
-      println("}");
+      printCloseAnnotationClass();
     }
 
     private void generateUsedByX(String annotationClassName, String doc) {
       printCopyRight(2023);
       printPackage();
-      printImports(ANNOTATION_IMPORTS);
+      printAnnotationImports();
+      if (generateKotlin()) {
+        println("import kotlin.reflect.KClass");
+      }
       DocPrinter.printer()
           .setDocTitle("Annotation to mark a class, field or method as being " + doc + ".")
           .addParagraph(
@@ -1694,11 +1797,7 @@
               "When a member is annotated, the member patterns cannot be used as the annotated"
                   + " member itself fully defines the item to be kept (i.e., itself).")
           .printDoc(this::println);
-      println(
-          "@Target({ElementType.TYPE, ElementType.FIELD, ElementType.METHOD,"
-              + " ElementType.CONSTRUCTOR})");
-      println("@Retention(RetentionPolicy.CLASS)");
-      println("public @interface " + annotationClassName + " {");
+      printOpenAnnotationClassTargettingClassFieldlMethodCtor(annotationClassName);
       println();
       withIndent(
           () -> {
@@ -1738,8 +1837,7 @@
                 });
             generateMemberPropertiesNoBinding();
           });
-      println();
-      println("}");
+      printCloseAnnotationClass();
     }
 
     private static String annoUnqualifiedName(ClassReference clazz) {
@@ -2190,56 +2288,7 @@
       println();
     }
 
-    private static void writeFile(Path file, Consumer<Generator> fn, BiConsumer<Path, String> write)
-        throws IOException {
-      ByteArrayOutputStream byteStream = new ByteArrayOutputStream();
-      PrintStream printStream = new PrintStream(byteStream);
-      Generator generator = new Generator(printStream, R8_ANNO_PKG);
-      fn.accept(generator);
-      String formatted = byteStream.toString();
-      if (file.toString().endsWith(".java")) {
-        formatted = CodeGenerationBase.javaFormatRawOutput(formatted);
-      }
-      Path resolved = Paths.get(ToolHelper.getProjectRoot()).resolve(file);
-      write.accept(resolved, formatted);
-    }
-
-    private static void writeFile(
-        String pkg,
-        Function<Generator, ClassReference> f,
-        Consumer<Generator> fn,
-        BiConsumer<Path, String> write)
-        throws IOException {
-      ByteArrayOutputStream byteStream = new ByteArrayOutputStream();
-      PrintStream printStream = new PrintStream(byteStream);
-      Generator generator = new Generator(printStream, pkg);
-      fn.accept(generator);
-      String formatted = byteStream.toString();
-      Path file = source(f.apply(generator));
-      if (file.toString().endsWith(".java")) {
-        formatted = CodeGenerationBase.javaFormatRawOutput(formatted);
-      }
-      Path resolved = Paths.get(ToolHelper.getProjectRoot()).resolve(file);
-      write.accept(resolved, formatted);
-    }
-
-    public static Path source(ClassReference clazz) {
-      return Paths.get("src", "keepanno", "java").resolve(clazz.getBinaryName() + ".java");
-    }
-
-    public static void run(BiConsumer<Path, String> write) throws IOException {
-      Path projectRoot = Paths.get(ToolHelper.getProjectRoot());
-      writeFile(
-          Paths.get("doc/keepanno-guide.md"),
-          generator -> KeepAnnoMarkdownGenerator.generateMarkdownDoc(generator, projectRoot),
-          write);
-
-      writeFile(
-          ANDROIDX_ANNO_PKG,
-          generator -> generator.ANNOTATION_CONSTANTS,
-          Generator::generateConstants,
-          write);
-      // Create a copy of the non-generated classes in the androidx namespace.
+    private static void copyNonGeneratedMethods() throws IOException {
       String[] nonGeneratedClasses =
           new String[] {
             "CheckOptimizedOut",
@@ -2270,6 +2319,70 @@
                 .collect(Collectors.toList()));
         FileUtils.writeTextFile(toResolved, out);
       }
+    }
+
+    private static void writeFile(Path file, Consumer<Generator> fn, BiConsumer<Path, String> write)
+        throws IOException {
+      ByteArrayOutputStream byteStream = new ByteArrayOutputStream();
+      PrintStream printStream = new PrintStream(byteStream);
+      Generator generator = new Generator(printStream, R8_ANNO_PKG);
+      fn.accept(generator);
+      String formatted = byteStream.toString();
+      if (file.toString().endsWith(".kt")) {
+        formatted = CodeGenerationBase.kotlinFormatRawOutput(formatted);
+      } else if (file.toString().endsWith(".java")) {
+        formatted = CodeGenerationBase.javaFormatRawOutput(formatted);
+      }
+      Path resolved = Paths.get(ToolHelper.getProjectRoot()).resolve(file);
+      write.accept(resolved, formatted);
+    }
+
+    private static void writeFile(
+        String pkg,
+        Function<Generator, ClassReference> f,
+        Consumer<Generator> fn,
+        BiConsumer<Path, String> write)
+        throws IOException {
+      ByteArrayOutputStream byteStream = new ByteArrayOutputStream();
+      PrintStream printStream = new PrintStream(byteStream);
+      Generator generator = new Generator(printStream, pkg);
+      fn.accept(generator);
+      String formatted = byteStream.toString();
+      Path file = source(f.apply(generator));
+      if (file.toString().endsWith(".kt")) {
+        formatted = CodeGenerationBase.kotlinFormatRawOutput(formatted);
+      } else if (file.toString().endsWith(".java")) {
+        formatted = CodeGenerationBase.javaFormatRawOutput(formatted);
+      }
+      Path resolved = Paths.get(ToolHelper.getProjectRoot()).resolve(file);
+      write.accept(resolved, formatted);
+    }
+
+    public static Path source(ClassReference clazz) {
+      Path keepAnnoSourcePath = Paths.get("src", "keepanno", "java");
+      if (clazz.getBinaryName().startsWith("androidx/")) {
+        return keepAnnoSourcePath.resolve(clazz.getBinaryName() + ".kt");
+      } else {
+        return keepAnnoSourcePath.resolve(clazz.getBinaryName() + ".java");
+      }
+    }
+
+    public static void run(BiConsumer<Path, String> write) throws IOException {
+      Path projectRoot = Paths.get(ToolHelper.getProjectRoot());
+      writeFile(
+          Paths.get("doc/keepanno-guide.md"),
+          generator -> KeepAnnoMarkdownGenerator.generateMarkdownDoc(generator, projectRoot),
+          write);
+
+      writeFile(
+          ANDROIDX_ANNO_PKG,
+          generator -> generator.ANNOTATION_CONSTANTS,
+          Generator::generateConstants,
+          write);
+      // Create a copy of the non-generated classes in the androidx namespace.
+      // This is currently disabled. Will potentially be re-introduced by converting these classes
+      // to Kotlin in the R8 keep anno namespace.
+      // copyNonGeneratedMethods();
       for (String pkg : new String[] {R8_ANNO_PKG, ANDROIDX_ANNO_PKG}) {
         writeFile(
             pkg, generator -> generator.STRING_PATTERN, Generator::generateStringPattern, write);