JVM, JVM_IR: no nullability annotations on lateinit backing fields
This commit is contained in:
@@ -438,8 +438,13 @@ public class PropertyCodegen {
|
||||
);
|
||||
|
||||
if (annotatedField != null) {
|
||||
boolean isInvisibleField = (modifiers & ACC_PRIVATE) != 0 || (modifiers & ACC_SYNTHETIC) != 0;
|
||||
AnnotationCodegen.forField(fv, memberCodegen, state, isInvisibleField)
|
||||
// Don't emit nullability annotations for backing field if:
|
||||
// - backing field is invisible from Java (private or synthetic);
|
||||
// - property is lateinit (since corresponding field is actually nullable).
|
||||
boolean skipNullabilityAnnotations =
|
||||
(modifiers & ACC_PRIVATE) != 0 || (modifiers & ACC_SYNTHETIC) != 0 ||
|
||||
propertyDescriptor.isLateInit();
|
||||
AnnotationCodegen.forField(fv, memberCodegen, state, skipNullabilityAnnotations)
|
||||
.genAnnotations(annotatedField, type, propertyDescriptor.getType());
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user