Support JvmWildcard/JvmSuppressWildcard in ultra-light classes

The idea is reusing logic from KotlinTypeMapper for that
This commit is contained in:
Denis Zharkov
2018-11-16 15:26:51 +03:00
parent ce3b489fa9
commit 580d03be5f
7 changed files with 156 additions and 25 deletions
@@ -1464,14 +1464,22 @@ public class KotlinTypeMapper {
public String mapFieldSignature(@NotNull KotlinType backingFieldType, @NotNull PropertyDescriptor propertyDescriptor) {
JvmSignatureWriter sw = new BothSignatureWriter(BothSignatureWriter.Mode.TYPE);
writeFieldSignature(backingFieldType, propertyDescriptor, sw);
return sw.makeJavaGenericSignature();
}
public void writeFieldSignature(
@NotNull KotlinType backingFieldType,
@NotNull PropertyDescriptor propertyDescriptor,
JvmSignatureWriter sw
) {
if (!propertyDescriptor.isVar()) {
mapReturnType(propertyDescriptor, sw, backingFieldType);
}
else {
writeParameterType(sw, backingFieldType, propertyDescriptor);
}
return sw.makeJavaGenericSignature();
}
public void writeFormalTypeParameters(@NotNull List<TypeParameterDescriptor> typeParameters, @NotNull JvmSignatureWriter sw) {
@@ -1550,7 +1558,7 @@ public class KotlinTypeMapper {
sw.writeParameterTypeEnd();
}
private void writeParameterType(
public void writeParameterType(
@NotNull JvmSignatureWriter sw,
@NotNull KotlinType type,
@Nullable CallableDescriptor callableDescriptor
@@ -125,5 +125,5 @@ private fun AnnotationDescriptor?.suppressWildcardsMode(): Boolean? {
return (this ?: return null).allValueArguments.values.firstOrNull()?.value as? Boolean ?: true
}
private val JVM_SUPPRESS_WILDCARDS_ANNOTATION_FQ_NAME = FqName("kotlin.jvm.JvmSuppressWildcards")
private val JVM_WILDCARD_ANNOTATION_FQ_NAME = FqName("kotlin.jvm.JvmWildcard")
val JVM_SUPPRESS_WILDCARDS_ANNOTATION_FQ_NAME = FqName("kotlin.jvm.JvmSuppressWildcards")
val JVM_WILDCARD_ANNOTATION_FQ_NAME = FqName("kotlin.jvm.JvmWildcard")