[KeepAnno] Update default values to not overlap with valid values.
Bug: b/248408342
Change-Id: I316f8b94f3a0f5eb940a652017eed943aba7fd6e
diff --git a/src/keepanno/java/com/android/tools/r8/keepanno/annotations/KeepCondition.java b/src/keepanno/java/com/android/tools/r8/keepanno/annotations/KeepCondition.java
index 6d66d0a..4c93b2d 100644
--- a/src/keepanno/java/com/android/tools/r8/keepanno/annotations/KeepCondition.java
+++ b/src/keepanno/java/com/android/tools/r8/keepanno/annotations/KeepCondition.java
@@ -31,5 +31,9 @@
String methodName() default "";
+ String methodReturnType() default "";
+
+ String[] methodParameters() default {""};
+
String fieldName() default "";
}
diff --git a/src/keepanno/java/com/android/tools/r8/keepanno/annotations/KeepConstants.java b/src/keepanno/java/com/android/tools/r8/keepanno/annotations/KeepConstants.java
index a9bd519..4dc0c8a 100644
--- a/src/keepanno/java/com/android/tools/r8/keepanno/annotations/KeepConstants.java
+++ b/src/keepanno/java/com/android/tools/r8/keepanno/annotations/KeepConstants.java
@@ -41,11 +41,16 @@
public static final String methodName = "methodName";
public static final String methodReturnType = "methodReturnType";
public static final String methodParameters = "methodParameters";
- public static final String methodNameDefaultValue = "";
- public static final String methodReturnTypeDefaultValue = "";
- public static final String[] methodParametersDefaultValue = new String[] {"<any>"};
public static final String fieldName = "fieldName";
+
+ // Default values for the optional entries. The defaults should be chosen such that they do
+ // not coincide with any actual valid value. E.g., the empty string in place of a name or type.
+ // These must be 1:1 with the value defined on the actual annotation definition.
+ public static final String methodNameDefaultValue = "";
+ public static final String methodReturnTypeDefaultValue = "";
+ public static final String[] methodParametersDefaultValue = new String[] {""};
+
public static final String fieldNameDefaultValue = "";
}
diff --git a/src/keepanno/java/com/android/tools/r8/keepanno/annotations/KeepTarget.java b/src/keepanno/java/com/android/tools/r8/keepanno/annotations/KeepTarget.java
index 1b9fe64..5ae78b2 100644
--- a/src/keepanno/java/com/android/tools/r8/keepanno/annotations/KeepTarget.java
+++ b/src/keepanno/java/com/android/tools/r8/keepanno/annotations/KeepTarget.java
@@ -8,6 +8,20 @@
import java.lang.annotation.RetentionPolicy;
import java.lang.annotation.Target;
+/**
+ * A target for a keep edge.
+ *
+ * <p>The target denotes a keep item along with options for what to keep:
+ *
+ * <ul>
+ * <li>a class, or pattern on classes;
+ * <li>a method, or pattern on methods; or
+ * <li>a field, or pattern on fields.
+ * </ul>
+ *
+ * <p>The structure of a target item is the same as for a condition item but has the additional keep
+ * options.
+ */
@Target(ElementType.ANNOTATION_TYPE)
@Retention(RetentionPolicy.CLASS)
public @interface KeepTarget {
@@ -19,7 +33,7 @@
String methodReturnType() default "";
- String[] methodParameters() default {"<any>"};
+ String[] methodParameters() default {""};
String fieldName() default "";
}