@@ -0,0 +1,2203 @@
+/* This file is part of SableCC (http://sablecc.org/).%0A * %0A * See the NOTICE file distributed with this work for copyright information.%0A *%0A * Licensed under the Apache License, Version 2.0 (the %22License%22);%0A * you may not use this file except in compliance with the License.%0A * You may obtain a copy of the License at%0A *%0A *     http://www.apache.org/licenses/LICENSE-2.0%0A *%0A * Unless required by applicable law or agreed to in writing, software%0A * distributed under the License is distributed on an %22AS IS%22 BASIS,%0A * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.%0A * See the License for the specific language governing permissions and%0A * limitations under the License.%0A */%0A%0Apackage org.sablecc.sablecc.alphabet;%0A%0Aimport java.util.Collection;%0Aimport java.util.LinkedList;%0A%0Apublic class BugMerge %7B%0A%0A    @SuppressWarnings(%22unused%22)%0A    public static void main(%0A            String%5B%5D args) %7B%0A%0A        Collection%3CInterval%3CInteger%3E%3E intervalsInt = new LinkedList%3CInterval%3CInteger%3E%3E();%0A        Symbol%3CInteger%3E firstSymbol;%0A%0A        Symbol%3CInteger%3E secondSymbol;%0A%0A        Alphabet%3CInteger%3E completeAlphabet;%0A        Alphabet%3CInteger%3E firstPartAlphabet;%0A        Alphabet%3CInteger%3E secondPartAlphabet;%0A        AlphabetMergeResult%3CInteger%3E mergeResult;%0A%0A        intervalsInt.add(new Interval%3CInteger%3E(0, 5, Realms.getInteger()));%0A        intervalsInt.add(new Interval%3CInteger%3E(10, 15, Realms.getInteger()));%0A        intervalsInt.add(new Interval%3CInteger%3E(20, 25, Realms.getInteger()));%0A        firstPartAlphabet = new Alphabet%3CInteger%3E(new Symbol%3CInteger%3E(%0A                intervalsInt));%0A%0A        intervalsInt.clear();%0A        intervalsInt.add(new Interval%3CInteger%3E(30, 35, Realms.getInteger()));%0A        intervalsInt.add(new Interval%3CInteger%3E(40, 45, Realms.getInteger()));%0A        intervalsInt.add(new Interval%3CInteger%3E(50, 55, Realms.getInteger()));%0A        secondPartAlphabet = new Alphabet%3CInteger%3E(new Symbol%3CInteger%3E(%0A                intervalsInt));%0A%0A        System.out.println(firstPartAlphabet + %22%5Cn%22 + secondPartAlphabet);%0A%0A        // Line that cause the bug.%0A        mergeResult = firstPartAlphabet.mergeWith(secondPartAlphabet);%0A        System.out.print(mergeResult);%0A%0A    %7D%0A%0A%7D%0A

Add regression test.