You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@commons.apache.org by gg...@apache.org on 2022/11/19 14:07:48 UTC

[commons-bcel] 02/02: Simplify array allocation

This is an automated email from the ASF dual-hosted git repository.

ggregory pushed a commit to branch master
in repository https://gitbox.apache.org/repos/asf/commons-bcel.git

commit 3d2f8ea8513b3e7b680adda90cc9519dd0c2b84b
Author: Gary Gregory <ga...@gmail.com>
AuthorDate: Sat Nov 19 09:07:42 2022 -0500

    Simplify array allocation
---
 src/main/java/org/apache/bcel/classfile/StackMapEntry.java | 6 ++----
 1 file changed, 2 insertions(+), 4 deletions(-)

diff --git a/src/main/java/org/apache/bcel/classfile/StackMapEntry.java b/src/main/java/org/apache/bcel/classfile/StackMapEntry.java
index 35179075..c23d27c7 100644
--- a/src/main/java/org/apache/bcel/classfile/StackMapEntry.java
+++ b/src/main/java/org/apache/bcel/classfile/StackMapEntry.java
@@ -57,12 +57,10 @@ public final class StackMapEntry implements Node, Cloneable {
             byteCodeOffset = frameType - Const.SAME_FRAME;
         } else if (frameType >= Const.SAME_LOCALS_1_STACK_ITEM_FRAME && frameType <= Const.SAME_LOCALS_1_STACK_ITEM_FRAME_MAX) {
             byteCodeOffset = frameType - Const.SAME_LOCALS_1_STACK_ITEM_FRAME;
-            typesOfStackItems = new StackMapType[1];
-            typesOfStackItems[0] = new StackMapType(dataInput, constantPool);
+            typesOfStackItems = new StackMapType[] { new StackMapType(dataInput, constantPool) };
         } else if (frameType == Const.SAME_LOCALS_1_STACK_ITEM_FRAME_EXTENDED) {
             byteCodeOffset = dataInput.readShort();
-            typesOfStackItems = new StackMapType[1];
-            typesOfStackItems[0] = new StackMapType(dataInput, constantPool);
+            typesOfStackItems = new StackMapType[] { new StackMapType(dataInput, constantPool) };
         } else if (frameType >= Const.CHOP_FRAME && frameType <= Const.CHOP_FRAME_MAX) {
             byteCodeOffset = dataInput.readShort();
         } else if (frameType == Const.SAME_FRAME_EXTENDED) {