JVM: don't skip nullability annotations on private fields

Unfortunately, some annotation processors rely on those annotations.
This commit is contained in:
Dmitry Petrov
2020-07-20 12:13:40 +03:00
parent b0ac046b05
commit d30c67db14
@@ -435,10 +435,10 @@ public class PropertyCodegen {
if (annotatedField != null) {
// Don't emit nullability annotations for backing field if:
// - backing field is invisible from Java (private or synthetic);
// - backing field is synthetic;
// - property is lateinit (since corresponding field is actually nullable).
boolean skipNullabilityAnnotations =
(modifiers & ACC_PRIVATE) != 0 || (modifiers & ACC_SYNTHETIC) != 0 ||
(modifiers & ACC_SYNTHETIC) != 0 ||
propertyDescriptor.isLateInit();
AnnotationCodegen.forField(fv, memberCodegen, state, skipNullabilityAnnotations)
.genAnnotations(annotatedField, type, propertyDescriptor.getType());