Browse Prior Art Database

Resolving Multiple Inheritance in an Object-Oriented Runtime

IP.com Disclosure Number: IPCOM000246124D
Publication Date: 2016-May-10
Document File: 4 page(s) / 59K

Publishing Venue

The IP.com Prior Art Database

Abstract

Disclosed is a solution to address issues that occur in the runtime of an object-oriented language. The novel method allows the programmer to query a class for a list of associated methods in order to determine the full list of the methods, abstract and concrete, declared by a class and its superclass and interface hierarchies.

This text was extracted from a PDF file.
This is the abbreviated version, containing approximately 45% of the total text.

Page 01 of 4

Resolving Multiple Inheritance in an Object

Resolving Multiple Inheritance in an Object-

The disclosed solution re-implements the Java* implementation of Class.getMethods() in order to:

Handle interface default methods introduced in Java 8 Convert from an O(N^2) algorithm to linear run time Rework the algorithm for storing the list of methods and use explicit rules to determine overriding Cache results to eliminate redundant work

Avoid processing methods which are known to be overridden


Resolve multiple inheritance in an object-oriented runtime

An object-oriented language such as Java represents data as objects containing the data per se, plus methods (a.k.a., functions, subroutines, procedures, etc. in other languages) which operate on the data. Classes declare (i.e., indicate the existence of) or define (i.e., provide an embodiment of) methods. For the convenience of the programmer, objects are derived from classes, which are effectively templates for new object creation. Further, a specific class may be based on a more general superclass , which it extends, and zero or more interfaces, which it implements. A class may inherit the declarations and definitions of methods from the associated superclass and interfaces, thus allowing the programmer to re-use method declarations and embodiments from the same.

A declared but undefined method is considered abstract , while a defined method is considered concrete . Note that in the Java language as of Java 8, interfaces may contain both abstract and concrete (or default) methods. A class containing definitions for all declared methods is considered concrete; otherwise, it is considered abstract. Methods that are in more specific classes or interfaces may override declarations or definitions in more general superclasses or interfaces.

The novel contribution is a method to allow the programmer to query a class for a list of associated methods ; referred to as reflection . Reflection must determine the full list of the methods , abstract and concrete, declared by a class and its superclass and interface hierarchies. In some cases, multiple declarations of the same method from various classes and interfaces are returned ,

while some methods may not be returned because of overriding. It is necessary to traverse the superclass and interface hierarchy to obtain the full lists and determine any instances of overriding.

Algorithm

A class may have multiple methods with the same name but distinct argument types (i.e., signatures ) which are considered distinct

1

--Oriented Runtime

Oriented Runtime


Page 02 of 4

methods by the runtime; however, for clarity, this discussion considers methods with the same name but distinct signatures as having distinct names.

A class contains a list of methods called the vtable , which is a complete list of all the method names available in the class. However, there may be alternate declarations of these methods in the implemented interfaces...