One embodiment of the present invention provides a system that facilitates
finding terminal classes in a collection of programming language classes,
wherein a terminal class is a class that is not extended by any other
class. The system operates by receiving a collection of classes. The
system then adds the classes to a map of the collection of classes,
wherein keys to each class in the map include each class' superclass and
the interfaces each class directly implements. Next, the system analyzes
a given class in the map of the collection of classes to determine if the
given class extends any other class in the collection of classes. If so,
the system removes this extended class from the collection of classes.
Finally, the system repeats the steps of analyzing classes and removing
extended classes until all remaining classes in the collection of classes
are terminal classes.