am 24a8fe8: AI 148797: Back-port the new version of the Grid.java from D

Merge commit '24a8fe82dffacdfe2fab9d007b2a6538b5f511bc' into donut

* commit '24a8fe82dffacdfe2fab9d007b2a6538b5f511bc':
  AI 148797: Back-port the new version of the Grid.java from Donut.