You're conflating "the API" with the source code that implements both the interface and the library routines.
What this case is about is if the API itself, the hierarchy of packages and classes, their names, their behaviors, and their relationships (object argument types, class and interface inheritance, exceptions thrown) is protected by copyright, or is an uncopyrightable "functional idea" under 17 USC 102(b): "In no case does copyright protection for an original work of authorship extend to any idea, procedure, process, system, method of operation, concept, principle, or discovery, regardless of the form in which it is described, explained, illustrated, or embodied in such work."
In a C library, the header file can be copyrighted, but replicating various parts (names, structures, argument and return types, constant values, etc) is not infringing.
In Java, because it was designed that way, there is almost no choice in how to represent an API.
Google did not "copy verbatim" the declarations from Oracle.