From d30c67db14d650b6535f604804dae6ad6468d364 Mon Sep 17 00:00:00 2001 From: Dmitry Petrov Date: Mon, 20 Jul 2020 12:13:40 +0300 Subject: [PATCH] JVM: don't skip nullability annotations on private fields Unfortunately, some annotation processors rely on those annotations. --- .../src/org/jetbrains/kotlin/codegen/PropertyCodegen.java | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/compiler/backend/src/org/jetbrains/kotlin/codegen/PropertyCodegen.java b/compiler/backend/src/org/jetbrains/kotlin/codegen/PropertyCodegen.java index 8af7ea94686..9c330c19ee0 100644 --- a/compiler/backend/src/org/jetbrains/kotlin/codegen/PropertyCodegen.java +++ b/compiler/backend/src/org/jetbrains/kotlin/codegen/PropertyCodegen.java @@ -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());