Method and apparatus for preforming method lookup in the presence of modularity constructs to support transitive method override
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. I
Interactive Citation Constellation Global Citation Ranking
Interactive SVG Citation Constellation renders in Rust/WebAssembly. Prior art cited: 8 · Forward citations: 13.
Claims (2 — 1 Independent, 1 Dependent)
- Claim 1Independent Claim
A computer implemented method for performing dynamic method dispatch, comprising: detecting an invocation of a method m on a target object of class X, said invocation having associated therewith a resolved method and a resolved class, wherein said resolved method is private to a particular modularity construct; determining a class hierarchy between said resolved class and said class X, said class hierarchy comprising one or more intervening classes; determining whether at least one of said intervening classes has publicized said resolved method; and in response to a determination that an inter
- Claim 2Depends on #1
The method of claim 1 , wherein performing standard method lookup
Technical Overview & Description
Full multi-page specification text is archived at the issuing office. Read complete official specification ↗
Cited By — Indexed Forward Citations (13 of 13 total)
References Cited — Backward Prior Art (8)
Non-Patent Literature (4)
- Cardelli et al., "Modula-3 Report (revised)," digital Systems Research Center, Nov. 1, 1989.
- First Edition of JLS entitled "The Java Language Specification", by James Gosling, Bill Joy & Guy Steele, dated Oct. 3, 2002, (40 pgs), http://java.sun.com/docs/books/jls/first_edition/html/index.html.
- James Gosling et al , Java Language Specification, Sun Microsystem, Inc, 1996.*
- The Java Specification(first edition), James Gosling, 1996, Addison-Wesley, Chapter 15.*