Update DEX record component annotation
* Rename componentVisibilities to componentAnnotationVisibilities
* Store visibility as a byte and not an int
Bug: b/274888318
Change-Id: I85e67cd4c7c8a81e126e898056214a9510647c18
diff --git a/src/main/java/com/android/tools/r8/graph/DexAnnotation.java b/src/main/java/com/android/tools/r8/graph/DexAnnotation.java
index 598adeb..25a5a97 100644
--- a/src/main/java/com/android/tools/r8/graph/DexAnnotation.java
+++ b/src/main/java/com/android/tools/r8/graph/DexAnnotation.java
@@ -9,6 +9,7 @@
import com.android.tools.r8.dex.MixedSectionCollection;
import com.android.tools.r8.graph.DexValue.DexValueAnnotation;
import com.android.tools.r8.graph.DexValue.DexValueArray;
+import com.android.tools.r8.graph.DexValue.DexValueByte;
import com.android.tools.r8.graph.DexValue.DexValueInt;
import com.android.tools.r8.graph.DexValue.DexValueMethod;
import com.android.tools.r8.graph.DexValue.DexValueNull;
@@ -320,7 +321,9 @@
factory.annotationRecord, annotation, factory.annotationRecordComponentSignatures);
DexValue componentAnnotationVisibilitiesValue =
getSystemValueAnnotationValueWithName(
- factory.annotationRecord, annotation, factory.annotationRecordComponentVisibilities);
+ factory.annotationRecord,
+ annotation,
+ factory.annotationRecordComponentAnnotationVisibilities);
DexValue componentAnnotationsValue =
getSystemValueAnnotationValueWithName(
factory.annotationRecord, annotation, factory.annotationRecordComponentAnnotations);
@@ -381,12 +384,12 @@
annotationIndex++) {
DexValue visibilityValue = visibilitiesValueArray.getValue(annotationIndex);
DexValue annotationValue = annotationsValueArray.getValue(annotationIndex);
- if (!visibilityValue.isDexValueInt() || !annotationValue.isDexValueAnnotation()) {
+ if (!visibilityValue.isDexValueByte() || !annotationValue.isDexValueAnnotation()) {
return null;
}
componentAnnotations.add(
new DexAnnotation(
- visibilityValue.asDexValueInt().getValue(),
+ visibilityValue.asDexValueByte().getValue(),
annotationValue.asDexValueAnnotation().getValue()));
}
}
@@ -481,7 +484,7 @@
* dalvik.annotation.Record</code> with the following content:
*
* <pre>
- * componentAnnotationVisibilities int[][]
+ * componentAnnotationVisibilities byte[][]
* componentAnnotations Annotation[][]
* componentNames String[]
* componentSignatures Annotation[] // Annotation dalvik.annotation.Signature or NULL
@@ -559,13 +562,13 @@
createSignatureAnnotation(info.getSignature().toString(), factory).annotation);
}
int annotationsSize = info.getAnnotations().size();
- DexValueInt[] visibilities = new DexValueInt[annotationsSize];
+ DexValueByte[] visibilities = new DexValueByte[annotationsSize];
DexValueAnnotation[] annotations = new DexValueAnnotation[annotationsSize];
componentAnnotationVisibilities[componentIndex] = new DexValueArray(visibilities);
componentAnnotations[componentIndex] = new DexValueArray(annotations);
for (int annotationIndex = 0; annotationIndex < annotationsSize; annotationIndex++) {
DexAnnotation annotation = info.getAnnotations().get(annotationIndex);
- visibilities[annotationIndex] = DexValueInt.create(annotation.getVisibility());
+ visibilities[annotationIndex] = DexValueByte.create((byte) annotation.getVisibility());
annotations[annotationIndex] = new DexValueAnnotation(annotation.annotation);
}
}
@@ -584,7 +587,7 @@
factory.annotationRecordComponentSignatures,
new DexValueArray(componentSignatures)),
new DexAnnotationElement(
- factory.annotationRecordComponentVisibilities,
+ factory.annotationRecordComponentAnnotationVisibilities,
new DexValueArray(componentAnnotationVisibilities)),
new DexAnnotationElement(
factory.annotationRecordComponentAnnotations,
diff --git a/src/main/java/com/android/tools/r8/graph/DexItemFactory.java b/src/main/java/com/android/tools/r8/graph/DexItemFactory.java
index 418cdce..579b21f 100644
--- a/src/main/java/com/android/tools/r8/graph/DexItemFactory.java
+++ b/src/main/java/com/android/tools/r8/graph/DexItemFactory.java
@@ -739,8 +739,8 @@
public final DexString annotationRecordComponentNames = createString("componentNames");
public final DexString annotationRecordComponentTypes = createString("componentTypes");
public final DexString annotationRecordComponentSignatures = createString("componentSignatures");
- public final DexString annotationRecordComponentVisibilities =
- createString("componentVisibilities");
+ public final DexString annotationRecordComponentAnnotationVisibilities =
+ createString("componentAnnotationVisibilities");
public final DexString annotationRecordComponentAnnotations =
createString("componentAnnotations");
public final DexType annotationSourceDebugExtension =