Blog Post

Planet of the APIs: U.S. Supreme Court Rules Google’s Use of Java APIs in Android Is Fair Use


Today, Google’s Android operating system is everywhere. About 70% of the world’s mobile devices use Android. Phones, tablets, watches, smart TVs, home appliances and even some cars use Android. You may even be reading this article on an Android device.

Fifteen years ago, Android was nowhere. In order to become a successful operating system, Google needed software developers to commit to developing applications for Android. For a mobile operating system, the support of third party developers is a matter of life and death, as both the living (iOS and Android) and the dead (BlackBerry 10 and Windows Phone) will agree.

Google entered talks with Oracle, the owner of the Java platform, to license its Java Application Programming Interface (API) for use in Android. At the time, Java was one of the most popular programming languages in the world. With such widespread familiarity, Google hoped that by using the Java API, it could entice Java software developers to become Android software developers with little learning curve, since they could easily write apps for Android using the same tools that they used to write programs in Java.

However, Oracle and Google never reached an agreement. Google decided to copy the Java API into Android anyway. Oracle sued, alleging copyright infringement in the billions of Android devices.

On April 5, 2021, the Supreme Court of the United States released its decision in Google LLC v. Oracle America, Inc., holding that Google’s use of Oracle’s Java API was fair and did not violate copyright law. At its heart, the decision is one about promoting interoperability and constraining the monopolies that copyright grants to computer programs. In the Court’s view, copyright protects and encourages innovation. Android was the innovation: an advanced operating system that enabled the mass deployment of mobile devices. Java was the relic: a 90s era language for desktops and laptops whose API and licensing constrained Android’s creative destruction.

Background on APIs

The key to the dispute between Google and Oracle is what Google copied and what Google did not copy. Google copied Oracle’s “declaring code”, but not its “implementing code”. The declaring code defines a method (essentially, a computer program designed to be used within another computer program, such as a program to calculate the maximum of two numbers or to sort a list of names in alphabetical order), including its name, its parameters and its output. This definition is part of a general organization of similar methods, which are grouped into classes. The declaring code only defines what a method is called and requires: it does not actually state how the method works. In contrast, the implementing code is the code that actually executes or calculates what the method sets out to do.

The declaring code and implementing code come together to form an API. An API is a tool for developers to enable them to calculate or interact with an operating system, program or data set. Generally, an API exposes the declaring code for developers while keeping the implementing code secret. Developers can then use the available methods, as defined by the declaring code, without knowing exactly how they work (i.e. the implementing code).

As an example, consider Java’s API, which included the method “java.lang.Math.max”, which is a method that calculates the greatest value of two numbers:

Declaring Code

Implementing Code

   Package java.lang

   public class Math

   public static int max (int x, int y)


            if (x>y), return x

            else return y



A computer programmer can use the API’s declaring code to know that “java.lang.Math.max” is a method that requires two numbers as input parameters. If the programmer uses this method in the programmer’s own program, the API will calculate the maximum of the two numbers, and that result can be used in the programmer’s program. The programmer does not need to know the implementing code—the programmer does not care how the maximum of two numbers is calculated, only that the result is in fact the maximum of the two numbers.

A programmer could use the “java.lang.Math.max” method in a wide variety of applications, such as calculating the maximum tax liability under two different scenarios or the profit of a stock option.

Google’s Use of Oracle’s Java API in Android

An experienced programmer familiar with Java would likely know many basic methods like “java.lang.Math.max” by heart. Google copied the declaring code, effectively copying the names and corresponding parameters of Java’s methods, so that a programmer writing an application for Android could write it as if it were an application for Java, using the same pre-written methods available as part of the Java API.

However, Google did not copy the Java API implementing code. In other words, the methods in Google’s Android API had the same names as the methods in the Java API, and they returned the same output or otherwise achieved the same results, but they did not calculate or execute using the same code. In fact, for some methods, they may have used very different methods for calculating the same output.

In total, Google copied 37 packages of Java methods from its API, comprising 11,500 lines of code (about 0.4% of the entire Java API, including implementing code).

Prior to the U.S. Supreme Court’s decision, U.S. copyright law clearly protected implementing code. However, it was ambiguous whether copyright protection would extend to declaring code. Google did not copy any of Oracle’s implementing code. Rather, Google copied the organization, names and parameters of Oracle’s methods.

Supreme Court’s Analysis of Copyright Infringement of APIs

The case before the Supreme Court had two questions. First, was declaring code subject to copyright? And second, was Google’s use of Oracle’s declaring code fair use?

