-
Enhancement
-
Resolution: Fixed
-
P4
-
9
-
b47
-
Not verified
Issue | Fix Version | Assignee | Priority | Status | Resolution | Resolved In Build |
---|---|---|---|---|---|---|
JDK-8085322 | emb-9 | Maurizio Cimadamore | P4 | Resolved | Fixed | team |
Following the latest twists in method reference lookup spec (see JDK-8026231), the code for implementing method reference lookups has become a bit convoluted; there are some issues with the current code:
* error reporting doesn't follow usual paths for resolution diagnostic - this sometimes leads to duplicate diagnostics
* there are missed opportunities for code reuse: the core logic of a method reference lookup is unaltered during a full lookup vs. an arity-based lookup (used in structural checks). The only thing that changes is, given the two partial lookup results, how a solution is selected.
* the diagnostics generated by the compiler are somehow untidy; sometimes the compiler generates method reference specific messages - in other cases it falls back to 'non-static method cannot be referenced from static context'-like messages.
* diagnostics generated during method reference resolution might vary depending on whether the lookup occurs in a method vs. assignment context.
All this potentially leads to code that is hard to maintain and such that the quality of the error messages perceived by the user is somehow erratic.
* error reporting doesn't follow usual paths for resolution diagnostic - this sometimes leads to duplicate diagnostics
* there are missed opportunities for code reuse: the core logic of a method reference lookup is unaltered during a full lookup vs. an arity-based lookup (used in structural checks). The only thing that changes is, given the two partial lookup results, how a solution is selected.
* the diagnostics generated by the compiler are somehow untidy; sometimes the compiler generates method reference specific messages - in other cases it falls back to 'non-static method cannot be referenced from static context'-like messages.
* diagnostics generated during method reference resolution might vary depending on whether the lookup occurs in a method vs. assignment context.
All this potentially leads to code that is hard to maintain and such that the quality of the error messages perceived by the user is somehow erratic.
- backported by
-
JDK-8085322 Cleanup method reference lookup code
- Resolved
- duplicates
-
JDK-8081400 Inappropriate compiler error when creating Comparator with method reference
- Closed
- relates to
-
JDK-8026231 Look at 'static' flag when checking method references
- Closed