Skip to content

Commit

Permalink
8319532: jshell - Non-sealed declarations sometimes break a snippet e…
Browse files Browse the repository at this point in the history
…valuation

Reviewed-by: asotona
  • Loading branch information
lahodaj committed Nov 7, 2023
1 parent 4a0ad46 commit 45e68ae
Show file tree
Hide file tree
Showing 2 changed files with 10 additions and 3 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -306,7 +306,7 @@ static enum TK {
AMPAMP(TokenKind.AMPAMP, XEXPR, true), // &&
BARBAR(TokenKind.BARBAR, XEXPR, true), // ||
PLUS(TokenKind.PLUS, XEXPR1, true), // +
SUB(TokenKind.SUB, XEXPR1, true), // -
SUB(TokenKind.SUB, XEXPR1 | XDECL, true), // -
SLASH(TokenKind.SLASH, XEXPR, true), // /
BAR(TokenKind.BAR, XEXPR, true), // |
CARET(TokenKind.CARET, XEXPR, true), // ^
Expand Down
11 changes: 9 additions & 2 deletions test/langtools/jdk/jshell/ClassesTest.java
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
/*
* Copyright (c) 2015, 2022, Oracle and/or its affiliates. All rights reserved.
* Copyright (c) 2015, 2023, Oracle and/or its affiliates. All rights reserved.
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
*
* This code is free software; you can redistribute it and/or modify it
Expand All @@ -23,7 +23,7 @@

/*
* @test
* @bug 8145239 8129559 8080354 8189248 8010319 8246353 8247456 8282160 8292755
* @bug 8145239 8129559 8080354 8189248 8010319 8246353 8247456 8282160 8292755 8319532
* @summary Tests for EvaluationState.classes
* @build KullaTesting TestingInputStream ExpectedDiagnostic
* @run testng ClassesTest
Expand Down Expand Up @@ -374,4 +374,11 @@ public void run() {
""");
}

public void testNonSealed() {
assertAnalyze("non-sealed class C extends B {}int i;",
"non-sealed class C extends B {}",
"int i;",
true);
}

}

1 comment on commit 45e68ae

@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.