Address code review comments: replace Stack with ArrayList.

1 job for 317851-fix-analyzer-stack-overflow in 6 minutes and 53 seconds (queued for 2 seconds)