8319532: jshell - Non-sealed declarations sometimes break a snippet evaluation

Reviewed-by: asotona
This commit is contained in:
Jan Lahoda 2023-11-07 15:27:48 +00:00
parent 4a0ad462ab
commit 45e68ae207
2 changed files with 10 additions and 3 deletions
src/jdk.jshell/share/classes/jdk/jshell
test/langtools/jdk/jshell

@ -306,7 +306,7 @@ class CompletenessAnalyzer {
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), // ^

@ -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
@ -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
@ -374,4 +374,11 @@ public class ClassesTest extends KullaTesting {
""");
}
public void testNonSealed() {
assertAnalyze("non-sealed class C extends B {}int i;",
"non-sealed class C extends B {}",
"int i;",
true);
}
}