diff --git a/src/org/rascalmpl/parser/gtd/stack/edge/EdgesSet.java b/src/org/rascalmpl/parser/gtd/stack/edge/EdgesSet.java index 0a16717c404..b778f6677a3 100644 --- a/src/org/rascalmpl/parser/gtd/stack/edge/EdgesSet.java +++ b/src/org/rascalmpl/parser/gtd/stack/edge/EdgesSet.java @@ -13,6 +13,8 @@ *******************************************************************************/ package org.rascalmpl.parser.gtd.stack.edge; +import java.util.Arrays; + import org.rascalmpl.parser.gtd.result.AbstractContainerNode; import org.rascalmpl.parser.gtd.stack.AbstractStackNode; import org.rascalmpl.parser.gtd.util.IntegerMap; @@ -48,10 +50,9 @@ public EdgesSet(int initialSize){ } private void enlarge(){ - AbstractStackNode
[] oldEdges = edges; - edges = (AbstractStackNode
[]) new AbstractStackNode[size << 1]; - System.arraycopy(oldEdges, 0, edges, 0, size); + edges = Arrays.copyOf(edges, size << 1, edges.getClass()); } + public void add(AbstractStackNode
edge){ while(size >= edges.length){ // While instead of if to enable the JIT to eliminate the bounds check on the edges array