Skip to content
This repository has been archived by the owner on Mar 19, 2024. It is now read-only.
/ jdk22 Public archive

Commit

Permalink
8322532: JShell : Unnamed variable issue
Browse files Browse the repository at this point in the history
Reviewed-by: asotona
Backport-of: f0cfd361bd6a98dc1192dab2116fdd3904f130f8
  • Loading branch information
lahodaj committed Jan 8, 2024
1 parent 2110300 commit 29ed387
Show file tree
Hide file tree
Showing 2 changed files with 8 additions and 2 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -190,7 +190,7 @@ static enum TK {
EOF(TokenKind.EOF, 0), //
ERROR(TokenKind.ERROR, XERRO), //
IDENTIFIER(TokenKind.IDENTIFIER, XEXPR1|XDECL1|XTERM), //
UNDERSCORE(TokenKind.UNDERSCORE, XDECL1), // _
UNDERSCORE(TokenKind.UNDERSCORE, XDECL1|XEXPR), // _
CLASS(TokenKind.CLASS, XEXPR|XDECL1|XBRACESNEEDED), // class decl (MAPPED: DOTCLASS)
MONKEYS_AT(TokenKind.MONKEYS_AT, XEXPR|XDECL1), // @
IMPORT(TokenKind.IMPORT, XDECL1|XSTART), // import -- consider declaration
Expand Down
8 changes: 7 additions & 1 deletion test/langtools/jdk/jshell/VariablesTest.java
Original file line number Diff line number Diff line change
Expand Up @@ -23,7 +23,7 @@

/*
* @test
* @bug 8144903 8177466 8191842 8211694 8213725 8239536 8257236 8252409 8294431
* @bug 8144903 8177466 8191842 8211694 8213725 8239536 8257236 8252409 8294431 8322532
* @summary Tests for EvaluationState.variables
* @library /tools/lib
* @modules jdk.compiler/com.sun.tools.javac.api
Expand Down Expand Up @@ -621,4 +621,10 @@ public void varAnonymousClassAndStaticField() { //JDK-8294431
assertEval("var obj = new Object() { public static final String msg = \"hello\"; };");
}

public void underscoreAsLambdaParameter() { //JDK-8322532
assertAnalyze("Func f = _ -> 0; int i;",
"Func f = _ -> 0;",
" int i;", true);
}

}

1 comment on commit 29ed387

@openjdk-notifier
Copy link

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Please sign in to comment.