My understanding is that a subset and a superset would both be okay. I am more certain about subset than superset -- I am not sure that something like Microsoft's J++ would pass muster either. But a subset I think would still be permissible under fair use so long as the goal was to achieve compatibility.
Oracle's argument is that Dalvik is not the JVM, nor is it an attempt to be the JVM. It's a competitor to the JVM that uses parts of the Java API. I don't know if they're right, and I don't know that being right should mean that Google has to pay them money or what have you as a result. I do think that people are overstating the effect that a ruling that Google infringed on Oracle's copyrights would have.
They're claiming that any of the above would require an API license, and that a license (requiring GPL for the implementation) was granted only to the latter, so a subset would be unauthorized infringement.
Does Mono infringe on Microsoft's .NET API because it has always lagged behind the official .NET API, even though the goal of the project is to achieve compatibility?
How would that work with (e.g.) beta versions of something that was aiming for 100% compatibility, but had not achieved it yet? Are you prevented from releasing until you reach 100% compatibility?
Does this prevent MS-style "embrace, extend, extinguish?"