This is a relatively simple refactoring in JavaCompiler to facilitate limited multi-threaded javac.
Currently, the JavaCompiler analyze/flow/desugar/generate methods use (immutable) javac Lists to pass work between the stages. This fix changes them to use java.util.Queue instead, with their inherent limited mutability. (remove from front, append to end).
The impl of Queue is provided by upgrading ListBuffer, which had close to the correct semantics, and just required a few more methods to implement the remainder of the Queue interface.
There were two minor issues to address.
1) ListBuffer previously had an remove method that was incompatible with Queue, but although it was public, it was only used exactly once, in ListBuffer.next. As such, the two were folded together.
2) Queues prefer non-null elements. javac does not typically use null in Lists anyway, so this is not an issue, but adding a null-check in ListBuffer.add revealed a single instance in Enter where null was inapprorpiately added to a list. This was fixed at the one call site in Enter, by ignoring null when it occurs. In context, this is the correct and safe thing to do.
The bug is noreg-cleanup as the changes are not externally visible. The changes have been tested with the regression tests (locally) and by building JDK and using that build as well to run the compiler regression tests.