Not all API s are protected, but when you copy a widget API for the express purpose of compatibility, it has to be compatible. Think aftermarket parts, they have to follow the interface for the purpose of compatibility.
What was the purpose of copying chunks of Java? It is not compatible...
Java was copied, sort of, to leverage familiarity with the language. That is not for the purpose of compatibility.
All Google had to do was to follow the GPL. Why not follow the GPL?