Currently, when lambda names (for non-serializable lambdas) are generated, the exact name depends on the number of (non-serializable) lamdbas generated so far by the current javac instance. The reason is that the counter for lambda names is not per-file, but per-javac instance. For example, consider:
public class L1 {
private Runnable r = () -> { };
}
public class L2 {
private Runnable r = () -> { };
}
doing:
javac L1.java L2.java
will make L1's lambda use lambda$new$0 and L2's lambda$new$1, while:
javac L2.java L1.java
will lead to the opposite name assignment.
The problem seems to be simple: LambdaToMethod.LambdaAnalyzerPreprocessor.lambdaCount is not reset before starting with a new top-level.