--- antlr3-3.5.3/tool/src/main/antlr3/org/antlr/grammar/v3/CodeGenTreeWalker.g 2023-09-15 17:54:38.044172037 +0200 +++ antlr3-3.5.3/tool/src/main/antlr3/org/antlr/grammar/v3/CodeGenTreeWalker.g 2023-09-15 17:58:10.758972706 +0200 @@ -56,6 +56,7 @@ import java.util.HashSet; import java.util.Set; import java.util.Collection; +import java.util.Collections; import org.antlr.runtime.BitSet; import org.antlr.runtime.DFA; import org.stringtemplate.v4.ST; @@ -284,6 +285,7 @@ } labels.add( label ); } + Collections.sort(labels); // ensure reproducible order return labels; }