The majority declined to answer the first question on the grounds that it was not necessary to settle the dispute. The majority only considered whether Google’s use was fair, assuming that the declaring code was subject to copyright.

The majority held that while computer programs are explicitly covered by copyright, their copyright must be understood differently. Copyright protection varies depending on the nature of the work. True artistic works, works of fiction and other pure creative creations have stronger protection than works that serve a more utilitarian function (such as news broadcasts, non-fiction and computer programs). The courts are mindful that expanding protection too far with utilitarian works may create too much economic power and stifle innovation. Fair use acts as a balance against the absolute nature of a copyright owner’s rights “to keep a copyright monopoly within its lawful bounds.”

The majority considered the nature of the declaring code and found its type of creativity (largely for organization and user-friendliness) very different from that used in writing the implementing code (which requires decisions about how the method executes). The majority held that declaring code was far from the core of copyright protection. Further, it considered Google’s use of Oracle’s declaring code transformative, since Google used it to introduce more programmers to Android.

Google’s copying was not to take advantage of the creativity or beauty of the Java API: its value was purely functional. Familiarity with Java’s API creates a switching cost for programmers: it is easier to continue with the language that they know than to learn a new API to develop for Android. By copying Oracle’s declaring code, Google enabled programmers to create further creative works for Android. These creative works for Android are the creation of their respective Android developers, not Oracle. Oracle cannot credibly claim that the way it organized and named its methods was a critical factor in the success of applications for Android.

In its decision, the majority describes the Java API’s declaring code as a lock, a metaphor for the constraint its copyright imposed. If the Court allowed Oracle to enforce the copyright in the declaring code, it would hold back the creative destruction of the tech industry. Copyright would not be protecting Oracle’s work so much as creating economic barriers to developers switching to a new innovative platform for their creative work. Google unlocked this barrier by copying the declaring code. Developers could more easily transfer to a new platform that would drive further innovation.

In dissent, Justice Thomas held that declaring code was a type of “computer program”, which is explicitly subject to copyright law. He held that fair use could not apply here: if one of the largest companies in the world copies extensive amounts of declaring code from a competitor, resulting in the copier becoming the dominant player while the creator’s platform collapses in value, could declaring code ever be enforceable?

If Google is permitted to copy declaring code into Android, which generates billions of dollars in revenue every year for Google, the majority’s decision effectively means that copying declaring code alone for almost any purposes would fall under fair use.

Approach in Canadian Law

The originality requirement for copyright and fair dealing provisions under Canadian law differ from U.S. law, and as a result, the result under Canadian copyright law is less clear.

The case that declaring code is subject to copyright is stronger in Canada. Unlike the U.S., which requires creativity for copyright protection, Canada only requires an exercise of skill and judgment. In CCH, the Supreme Court of Canada held that a “topical index” would be subject to copyright, since there is skill and judgment in deciding how to organize and succinctly summarize the contents.1 By analogy, this supports that the naming, structure and organization of computer code would also be subject to copyright. However, it is not clear if the work in preparing a topical index is the same as the work in writing declaring code.

The fair dealing analysis under Canadian law is also unclear. Unlike U.S. law, which has an open set of fair use purposes, Canadian law requires a specific enumerated fair dealing purpose. Arguably, commercial use of declaring code to assist developers in learning to develop for a new platform could be fair dealing for “research” purposes. In the SOCAN v. Bell Canada decision, the Supreme Court of Canada conducted a fair dealing analysis on a copyright infringement claim against iTunes and similar services over song previews not based on iTunes’ perspective, but that of its users.2 From a developer’s perspective, the use of declaring code to assist in the developer’s understanding and transition to a new platform to create further works may be considered a fair dealing of declaring code for similar reasons to that of the U.S. Supreme Court.

In addition, Canada has other explicit exemptions from copyright infringement to enable interoperability of computer programs (such as s. 30.61), which may be applicable depending on the circumstances.


The decision in Google v. Oracle is a constraint on the enforceability of copyright in computer programs in the United States. While acknowledging the potential value of the organization and naming conventions of an API, the U.S. Supreme Court prefers encouraging competition between platforms. In its view, a copyright owner should not be able to use copyright to put up artificial barriers to inhibit developers from switching to a new platform. The ruling is a warning to established players that the courts will not look favourably on those seeking to use copyright to block a new competitors’ cross-compatibility.


1 CCH Canadian Ltd. v. Law Society of Upper Canada, 2004 SCC 13 at para 32.

2 Society of Composers, Authors and Music Publishers of Canada v. Bell Canada, 2012 SCC 36 at para 30.