Method and apparatus for performing method lookup in the presence of modularity constructs to support transitive method override
AssigneeSun Microsystems, Inc.
InventorGilad Bracha
Life of this patent
Estimating the term…
Loading patent…
AssigneeSun Microsystems, Inc.
InventorGilad Bracha
Estimating the term…
A method lookup mechanism is disclosed which not only enforces accessibility constraints imposed by modularity constructs but also enables transitive method override. According to one embodiment, when a method m is invoked on a target object, the method m in a resolved class is checked to determine whether it has been declared as public/protected. If so, then standard method lookup may be used to determine the proper implementation of method m to invoke. However, if the resolved method is not declared as public/protected, then the class of the target object is searched for an implementation of the method m. If no implementation is found, then a superclass of the target object class is searched for an implementation. This process repeats until an implementation is found or until the resolved class is reached. If an implementation for method m is found in a class (referred to as the current class) other than the resolved class, then a determination is made as to whether the current class can access the method m in the resolved class. The current class can access method m of the resolved class if the current class is in the same package P as the resolved class, or if an intervening class has “publicized” the method m of the resolved class. If either one of these conditions is met, then the implementation for method m in the current class is invoked. In effect, the method m of the current class is allowed to override the method m of the resolved class. Performing method lookup in this manner makes it possible to both enforce accessibility constraints imposed by modularity constructs and enable transitive method override.
A computer implemented method for performing dynamic method dispatch, comprising:
An apparatus for performing dynamic method dispatch, comprising:
A computer readable medium having stored thereon instructions which, when executed by one or more processors, cause the one or more processors to perform dynamic method dispatch, said computer readable medium comprising:
Dependencies are inferred from the claim text.