From 628833af65c4cb4ac8be6376bf5971950e70ef2e Mon Sep 17 00:00:00 2001 From: Alexander Udalov Date: Thu, 21 Jun 2018 19:01:35 +0200 Subject: [PATCH] Generate nullability annotations as non-runtime-retained org.jetbrains.annotations.NotNull/Nullable have retention CLASS, therefore they should appear in RuntimeInvisibleAnnotations #KT-22201 Fixed --- .../jetbrains/kotlin/codegen/ImplementationBodyCodegen.java | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/compiler/backend/src/org/jetbrains/kotlin/codegen/ImplementationBodyCodegen.java b/compiler/backend/src/org/jetbrains/kotlin/codegen/ImplementationBodyCodegen.java index efec316cad6..5d4fa4e9b76 100644 --- a/compiler/backend/src/org/jetbrains/kotlin/codegen/ImplementationBodyCodegen.java +++ b/compiler/backend/src/org/jetbrains/kotlin/codegen/ImplementationBodyCodegen.java @@ -537,7 +537,7 @@ public class ImplementationBodyCodegen extends ClassBodyCodegen { public void generateEqualsMethod(@NotNull FunctionDescriptor function, @NotNull List properties) { MethodContext context = ImplementationBodyCodegen.this.context.intoFunction(function); MethodVisitor mv = v.newMethod(JvmDeclarationOriginKt.OtherOrigin(function), ACC_PUBLIC, "equals", "(Ljava/lang/Object;)Z", null, null); - mv.visitParameterAnnotation(0, Type.getDescriptor(Nullable.class), true); + mv.visitParameterAnnotation(0, Type.getDescriptor(Nullable.class), false); InstructionAdapter iv = new InstructionAdapter(mv); mv.visitCode(); @@ -645,7 +645,7 @@ public class ImplementationBodyCodegen extends ClassBodyCodegen { public void generateToStringMethod(@NotNull FunctionDescriptor function, @NotNull List properties) { MethodContext context = ImplementationBodyCodegen.this.context.intoFunction(function); MethodVisitor mv = v.newMethod(JvmDeclarationOriginKt.OtherOrigin(function), ACC_PUBLIC, "toString", "()Ljava/lang/String;", null, null); - mv.visitAnnotation(Type.getDescriptor(NotNull.class), true); + mv.visitAnnotation(Type.getDescriptor(NotNull.class), false); InstructionAdapter iv = new InstructionAdapter(mv); mv.visitCode();