Drop KotlinClassHeader#filePartClassNames, use 'data' instead

This commit is contained in:
Alexander Udalov
2015-12-30 17:02:55 +03:00
parent b587d3a78d
commit 661af854fa
11 changed files with 45 additions and 72 deletions
@@ -119,7 +119,7 @@ public final class DeserializedDescriptorResolver {
errorReporter.reportIncompatibleMetadataVersion(kotlinClass.getClassId(), kotlinClass.getLocation(), header.getMetadataVersion());
}
else if (expectedKinds.contains(header.getKind())) {
return header.getAnnotationData();
return header.getData();
}
return null;
@@ -23,9 +23,8 @@ class KotlinClassHeader(
val kind: KotlinClassHeader.Kind,
val metadataVersion: JvmMetadataVersion,
val bytecodeVersion: JvmBytecodeBinaryVersion,
val annotationData: Array<String>?,
val data: Array<String>?,
val strings: Array<String>?,
val filePartClassNames: Array<String>?,
val multifileClassName: String?,
val isInterfaceDefaultImpls: Boolean,
val isLocalClass: Boolean
@@ -48,8 +48,7 @@ public class ReadKotlinClassHeaderAnnotationVisitor implements AnnotationVisitor
private JvmMetadataVersion metadataVersion = null;
private JvmBytecodeBinaryVersion bytecodeVersion = null;
private String multifileClassName = null;
private String[] filePartClassNames = null;
private String[] annotationData = null;
private String[] data = null;
private String[] strings = null;
private KotlinClassHeader.Kind headerKind = null;
private boolean isInterfaceDefaultImpls = false;
@@ -62,9 +61,9 @@ public class ReadKotlinClassHeaderAnnotationVisitor implements AnnotationVisitor
}
if (metadataVersion == null || !metadataVersion.isCompatible()) {
annotationData = null;
data = null;
}
else if (shouldHaveData() && annotationData == null) {
else if (shouldHaveData() && data == null) {
// This means that the annotation is found and its ABI version is compatible, but there's no "data" string array in it.
// We tell the outside world that there's really no annotation at all
return null;
@@ -74,7 +73,7 @@ public class ReadKotlinClassHeaderAnnotationVisitor implements AnnotationVisitor
headerKind,
metadataVersion != null ? metadataVersion : JvmMetadataVersion.INVALID_VERSION,
bytecodeVersion != null ? bytecodeVersion : JvmBytecodeBinaryVersion.INVALID_VERSION,
annotationData, strings, filePartClassNames, multifileClassName, isInterfaceDefaultImpls, isLocalClass
data, strings, multifileClassName, isInterfaceDefaultImpls, isLocalClass
);
}
@@ -140,36 +139,23 @@ public class ReadKotlinClassHeaderAnnotationVisitor implements AnnotationVisitor
@Nullable
public AnnotationArrayArgumentVisitor visitArray(@NotNull Name name) {
String string = name.asString();
if (DATA_FIELD_NAME.equals(string)) {
if (DATA_FIELD_NAME.equals(string) || FILE_PART_CLASS_NAMES_FIELD_NAME.equals(string)) {
return dataArrayVisitor();
}
else if (STRINGS_FIELD_NAME.equals(string)) {
return stringsArrayVisitor();
}
else if (FILE_PART_CLASS_NAMES_FIELD_NAME.equals(string)) {
return filePartClassNamesVisitor();
}
else {
return null;
}
}
@NotNull
private AnnotationArrayArgumentVisitor filePartClassNamesVisitor() {
return new CollectStringArrayAnnotationVisitor() {
@Override
protected void visitEnd(@NotNull String[] data) {
filePartClassNames = data;
}
};
}
@NotNull
private AnnotationArrayArgumentVisitor dataArrayVisitor() {
return new CollectStringArrayAnnotationVisitor() {
@Override
protected void visitEnd(@NotNull String[] data) {
annotationData = data;
ReadKotlinClassHeaderAnnotationVisitor.this.data = data;
}
};
}