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

Improve error message when lambda is missing a return value

    Details

    • Subcomponent:
    • CPU:
      generic
    • OS:
      generic

      Description

      A DESCRIPTION OF THE REQUEST :
      Currently if a user provides a lambda that does not have a return value when one is expected gets this kind of error message:

        required: java.util.function.Function<? super java.util.List<Key, Value>,? extends U>
        found: (currencyP[...]}); }
        reason: cannot infer type-variable(s) U
          (argument mismatch; bad return type in lambda expression
            missing return value)

      You are essentially burying the lead. Please don't make users read through multiple lines of ugly Generics code when they don't have to.

      The error message should read something along the lines of:

      Expected a return value but none was found.
      required : X
      found: Y
      reason: Z

      JUSTIFICATION :
      Improve readability, ease of debugging


        Attachments

          Activity

            People

            • Assignee:
              vromero Vicente Arturo Romero Zaldivar
              Reporter:
              webbuggrp Webbug Group
            • Votes:
              0 Vote for this issue
              Watchers:
              4 Start watching this issue

              Dates

              • Created:
                Updated:
                Resolved: