Remove obsolete "ObjArray" class

Depending on context, replace this venerable class with either ArrayList
or ArrayDeque.
This commit is contained in:
Greg Brail 2024-08-12 15:24:37 -07:00
Родитель 0bd385de27
Коммит f3c64ee29f
13 изменённых файлов: 68 добавлений и 461 удалений

Просмотреть файл

@ -12,8 +12,10 @@ import java.io.InputStream;
import java.io.InputStreamReader;
import java.net.URL;
import java.nio.charset.StandardCharsets;
import java.util.ArrayList;
import java.util.Collections;
import java.util.HashMap;
import java.util.List;
import java.util.Map;
import org.mozilla.javascript.Callable;
import org.mozilla.javascript.Context;
@ -22,7 +24,6 @@ import org.mozilla.javascript.ContextFactory;
import org.mozilla.javascript.ImporterTopLevel;
import org.mozilla.javascript.Kit;
import org.mozilla.javascript.NativeCall;
import org.mozilla.javascript.ObjArray;
import org.mozilla.javascript.ScriptRuntime;
import org.mozilla.javascript.Scriptable;
import org.mozilla.javascript.ScriptableObject;
@ -388,7 +389,7 @@ public class Dim {
/** Returns an array of all functions in the given script. */
private static DebuggableScript[] getAllFunctions(DebuggableScript function) {
ObjArray functions = new ObjArray();
ArrayList<DebuggableScript> functions = new ArrayList<>();
collectFunctions_r(function, functions);
DebuggableScript[] result = new DebuggableScript[functions.size()];
functions.toArray(result);
@ -396,7 +397,8 @@ public class Dim {
}
/** Helper function for {@link #getAllFunctions(DebuggableScript)}. */
private static void collectFunctions_r(DebuggableScript function, ObjArray array) {
private static void collectFunctions_r(
DebuggableScript function, List<DebuggableScript> array) {
array.add(function);
for (int i = 0; i != function.getFunctionCount(); ++i) {
collectFunctions_r(function.getFunction(i), array);
@ -912,7 +914,7 @@ public class Dim {
public static class ContextData {
/** The stack frames. */
private ObjArray frameStack = new ObjArray();
private ArrayList<StackFrame> frameStack = new ArrayList<>();
/** Whether the debugger should break at the next line in this context. */
private boolean breakNextLine;
@ -947,12 +949,12 @@ public class Dim {
/** Pushes a stack frame on to the stack. */
private void pushFrame(StackFrame frame) {
frameStack.push(frame);
frameStack.add(frame);
}
/** Pops a stack frame from the stack. */
private void popFrame() {
frameStack.pop();
frameStack.remove(frameStack.size() - 1);
}
}

Просмотреть файл

@ -9,9 +9,9 @@ package org.mozilla.classfile;
import java.io.IOException;
import java.io.InputStream;
import java.io.OutputStream;
import java.util.ArrayList;
import java.util.Arrays;
import org.mozilla.javascript.Kit;
import org.mozilla.javascript.ObjArray;
import org.mozilla.javascript.UintMap;
/**
@ -211,7 +211,7 @@ public class ClassFileWriter {
int descriptorIndex = itsConstantPool.addUtf8(type);
int[] chunk = {nameIndex, descriptorIndex, startPC, register};
if (itsVarDescriptors == null) {
itsVarDescriptors = new ObjArray();
itsVarDescriptors = new ArrayList<>();
}
itsVarDescriptors.add(chunk);
}
@ -852,7 +852,7 @@ public class ClassFileWriter {
BootstrapEntry bsmEntry = new BootstrapEntry(bsm, bsmArgs);
if (itsBootstrapMethods == null) {
itsBootstrapMethods = new ObjArray();
itsBootstrapMethods = new ArrayList<>();
}
int bootstrapIndex = itsBootstrapMethods.indexOf(bsmEntry);
if (bootstrapIndex == -1) {
@ -4487,9 +4487,9 @@ public class ClassFileWriter {
private int itsMaxStack;
private int itsMaxLocals;
private ObjArray itsMethods = new ObjArray();
private ObjArray itsFields = new ObjArray();
private ObjArray itsInterfaces = new ObjArray();
private ArrayList<ClassFileMethod> itsMethods = new ArrayList<>();
private ArrayList<ClassFileField> itsFields = new ArrayList<>();
private ArrayList<Short> itsInterfaces = new ArrayList<>();
private int itsFlags;
private int itsThisClassIndex;
@ -4504,8 +4504,8 @@ public class ClassFileWriter {
private static final int MIN_FIXUP_TABLE_SIZE = 40;
private long[] itsFixupTable;
private int itsFixupTableTop;
private ObjArray itsVarDescriptors;
private ObjArray itsBootstrapMethods;
private ArrayList<int[]> itsVarDescriptors;
private ArrayList<BootstrapEntry> itsBootstrapMethods;
private int itsBootstrapMethodsLength = 0;
private char[] tmpCharBuffer = new char[64];

Просмотреть файл

@ -7,6 +7,7 @@
package org.mozilla.javascript;
import java.math.BigInteger;
import java.util.ArrayList;
import java.util.Arrays;
import java.util.List;
import org.mozilla.javascript.ast.AstNode;
@ -47,7 +48,7 @@ class CodeGenerator extends Icode {
// fixupTable[i] = (label_index << 32) | fixup_site
private long[] fixupTable;
private int fixupTableTop;
private ObjArray literalIds = new ObjArray();
private ArrayList<Object> literalIds = new ArrayList<>();
private int exceptionTableTop;

Просмотреть файл

@ -19,6 +19,7 @@ import java.io.Writer;
import java.lang.reflect.InvocationTargetException;
import java.lang.reflect.Method;
import java.util.ArrayDeque;
import java.util.Deque;
import java.util.EnumSet;
import java.util.HashMap;
import java.util.HashSet;
@ -2712,7 +2713,7 @@ public class Context implements Closeable {
// For the interpreter to store information about previous invocations
// interpreter invocations
ObjArray previousInterpreterInvocations;
Deque<Object> previousInterpreterInvocations;
// For instruction counting (interpreter only)
int instructionCount;

Просмотреть файл

@ -8,6 +8,8 @@
package org.mozilla.javascript;
import java.util.ArrayList;
/**
* Class ImporterTopLevel
*
@ -129,7 +131,9 @@ public class ImporterTopLevel extends TopLevel {
synchronized (scope) {
if (scope instanceof ScriptableObject) {
ScriptableObject so = (ScriptableObject) scope;
ObjArray importedPackages = (ObjArray) so.getAssociatedValue(AKEY);
@SuppressWarnings("unchecked")
ArrayList<Object> importedPackages =
(ArrayList<Object>) so.getAssociatedValue(AKEY);
if (importedPackages != null) {
return importedPackages.toArray();
}
@ -194,9 +198,10 @@ public class ImporterTopLevel extends TopLevel {
return;
}
synchronized (scope) {
ObjArray importedPackages = (ObjArray) scope.getAssociatedValue(AKEY);
@SuppressWarnings("unchecked")
ArrayList<Object> importedPackages = (ArrayList<Object>) scope.getAssociatedValue(AKEY);
if (importedPackages == null) {
importedPackages = new ObjArray();
importedPackages = new ArrayList<>();
scope.associateValue(AKEY, importedPackages);
}
for (int j = 0; j != importedPackages.size(); j++) {

Просмотреть файл

@ -11,6 +11,7 @@ import static org.mozilla.javascript.UniqueTag.DOUBLE_MARK;
import java.io.PrintStream;
import java.io.Serializable;
import java.math.BigInteger;
import java.util.ArrayDeque;
import java.util.ArrayList;
import java.util.Arrays;
import java.util.List;
@ -1179,7 +1180,7 @@ public final class Interpreter extends Icode implements Evaluator {
// save the top frame from the previous interpretLoop
// invocation on the stack
if (cx.previousInterpreterInvocations == null) {
cx.previousInterpreterInvocations = new ObjArray();
cx.previousInterpreterInvocations = new ArrayDeque<>();
}
cx.previousInterpreterInvocations.push(cx.lastInterpreterFrame);
}

Просмотреть файл

@ -420,6 +420,7 @@ class JavaMembers {
}
}
@SuppressWarnings("unchecked")
private void reflect(
Context cx, Scriptable scope, boolean includeProtected, boolean includePrivate) {
// We reflect methods first, because we want overloaded field/method
@ -436,14 +437,14 @@ class JavaMembers {
if (value == null) {
ht.put(name, method);
} else {
ObjArray overloadedMethods;
if (value instanceof ObjArray) {
overloadedMethods = (ObjArray) value;
ArrayList<Object> overloadedMethods;
if (value instanceof ArrayList) {
overloadedMethods = (ArrayList<Object>) value;
} else {
if (!(value instanceof Method)) Kit.codeBug();
// value should be instance of Method as at this stage
// staticMembers and members can only contain methods
overloadedMethods = new ObjArray();
overloadedMethods = new ArrayList<>();
overloadedMethods.add(value);
ht.put(name, overloadedMethods);
}
@ -463,7 +464,7 @@ class JavaMembers {
methodBoxes = new MemberBox[1];
methodBoxes[0] = new MemberBox((Method) value);
} else {
ObjArray overloadedMethods = (ObjArray) value;
ArrayList<Object> overloadedMethods = (ArrayList<Object>) value;
int N = overloadedMethods.size();
if (N < 2) Kit.codeBug();
methodBoxes = new MemberBox[N];

Просмотреть файл

@ -6,7 +6,9 @@
package org.mozilla.javascript;
import java.util.ArrayDeque;
import java.util.ArrayList;
import java.util.Deque;
import java.util.List;
import org.mozilla.javascript.ast.FunctionNode;
import org.mozilla.javascript.ast.Jump;
@ -43,8 +45,8 @@ public class NodeTransformer {
}
private void transformCompilationUnit(ScriptNode tree, boolean inStrictMode) {
loops = new ObjArray();
loopEnds = new ObjArray();
loops = new ArrayDeque<>();
loopEnds = new ArrayDeque<>();
// to save against upchecks if no finally blocks are used.
hasFinally = false;
@ -162,8 +164,8 @@ public class NodeTransformer {
*/
if (!hasFinally) break; // skip the whole mess.
Node unwindBlock = null;
for (int i = loops.size() - 1; i >= 0; i--) {
Node n = (Node) loops.get(i);
// Iterate from the top of the stack (most recently inserted) and down
for (Node n : loops) {
int elemtype = n.getType();
if (elemtype == Token.TRY || elemtype == Token.WITH) {
Node unwind;
@ -208,15 +210,14 @@ public class NodeTransformer {
Jump jumpStatement = jump.getJumpStatement();
if (jumpStatement == null) Kit.codeBug();
for (int i = loops.size(); ; ) {
if (i == 0) {
// Parser/IRFactory ensure that break/continue
// always has a jump statement associated with it
// which should be found
throw Kit.codeBug();
}
--i;
Node n = (Node) loops.get(i);
if (loops.isEmpty()) {
// Parser/IRFactory ensure that break/continue
// always has a jump statement associated with it
// which should be found
throw Kit.codeBug();
}
// Iterate from the top of the stack (most recently inserted) and down
for (Node n : loops) {
if (n == jumpStatement) {
break;
}
@ -549,7 +550,7 @@ public class NodeTransformer {
return replacement;
}
private ObjArray loops;
private ObjArray loopEnds;
private Deque<Node> loops;
private Deque<Node> loopEnds;
private boolean hasFinally;
}

Просмотреть файл

@ -1,408 +0,0 @@
/* -*- Mode: java; tab-width: 8; indent-tabs-mode: nil; c-basic-offset: 4 -*-
*
* This Source Code Form is subject to the terms of the Mozilla Public
* License, v. 2.0. If a copy of the MPL was not distributed with this
* file, You can obtain one at http://mozilla.org/MPL/2.0/. */
package org.mozilla.javascript;
import java.io.IOException;
import java.io.ObjectInputStream;
import java.io.ObjectOutputStream;
import java.io.Serializable;
/**
* Implementation of resizable array with focus on minimizing memory usage by storing few initial
* array elements in object fields. Can also be used as a stack.
*/
public class ObjArray implements Serializable {
private static final long serialVersionUID = 4174889037736658296L;
public ObjArray() {}
public final boolean isSealed() {
return sealed;
}
public final void seal() {
sealed = true;
}
public final boolean isEmpty() {
return size == 0;
}
public final int size() {
return size;
}
public final void setSize(int newSize) {
if (newSize < 0) throw new IllegalArgumentException();
if (sealed) throw onSeledMutation();
int N = size;
if (newSize < N) {
for (int i = newSize; i != N; ++i) {
setImpl(i, null);
}
} else if (newSize > N) {
if (newSize > FIELDS_STORE_SIZE) {
ensureCapacity(newSize);
}
}
size = newSize;
}
public final Object get(int index) {
if (!(0 <= index && index < size)) throw onInvalidIndex(index, size);
return getImpl(index);
}
public final void set(int index, Object value) {
if (!(0 <= index && index < size)) throw onInvalidIndex(index, size);
if (sealed) throw onSeledMutation();
setImpl(index, value);
}
private Object getImpl(int index) {
switch (index) {
case 0:
return f0;
case 1:
return f1;
case 2:
return f2;
case 3:
return f3;
case 4:
return f4;
}
return data[index - FIELDS_STORE_SIZE];
}
private void setImpl(int index, Object value) {
switch (index) {
case 0:
f0 = value;
break;
case 1:
f1 = value;
break;
case 2:
f2 = value;
break;
case 3:
f3 = value;
break;
case 4:
f4 = value;
break;
default:
data[index - FIELDS_STORE_SIZE] = value;
}
}
public int indexOf(Object obj) {
int N = size;
for (int i = 0; i != N; ++i) {
Object current = getImpl(i);
if (current == obj || (current != null && current.equals(obj))) {
return i;
}
}
return -1;
}
public int lastIndexOf(Object obj) {
for (int i = size; i != 0; ) {
--i;
Object current = getImpl(i);
if (current == obj || (current != null && current.equals(obj))) {
return i;
}
}
return -1;
}
public final Object peek() {
int N = size;
if (N == 0) throw onEmptyStackTopRead();
return getImpl(N - 1);
}
public final Object pop() {
if (sealed) throw onSeledMutation();
int N = size;
--N;
Object top;
switch (N) {
case -1:
throw onEmptyStackTopRead();
case 0:
top = f0;
f0 = null;
break;
case 1:
top = f1;
f1 = null;
break;
case 2:
top = f2;
f2 = null;
break;
case 3:
top = f3;
f3 = null;
break;
case 4:
top = f4;
f4 = null;
break;
default:
top = data[N - FIELDS_STORE_SIZE];
data[N - FIELDS_STORE_SIZE] = null;
}
size = N;
return top;
}
public final void push(Object value) {
add(value);
}
public final void add(Object value) {
if (sealed) throw onSeledMutation();
int N = size;
if (N >= FIELDS_STORE_SIZE) {
ensureCapacity(N + 1);
}
size = N + 1;
setImpl(N, value);
}
public final void add(int index, Object value) {
int N = size;
if (!(0 <= index && index <= N)) throw onInvalidIndex(index, N + 1);
if (sealed) throw onSeledMutation();
Object tmp;
switch (index) {
case 0:
if (N == 0) {
f0 = value;
break;
}
tmp = f0;
f0 = value;
value = tmp;
/* fall through */ case 1:
if (N == 1) {
f1 = value;
break;
}
tmp = f1;
f1 = value;
value = tmp;
/* fall through */ case 2:
if (N == 2) {
f2 = value;
break;
}
tmp = f2;
f2 = value;
value = tmp;
/* fall through */ case 3:
if (N == 3) {
f3 = value;
break;
}
tmp = f3;
f3 = value;
value = tmp;
/* fall through */ case 4:
if (N == 4) {
f4 = value;
break;
}
tmp = f4;
f4 = value;
value = tmp;
index = FIELDS_STORE_SIZE;
/* fall through */ default:
ensureCapacity(N + 1);
if (index != N) {
System.arraycopy(
data,
index - FIELDS_STORE_SIZE,
data,
index - FIELDS_STORE_SIZE + 1,
N - index);
}
data[index - FIELDS_STORE_SIZE] = value;
}
size = N + 1;
}
public final void remove(int index) {
int N = size;
if (!(0 <= index && index < N)) throw onInvalidIndex(index, N);
if (sealed) throw onSeledMutation();
--N;
switch (index) {
case 0:
if (N == 0) {
f0 = null;
break;
}
f0 = f1;
/* fall through */ case 1:
if (N == 1) {
f1 = null;
break;
}
f1 = f2;
/* fall through */ case 2:
if (N == 2) {
f2 = null;
break;
}
f2 = f3;
/* fall through */ case 3:
if (N == 3) {
f3 = null;
break;
}
f3 = f4;
/* fall through */ case 4:
if (N == 4) {
f4 = null;
break;
}
f4 = data[0];
index = FIELDS_STORE_SIZE;
/* fall through */ default:
if (index != N) {
System.arraycopy(
data,
index - FIELDS_STORE_SIZE + 1,
data,
index - FIELDS_STORE_SIZE,
N - index);
}
data[N - FIELDS_STORE_SIZE] = null;
}
size = N;
}
public final void clear() {
if (sealed) throw onSeledMutation();
int N = size;
for (int i = 0; i != N; ++i) {
setImpl(i, null);
}
size = 0;
}
public final Object[] toArray() {
Object[] array = new Object[size];
toArray(array, 0);
return array;
}
public final void toArray(Object[] array) {
toArray(array, 0);
}
public final void toArray(Object[] array, int offset) {
int N = size;
switch (N) {
default:
System.arraycopy(data, 0, array, offset + FIELDS_STORE_SIZE, N - FIELDS_STORE_SIZE);
/* fall through */ case 5:
array[offset + 4] = f4;
/* fall through */ case 4:
array[offset + 3] = f3;
/* fall through */ case 3:
array[offset + 2] = f2;
/* fall through */ case 2:
array[offset + 1] = f1;
/* fall through */ case 1:
array[offset + 0] = f0;
/* fall through */ case 0:
break;
}
}
private void ensureCapacity(int minimalCapacity) {
int required = minimalCapacity - FIELDS_STORE_SIZE;
if (required <= 0) throw new IllegalArgumentException();
if (data == null) {
int alloc = FIELDS_STORE_SIZE * 2;
if (alloc < required) {
alloc = required;
}
data = new Object[alloc];
} else {
int alloc = data.length;
if (alloc < required) {
if (alloc <= FIELDS_STORE_SIZE) {
alloc = FIELDS_STORE_SIZE * 2;
} else {
alloc *= 2;
}
if (alloc < required) {
alloc = required;
}
Object[] tmp = new Object[alloc];
if (size > FIELDS_STORE_SIZE) {
System.arraycopy(data, 0, tmp, 0, size - FIELDS_STORE_SIZE);
}
data = tmp;
}
}
}
private static RuntimeException onInvalidIndex(int index, int upperBound) {
// \u2209 is "NOT ELEMENT OF"
String msg = index + " \u2209 [0, " + upperBound + ')';
throw new IndexOutOfBoundsException(msg);
}
private static RuntimeException onEmptyStackTopRead() {
throw new RuntimeException("Empty stack");
}
private static RuntimeException onSeledMutation() {
throw new IllegalStateException("Attempt to modify sealed array");
}
private void writeObject(ObjectOutputStream os) throws IOException {
os.defaultWriteObject();
int N = size;
for (int i = 0; i != N; ++i) {
Object obj = getImpl(i);
os.writeObject(obj);
}
}
private void readObject(ObjectInputStream is) throws IOException, ClassNotFoundException {
is.defaultReadObject(); // It reads size
int N = size;
if (N > FIELDS_STORE_SIZE) {
data = new Object[N - FIELDS_STORE_SIZE];
}
for (int i = 0; i != N; ++i) {
Object obj = is.readObject();
setImpl(i, obj);
}
}
// Number of data elements
private int size;
private boolean sealed;
private static final int FIELDS_STORE_SIZE = 5;
private transient Object f0, f1, f2, f3, f4;
private transient Object[] data;
}

Просмотреть файл

@ -6,11 +6,11 @@ package org.mozilla.javascript.optimizer;
import java.io.PrintWriter;
import java.io.StringWriter;
import java.util.ArrayList;
import java.util.BitSet;
import java.util.HashMap;
import java.util.Map;
import org.mozilla.javascript.Node;
import org.mozilla.javascript.ObjArray;
import org.mozilla.javascript.ObjToIntMap;
import org.mozilla.javascript.Token;
import org.mozilla.javascript.ast.Jump;
@ -114,7 +114,7 @@ class Block {
private static Block[] buildBlocks(Node[] statementNodes) {
// a mapping from each target node to the block it begins
Map<Node, FatBlock> theTargetBlocks = new HashMap<>();
ObjArray theBlocks = new ObjArray();
ArrayList<FatBlock> theBlocks = new ArrayList<>();
// there's a block that starts at index 0
int beginNodeIndex = 0;

Просмотреть файл

@ -14,6 +14,7 @@ import static org.mozilla.classfile.ClassFileWriter.ACC_STATIC;
import static org.mozilla.classfile.ClassFileWriter.ACC_VOLATILE;
import java.lang.reflect.Constructor;
import java.util.ArrayList;
import java.util.HashMap;
import java.util.List;
import java.util.Map;
@ -26,7 +27,6 @@ import org.mozilla.javascript.Function;
import org.mozilla.javascript.GeneratedClassLoader;
import org.mozilla.javascript.Kit;
import org.mozilla.javascript.NativeFunction;
import org.mozilla.javascript.ObjArray;
import org.mozilla.javascript.ObjToIntMap;
import org.mozilla.javascript.RhinoException;
import org.mozilla.javascript.Script;
@ -205,7 +205,7 @@ public class Codegen implements Evaluator {
}
if (possibleDirectCalls != null) {
directCallTargets = new ObjArray();
directCallTargets = new ArrayList<>();
}
OptTransformer ot = new OptTransformer(possibleDirectCalls, directCallTargets);
@ -225,7 +225,7 @@ public class Codegen implements Evaluator {
}
private void initScriptNodesData(ScriptNode scriptOrFn) {
ObjArray x = new ObjArray();
ArrayList<ScriptNode> x = new ArrayList<>();
collectScriptNodes_r(scriptOrFn, x);
int count = x.size();
@ -238,7 +238,7 @@ public class Codegen implements Evaluator {
}
}
private static void collectScriptNodes_r(ScriptNode n, ObjArray x) {
private static void collectScriptNodes_r(ScriptNode n, List<ScriptNode> x) {
x.add(n);
int nestedCount = n.getFunctionCount();
for (int i = 0; i != nestedCount; ++i) {
@ -1322,7 +1322,7 @@ public class Codegen implements Evaluator {
private CompilerEnvirons compilerEnv;
private ObjArray directCallTargets;
private List<OptFunctionNode> directCallTargets;
ScriptNode[] scriptOrFnNodes;
private ObjToIntMap scriptOrFnIndexes;

Просмотреть файл

@ -4,11 +4,11 @@
package org.mozilla.javascript.optimizer;
import java.util.List;
import java.util.Map;
import org.mozilla.javascript.Kit;
import org.mozilla.javascript.Node;
import org.mozilla.javascript.NodeTransformer;
import org.mozilla.javascript.ObjArray;
import org.mozilla.javascript.Token;
import org.mozilla.javascript.ast.ScriptNode;
@ -20,7 +20,9 @@ import org.mozilla.javascript.ast.ScriptNode;
*/
class OptTransformer extends NodeTransformer {
OptTransformer(Map<String, OptFunctionNode> possibleDirectCalls, ObjArray directCallTargets) {
OptTransformer(
Map<String, OptFunctionNode> possibleDirectCalls,
List<OptFunctionNode> directCallTargets) {
this.possibleDirectCalls = possibleDirectCalls;
this.directCallTargets = directCallTargets;
}
@ -100,5 +102,5 @@ class OptTransformer extends NodeTransformer {
}
private Map<String, OptFunctionNode> possibleDirectCalls;
private ObjArray directCallTargets;
private List<OptFunctionNode> directCallTargets;
}

Просмотреть файл

@ -4,8 +4,9 @@
package org.mozilla.javascript.optimizer;
import java.util.ArrayList;
import java.util.List;
import org.mozilla.javascript.Node;
import org.mozilla.javascript.ObjArray;
import org.mozilla.javascript.Token;
import org.mozilla.javascript.ast.ScriptNode;
@ -32,7 +33,7 @@ class Optimizer {
inDirectCallFunction = theFunction.isTargetOfDirectCall();
this.theFunction = theFunction;
ObjArray statementsArray = new ObjArray();
ArrayList<Node> statementsArray = new ArrayList<>();
buildStatementList_r(theFunction.fnode, statementsArray);
Node[] theStatementNodes = new Node[statementsArray.size()];
statementsArray.toArray(theStatementNodes);
@ -419,7 +420,7 @@ class Optimizer {
}
}
private static void buildStatementList_r(Node node, ObjArray statements) {
private static void buildStatementList_r(Node node, List<Node> statements) {
int type = node.getType();
if (type == Token.BLOCK
|| type == Token.LOCAL_BLOCK