The patent badge is an abbreviated version of the USPTO patent document. The patent badge does contain a link to the full patent document.
The patent badge is an abbreviated version of the USPTO patent document. The patent badge covers the following: Patent number, Date patent was issued, Date patent was filed, Title of the patent, Applicant, Inventor, Assignee, Attorney firm, Primary examiner, Assistant examiner, CPCs, and Abstract. The patent badge does contain a link to the full patent document (in Adobe Acrobat format, aka pdf). To download or print any patent click here.
Patent No.:
Date of Patent:
Feb. 03, 2004
Filed:
Aug. 13, 1999
Gilad Bracha, Los Altos, CA (US);
Sun Microsystems, Inc., Palo Alto, CA (US);
Abstract
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 resolved 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 a path stack is constructed. The path stack provides a listing of the class hierarchy between the target object and the resolved class. Once constructed, the path stack is used to determine which implementation of method m to invoke in response to the method invocation. Specifically, the resolved method m is initially set as the candidate method to invoke. Then a downward search is performed through the classes on the path stack. At each class on the path stack, a determination is made as to whether that class: (1) provides an implementation for the method m; (2) can access the resolved method; and (3) has declared the method m as public/protected. If so, then the proper implementation for method m to be invoked may be determined using standard method lookup. However, if a class satisfies only the first two criteria, then the method m for that class is made the new candidate method, and the process loops back to test the next class on the path stack. This loop continues until either a class is found which satisfies all three criteria, in which case standard method lookup is used to invoke the proper implementation for method m, or until all of the classes on the path stack have been tested, in which case the last detected candidate method is invoked.