Improve error message for '_' used as a lambda parameter name

XMLWordPrintable

    • Type: Bug
    • Resolution: Fixed
    • Priority: P3
    • 8
    • Affects Version/s: 8
    • Component/s: tools
    • b112

      The parameter name '_' is prohibited by the parser for lambdas. This is correct behavior, but the error message is very unhelpful:

      UnderscoreName.java:7: error: <identifier> expected
        java.util.function.Function<String,String> f = _ -> "x";
                                                       ^
      UnderscoreName.java:7: error: illegal start of expression
        java.util.function.Function<String,String> f = _ -> "x";
                                                         ^
      UnderscoreName.java:7: error: ';' expected
        java.util.function.Function<String,String> f = _ -> "x";
                                                           ^
      A better approach would be to parse the name as is, and provide a descriptive error message in a later phase.

            Assignee:
            Vicente Arturo Romero Zaldivar
            Reporter:
            Dan Smith
            Votes:
            0 Vote for this issue
            Watchers:
            5 Start watching this issue

              Created:
              Updated:
              Resolved: