Generate nullability annotations as non-runtime-retained

org.jetbrains.annotations.NotNull/Nullable have retention CLASS,
therefore they should appear in RuntimeInvisibleAnnotations

 #KT-22201 Fixed
This commit is contained in:
Alexander Udalov
2018-06-21 19:01:35 +02:00
committed by Nicolay Mitropolsky
parent 2e4f3ced9b
commit 628833af65
@@ -537,7 +537,7 @@ public class ImplementationBodyCodegen extends ClassBodyCodegen {
public void generateEqualsMethod(@NotNull FunctionDescriptor function, @NotNull List<? extends PropertyDescriptor> 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<? extends PropertyDescriptor> 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();