RFR: 8302344: Compiler Implementation for Unnamed patterns and variables (Preview) [v4]

Aggelos Biboudis abimpoudis at openjdk.org
Tue May 2 08:20:19 UTC 2023


On Fri, 28 Apr 2023 08:59:35 GMT, Maurizio Cimadamore <mcimadamore at openjdk.org> wrote:

>> Aggelos Biboudis has updated the pull request incrementally with one additional commit since the last revision:
>> 
>>   Update test files with JDK 8307007 bug id
>
> src/jdk.compiler/share/classes/com/sun/tools/javac/parser/JavacParser.java line 3660:
> 
>> 3658:         int pos = token.pos;
>> 3659:         Name name;
>> 3660:         if (allowThisIdent ||
> 
> I note that now the error re. underscore on lambda is no longer given even if preview features are disabled. But I guess that's ok. (instead you will probably get an error that unnamed parameters are a preview feature)

Yes, indeed.


~/dev/jdk unnamed !1 > javac Unnamed.java
Unnamed.java:61: error: unnamed variables are a preview feature and are disabled by default.
        TwoParams p1 = (_, _) -> {};
                        ^
  (use --enable-preview to enable unnamed variables)

-------------

PR Review Comment: https://git.openjdk.org/jdk/pull/13528#discussion_r1182230562


More information about the kulla-dev mailing list