From a2019531567d2e62e1ce28736b3a15961d867523 Mon Sep 17 00:00:00 2001 From: "shaojin.wensj" Date: Sat, 27 May 2023 10:24:35 +0800 Subject: [PATCH] optimize codeSize --- .../java/com/alibaba/fastjson2/JSONWriter.java | 14 +++++--------- .../com/alibaba/fastjson2/internal/asm/Frame.java | 3 ++- 2 files changed, 7 insertions(+), 10 deletions(-) diff --git a/core/src/main/java/com/alibaba/fastjson2/JSONWriter.java b/core/src/main/java/com/alibaba/fastjson2/JSONWriter.java index cc3bb5b6ec..d9e285b3ba 100644 --- a/core/src/main/java/com/alibaba/fastjson2/JSONWriter.java +++ b/core/src/main/java/com/alibaba/fastjson2/JSONWriter.java @@ -230,15 +230,11 @@ public final String setPath(int index, Object object) { } public final void popPath(Object object) { - if (this.path == null) { - return; - } - - if ((context.features & Feature.ReferenceDetection.mask) == 0) { - return; - } - - if (object == Collections.EMPTY_LIST || object == Collections.EMPTY_SET) { + if (this.path == null + || (context.features & Feature.ReferenceDetection.mask) == 0 + || object == Collections.EMPTY_LIST + || object == Collections.EMPTY_SET + ) { return; } diff --git a/core/src/main/java/com/alibaba/fastjson2/internal/asm/Frame.java b/core/src/main/java/com/alibaba/fastjson2/internal/asm/Frame.java index bcf9602133..08c7a30551 100644 --- a/core/src/main/java/com/alibaba/fastjson2/internal/asm/Frame.java +++ b/core/src/main/java/com/alibaba/fastjson2/internal/asm/Frame.java @@ -1155,7 +1155,8 @@ private static boolean merge( final SymbolTable symbolTable, final int sourceType, final int[] dstTypes, - final int dstIndex) { + final int dstIndex + ) { int dstType = dstTypes[dstIndex]; if (dstType == sourceType) { // If the types are equal, merge(sourceType, dstType) = dstType, so there is no change.