JVM: don't generate nullability annotations on property delegate fields

Such fields are private, so these annotations are redundant.

They were incorrect, anyway (property type was used instead of delegate
type).
This commit is contained in:
Dmitry Petrov
2020-06-23 16:56:23 +03:00
parent af3bda51ec
commit 5bfec7f6bc
2 changed files with 4 additions and 2 deletions
@@ -196,7 +196,9 @@ public abstract class AnnotationCodegen {
return; return;
} }
if (returnType != null && !AsmUtil.isPrimitive(returnType)) { if (returnType != null && !AsmUtil.isPrimitive(returnType) &&
!(descriptor instanceof PropertyDescriptor && ((PropertyDescriptor) descriptor).isDelegated())
) {
generateNullabilityAnnotation(descriptor.getReturnType(), annotationDescriptorsAlreadyPresent); generateNullabilityAnnotation(descriptor.getReturnType(), annotationDescriptorsAlreadyPresent);
} }
} }
@@ -2,7 +2,7 @@
public final class A { public final class A {
synthetic final static field $$delegatedProperties: kotlin.reflect.KProperty[] synthetic final static field $$delegatedProperties: kotlin.reflect.KProperty[]
private @AnnField field p: int private @AnnField field p: int
private final @AnnDelegate @org.jetbrains.annotations.NotNull field s$delegate: CustomDelegate private final @AnnDelegate field s$delegate: CustomDelegate
private final @AnnField field x: int private final @AnnField field x: int
private field y: int private field y: int
static method <clinit>(): void static method <clinit>(): void