Minor, fix NonExistentClass name and format

This commit is contained in:
Alexander Udalov
2016-07-05 20:17:52 +03:00
parent ceb54492e6
commit 720c29e8f4
2 changed files with 5 additions and 2 deletions
@@ -26,6 +26,7 @@ import org.jetbrains.kotlin.descriptors.annotations.AnnotationDescriptor;
import org.jetbrains.kotlin.load.java.JvmAbi;
import org.jetbrains.kotlin.load.java.lazy.types.RawTypeImpl;
import org.jetbrains.kotlin.load.kotlin.JavaFlexibleTypeDeserializer;
import org.jetbrains.kotlin.load.kotlin.TypeSignatureMappingKt;
import org.jetbrains.kotlin.name.ClassId;
import org.jetbrains.kotlin.serialization.AnnotationSerializer;
import org.jetbrains.kotlin.serialization.ProtoBuf;
@@ -164,7 +165,7 @@ public class JvmSerializerExtension extends SerializerExtension {
@Override
public void serializeErrorType(@NotNull KotlinType type, @NotNull ProtoBuf.Type.Builder builder) {
if (classBuilderMode == ClassBuilderMode.KAPT) {
builder.setClassName(stringTable.getStringIndex("error.NonExistingClass"));
builder.setClassName(stringTable.getStringIndex(TypeSignatureMappingKt.NON_EXISTENT_CLASS_NAME));
return;
}
@@ -47,6 +47,8 @@ interface TypeMappingConfiguration<out T : Any> {
fun processErrorType(kotlinType: KotlinType, descriptor: ClassDescriptor)
}
const val NON_EXISTENT_CLASS_NAME = "error/NonExistentClass"
fun <T : Any> mapType(
kotlinType: KotlinType,
factory: JvmTypeFactory<T>,
@@ -81,7 +83,7 @@ fun <T : Any> mapType(
when {
ErrorUtils.isError(descriptor) -> {
val jvmType = factory.createObjectType("error/NonExistentClass")
val jvmType = factory.createObjectType(NON_EXISTENT_CLASS_NAME)
typeMappingConfiguration.processErrorType(kotlinType, descriptor as ClassDescriptor)
descriptorTypeWriter?.writeClass(jvmType)
return jvmType