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

Resolve should use generated diagnostic factories

XMLWordPrintable

      Resolution errors (ResolveError class in Resolve.java) provide a method (getDiagnostic) to obtain a diagnostic describing the error. This method is very flexible, and allows for creating both a toplevel error diagnostic and a nested fragment diagnostic. The correct behavior depends on the fact that compiler.properties will define "overloaded" keys like:
      ```
      compiler.err.prob.found.req
      ```
      and
      ```
      compiler.misc.prob.found.req
      ```
      This programmatic behavior is hard to capture with the more inflexible diagnostic framework which allows creation of diagnostic keys by using static factories in a generated class, as a way to minimize errors when passing wrong type/number of diagnostic parameters.

      For this reason, many instances of diagnostic creation in Resolve are still not using the more robust diagnostic key factories.

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

              Created:
              Updated: