It was a grave blunder for Google not to buy Sun. Besides Java, they would have gotten MySQL, ZFS and some hardware that would all be useful at Google.
Imagine Google the cloud operator having to tread carefully not to get into political infighting with Google the SPARC manufacturer. Google had very good reasons to stay clear of those recipes for disaster.
They could have still done a "Motorola" with Sun, but that's hindsight speaking.