Uploaded image for project: 'JDK'
  1. JDK
  2. JDK-8068995

Cleanup method reference lookup code

XMLWordPrintable

    • b47
    • Not verified

        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.

              mcimadamore Maurizio Cimadamore
              mcimadamore Maurizio Cimadamore
              Votes:
              0 Vote for this issue
              Watchers:
              3 Start watching this issue

                Created:
                Updated:
                Resolved: