java - _ (underscore) is a reserved keyword -
i've replaced s
in following lambda expression _
:
s -> integer.parseint(s)
eclipse compiler says:
'_' should not used identifier, since reserved keyword source level 1.8 on.
i haven't found explanation in jls §3.9 lexical structure / keywords.
the place jls §15.27.1. lambda parameters
it compile-time error if lambda parameter has name _ (that is, single underscore character).
the use of variable name _ in context discouraged. future versions of java programming language may reserve name keyword and/or give special semantics.
so eclipse message misleading, same message used both cases, when error generated lambda parameter or when warning generated other _
identifier.
Comments
Post a Comment