Skip to content

Latest commit

History

5 Commits

Folders and files

NameName
Last commit message
Last commit date

Repository files navigation

Java 5 API Dependencies

This repo contains a program to compute the reflexive transitive closure under API dependency of a collection of Java classes (and interfaces). One class's API is said to (directly) depend on another's if the former class's API mentions latter's, e.g., as a parameter type, a return type, a supertype, or an exception type. The reason this closure is important is that it represents the size of the API that is required to support the given collection of Java classes or interfaces: you cannot implement the given classes without implementing every other class in the closure.

In the Oracle v. Google trials in 2012 and 2016, Oracle contended that 170 declarations from 62 classes were sufficient to implement the Java language. These declarations are the ones that are specifically referred to in The the Java Language Specification (3d Ed., Addison-Wesley, 2005), which describes Java SE 5, better known as Java 5.

This contention is wrong on several counts. First of all, the specification directly mentions at least 64 classes, as shown in the table below. More seriously it ignores the fact that you can't implement an API without implementing its reflexive transitive closure under API dependency, as explained above (let's call this the implicit API).

Using the Api program in this repo, you can compute the implicit API of a given API. The JavaApiDependencies program uses the Api program to compute the implicit API of the API mentioned in the Java Language Specification (3d Ed). If you run this program under Java 5, you will find that it requires 2,381 methods, constructors, and fields, spread across 178 classes in 10 packages just to implement the Java language (never mind that that does not get you such basic libraries as java.io.PrintStream, which is required even for the basic "Hello World" program).

Here is a table of direct references to classes and interfaces in the Java Language Specification (3d Ed., Addison-Wesley, 2005). This table may not be complete, but it demonstrates that at least 64 classes (and interfaces) are mentioned in the JLS:

RowClass NameDescriptionSectionPage
1java.lang.ObjectThe root of the class hierarchy4.3.247
2java.lang.StringA character string4.3.348
3java.lang.BooleanWrapper classes for boolean5.1.787
4java.lang.ByteWrapper classes for byte5.1.787
5java.lang.CharacterWrapper classes for char5.1.787
6java.lang.ShortWrapper classes for short5.1.787
7java.lang.IntegerWrapper classes for int5.1.787
8java.lang.LongWrapper classes for long5.1.787
9java.lang.FloatWrapper classes for float5.1.787
10java.lang.DoubleWrapper classes for double5.1.787
11java.lang.VoidThe type of void.class15.8.2421
12java.lang.ThreadA thread of execution17553
13java.lang.ThreadGroupA group of threads11.3303
14java.lang.ClassThe runtime representation of a class4.3.248
15java.lang.ClassLoaderThe entity responsible for loading classes into the VM12.2312
16java.lang.RuntimeAn instantiable class that allows access the VM12.8331
17java.lang.SystemA non-instantiable class that allows access the VM17.5.4578
18java.lang.MathA non-instantiable class that provides various mathematical operations3.10.226
19java.lang.CloneableInterface implemented by objects that can be duplicated10.7292
20java.io.SerializableInterface implemented by objects that can be emitted to a byte stream10.7292
21java.lang.IterableAn object that can be iterated over with a for-each loop14.14.2387
22java.lang.EnumThe superclass of all enum types8.9251
23java.lang.annotation.AnnotationThe superinterface of all annotation types9.6272
24java.lang.annotation.TargetAnnotation type to indicate where an annotation is allowed9.6.1.1278
25java.lang.annotation.ElementTypeEnum to indicate where an annotation is allowed9.6.1.1278
26java.lang.annotation.RetentionAnnotation type to indicate how long an annotation is retained9.6.1.2278
27java.lang.annotation.RetentionPolicyEnum to indicate how long an annotation is retained9.6.1.2278
28java.lang.annotation.InheritedAnnotation to indicate that an annotation applies to subclasses9.6.1.3279
29java.lang.OverrideAnnotation to indicate that a method declaration overrides another9.6.1.4279
30java.lang.SuppressWarningsAnnotation to indicate that compiler warnings should be suppressed9.6.1.5280
31java.lang.DeprecatedAnnotation type used to indicate that an API element is obsolete9.6.1.6280
32java.lang.ThrowableThe root of the exception and error hierarchies11.5306
33java.lang.ExceptionThe root of the exception hierarchy11.2.3301
34java.lang.RuntimeExceptionThe root of the unchecked exception hierarchy11.2.5301
35java.lang.ErrorThe root of the error hierarchy11.2.4301
36java.lang.ArithmeticException(Self explanatory)4.2.337
37java.lang.IllegalArgumentException(Self explanatory)8.9252
38java.lang.ArrayIndexOutOfBoundsException(Self explanatory)10.4290
39java.lang.ArrayStoreException(Self explanatory)10.10294
40java.lang.ClassCastException(Self explanatory)15.5412
41java.lang.CloneNotSupportedException(Self explanatory)10.7292
42java.lang.IllegalMonitorStateException(Self explanatory)17.8580
43java.lang.InterruptedException(Self explanatory)17.8580
44java.lang.NegativeArraySizeException(Self explanatory)15.10.1432
45java.lang.NullPointerException(Self explanatory)15.12.4.4476
46java.lang.AbstractMethodError(Self explanatory)13.4.16352
47java.lang.AssertionError(Self explanatory)14.10376
48java.lang.ClassCircularityError(Self explanatory)12.2.1313
49java.lang.ClassFormatError(Self explanatory)12.2.1313
50java.lang.ExceptionInInitializerError(Self explanatory)12.4.2321
51java.lang.IncompatibleClassChangeError(Self explanatory)13.4.10349
52java.lang.InstantiationError(Self explanatory)12.3.3316
53java.lang.InternalError(Self explanatory)11.4304
54java.lang.LinkageError(Self explanatory)12.2.1313
55java.lang.NoClassDefFoundError(Self explanatory)12.2.1313
56java.lang.IllegalAccessError(Self explanatory)12.3.3315
57java.lang.NoSuchFieldError(Self explanatory)12.3.3316
58java.lang.NoSuchMethodError(Self explanatory)12.3.3316
59java.lang.OutOfMemoryError(Self explanatory)12.5313
60java.lang.InstantiationException(Self explanatory)13.4.1340
61java.lang.StackOverflowError(Self explanatory)15.12.4.5477
62java.lang.VerifyError(Self explanatory)12.3.1314
63java.lang.UnsatisfiedLinkError(Self explanatory)12.3.3316
64java.lang.VirtualMachineError(Self explanatory)11.5.2307

About

A list of direct references to classes and interfaces in the Java Language Specification (3d Ed.) and a program to compute the indirectly required classes and interfaces

Resources

Stars

17 stars

Watchers

3 watching

Forks

Releases

Packages

Contributors

Languages