From a6de4df7777897fc968f62c64a7e3d31514c70ae Mon Sep 17 00:00:00 2001 From: redkale Date: Sat, 12 Aug 2023 09:28:05 +0800 Subject: [PATCH] =?UTF-8?q?Copier=E4=BC=98=E5=8C=96?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- src/main/java/org/redkale/util/Copier.java | 9 ++++----- 1 file changed, 4 insertions(+), 5 deletions(-) diff --git a/src/main/java/org/redkale/util/Copier.java b/src/main/java/org/redkale/util/Copier.java index 0b32ca9e6..d2c6b0ef0 100644 --- a/src/main/java/org/redkale/util/Copier.java +++ b/src/main/java/org/redkale/util/Copier.java @@ -16,7 +16,6 @@ import static org.redkale.asm.Opcodes.ACC_PUBLIC; import static org.redkale.asm.Opcodes.ACC_STATIC; import static org.redkale.asm.Opcodes.ACC_SUPER; import static org.redkale.asm.Opcodes.ACC_SYNTHETIC; -import static org.redkale.asm.Opcodes.ACONST_NULL; import static org.redkale.asm.Opcodes.ALOAD; import static org.redkale.asm.Opcodes.ARETURN; import static org.redkale.asm.Opcodes.ASTORE; @@ -207,7 +206,7 @@ public interface Copier extends BiFunction { .computeIfAbsent(srcClass, v -> { Copier copier = load(srcClass, destClass, options); Creator creator = Creator.load(destClass); - Function func = src -> copier.apply(src, creator.create()); + Function func = src -> src == null ? null : copier.apply(src, creator.create()); return func; }); } else { @@ -217,7 +216,7 @@ public interface Copier extends BiFunction { .computeIfAbsent(destClass, v -> { Copier copier = load(srcClass, destClass, options); Creator creator = Creator.load(destClass); - Function func = src -> copier.apply(src, creator.create()); + Function func = src -> src == null ? null : copier.apply(src, creator.create()); return func; }); } @@ -492,7 +491,7 @@ public interface Copier extends BiFunction { mv.visitVarInsn(ALOAD, 1); Label ifLabel = new Label(); mv.visitJumpInsn(IFNONNULL, ifLabel); - mv.visitInsn(ACONST_NULL); + mv.visitVarInsn(ALOAD, 2); mv.visitInsn(ARETURN); mv.visitLabel(ifLabel); mv.visitFrame(Opcodes.F_SAME, 0, null, 0, null); @@ -622,7 +621,7 @@ public interface Copier extends BiFunction { mv.visitVarInsn(ALOAD, 1); Label ifLabel = new Label(); mv.visitJumpInsn(IFNONNULL, ifLabel); - mv.visitInsn(ACONST_NULL); + mv.visitVarInsn(ALOAD, 2); mv.visitInsn(ARETURN); mv.visitLabel(ifLabel); mv.visitFrame(Opcodes.F_SAME, 0, null, 0, null);