Bibliographic Details
| Title: |
SYSTEM AND METHOD FOR SUPPORTING COMPATIBILITY CHECKING FOR LAMBDA EXPRESSION |
| Document Number: |
20190129699 |
| Publication Date: |
May 2, 2019 |
| Appl. No: |
16/234533 |
| Application Filed: |
December 27, 2018 |
| Abstract: |
A system and method can support compatibility checking in a programming language environment. The programming language environment can check whether a target type associated with an expression in the programming language environment is functional, wherein the target type is functional when it has exactly one method meeting one or more criteria that define that method as relevant in a counting system. Then, the programming language environment can derive a function descriptor from the target type, which is context-dependent. Furthermore, the programming language environment can type-check the expression with the function descriptor associated with the target type. |
| Assignees: |
Oracle International Corporation (Redwood Shores, CA, US) |
| Claim: |
1. One or more non-transitory machine-readable media storing instructions which, when executed by one or more processors, cause: identifying a first instruction, in a set of code, that associates a particular expression with a first target type in a first context, wherein the particular expression indicates a function and the particular expression is not a member of any class defined by the set of code; performing, during a compilation of the set of code, a first compatibility check on the particular expression and the first target type; determining, during the compilation of the set of code, that the particular expression is compatible with the first target type; identifying a second instruction, in the set of code, that associates the particular expression with a second target type in a second context, wherein the particular expression indicates the function and the particular expression is not a member of any class defined by the set of code, and wherein the first target type and the second target type are different; performing, during the compilation of the set of code, a second compatibility check on the particular expression and the second target type; determining, during the compilation of the set of code, that the particular expression is compatible with the second target type. |
| Claim: |
2. The one or more non-transitory machine-readable media of claim 1, wherein performing, the first compatibility check on the particular expression and the first target type comprises: determining that the first target type is a functional interface including a single abstract method; determining a function descriptor associated with the first target type based on at least one of: a method type of the single abstract method, a parameter type of the single abstract method, a return type of the single abstract method, and an exception type of the single abstract method; type-checking the particular expression with the function descriptor associated with the first target type to determine compatibility between the particular expression and the first target type. |
| Claim: |
3. The one or more non-transitory machine-readable media of claim 2, wherein: the particular expression specifies a parameter; type-checking the particular expression with the function descriptor associated with the first target type to determine compatibility between the particular expression and the first target type comprises: type-checking the parameter specified by the particular expression with the parameter type of the single abstract method associated with the first target type. |
| Claim: |
4. The one or more non-transitory machine-readable media of claim 2, wherein: type-checking the particular expression with the function descriptor associated with the first target type to determine compatibility between the particular expression and the first target type comprises: type-checking a particular return type associated with the function indicated by the particular expression with the return type of the single abstract method associated with the first target type. |
| Claim: |
5. The one or more non-transitory machine-readable media of claim 2, wherein: type-checking the particular expression with the function descriptor associated with the first target type to determine compatibility between the particular expression and the first target type comprises: type-checking a particular exception type associated with the function indicated by the particular expression with the exception type of the single abstract method associated with the first target type. |
| Claim: |
6. The one or more non-transitory machine-readable media of claim 1, wherein: the first instruction assigns the particular expression to an object of the first target type. |
| Claim: |
7. The one or more non-transitory machine-readable media of claim 1, wherein: the first instruction specifies the particular expression as a value for a parameter inputted to a particular method; and a parameter type of the parameter inputted to the particular method is the first target type. |
| Claim: |
8. The one or more non-transitory machine-readable media of claim 1, wherein: the first instruction casts the particular expression as the first target type. |
| Claim: |
9. The one or more non-transitory machine-readable media of claim 1, wherein: the first context comprises an assignment context; and the second context comprises at least one of: an invocation context and a casting context. |
| Claim: |
10. The one or more non-transitory machine-readable media of claim 1, wherein performing, the first compatibility check on the particular expression and the first target type comprises: inferring a natural parameterized type from a wildcard-parameterized functional interface type associated with the first target type; and type-checking the particular expression with the natural parameterized type. |
| Claim: |
11. A system, comprising: at least one device including a hardware processor; and the system being configured to perform operations comprising: identifying a first instruction, in a set of code, that associates a particular expression with a first target type in a first context, wherein the particular expression indicates a function and the particular expression is not a member of any class defined by the set of code; performing, during a compilation of the set of code, a first compatibility check on the particular expression and the first target type; determining, during the compilation of the set of code, that the particular expression is compatible with the first target type; identifying a second instruction, in the set of code, that associates the particular expression with a second target type in a second context, wherein the particular expression indicates the function and the particular expression is not a member of any class defined by the set of code, and wherein the first target type and the second target type are different; performing, during the compilation of the set of code, a second compatibility check on the particular expression and the second target type; determining, during the compilation of the set of code, that the particular expression is compatible with the second target type. |
| Claim: |
12. The system of claim 11, wherein performing, the first compatibility check on the particular expression and the first target type comprises: determining that the first target type is a functional interface including a single abstract method; determining a function descriptor associated with the first target type based on at least one of: a method type of the single abstract method, a parameter type of the single abstract method, a return type of the single abstract method, and an exception type of the single abstract method; type-checking the particular expression with the function descriptor associated with the first target type to determine compatibility between the particular expression and the first target type. |
| Claim: |
13. The system of claim 12, wherein: the particular expression specifies a parameter; type-checking the particular expression with the function descriptor associated with the first target type to determine compatibility between the particular expression and the first target type comprises: type-checking the parameter specified by the particular expression with the parameter type of the single abstract method associated with the first target type. |
| Claim: |
14. The system of claim 12, wherein: type-checking the particular expression with the function descriptor associated with the first target type to determine compatibility between the particular expression and the first target type comprises: type-checking a particular return type associated with the function indicated by the particular expression with the return type of the single abstract method associated with the first target type. |
| Claim: |
15. The system of claim 12, wherein: type-checking the particular expression with the function descriptor associated with the first target type to determine compatibility between the particular expression and the first target type comprises: type-checking a particular exception type associated with the function indicated by the particular expression with the exception type of the single abstract method associated with the first target type. |
| Claim: |
16. The system of claim 11, wherein: the first instruction assigns the particular expression to an object of the first target type. |
| Claim: |
17. The system of claim 11, wherein: the first instruction specifies the particular expression as a value for a parameter inputted to a particular method; and a parameter type of the parameter inputted to the particular method is the first target type. |
| Claim: |
18. The system of claim 11, wherein: the first instruction casts the particular expression as the first target type. |
| Claim: |
19. The system of claim 11, wherein: the first context comprises an assignment context; and the second context comprises at least one of: an invocation context and a casting context. |
| Claim: |
20. A method, comprising: identifying a first instruction, in a set of code, that associates a particular expression with a first target type in a first context, wherein the particular expression indicates a function and the particular expression is not a member of any class defined by the set of code; performing, during a compilation of the set of code, a first compatibility check on the particular expression and the first target type; determining, during the compilation of the set of code, that the particular expression is compatible with the first target type; identifying a second instruction, in the set of code, that associates the particular expression with a second target type in a second context, wherein the particular expression indicates the function and the particular expression is not a member of any class defined by the set of code, and wherein the first target type and the second target type are different; performing, during the compilation of the set of code, a second compatibility check on the particular expression and the second target type; determining, during the compilation of the set of code, that the particular expression is compatible with the second target type; wherein the method is performed by at least one device including a hardware processor. |
| Current International Class: |
06; 06 |
| Accession Number: |
edspap.20190129699 |
| Database: |
USPTO Patent Applications |