Add nullability annotations to data class equals and toString.
KT-22201
This commit is contained in:
committed by
Nicolay Mitropolsky
parent
8d24ca65a3
commit
2e4f3ced9b
@@ -537,6 +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);
|
||||
InstructionAdapter iv = new InstructionAdapter(mv);
|
||||
|
||||
mv.visitCode();
|
||||
@@ -644,6 +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);
|
||||
InstructionAdapter iv = new InstructionAdapter(mv);
|
||||
|
||||
mv.visitCode();
|
||||
|
||||
Reference in New Issue
Block a user