test/jdk/jshell/MethodsTest.java
Print this page
@@ -21,10 +21,11 @@
* questions.
*/
/*
* @test
+ * @bug 8080357
* @summary Tests for EvaluationState.methods
* @build KullaTesting TestingInputStream ExpectedDiagnostic
* @run testng MethodsTest
*/
@@ -34,11 +35,10 @@
import jdk.jshell.MethodSnippet;
import jdk.jshell.Snippet.Status;
import org.testng.annotations.Test;
import static jdk.jshell.Snippet.Status.*;
-import static jdk.jshell.Snippet.SubKind.*;
@Test
public class MethodsTest extends KullaTesting {
public void noMethods() {
@@ -72,10 +72,19 @@
assertMethodDeclSnippet(m2, "f", "(A.Bar)void", RECOVERABLE_NOT_DEFINED, 1, 0);
assertDrop(m1, ste(m1, RECOVERABLE_NOT_DEFINED, DROPPED, false, null));
assertMethodDeclSnippet(m1, "f", "(Bar)void", DROPPED, 1, 0);
}
+ // 8080357
+ public void testNonReplUnresolved() {
+ // internal case
+ assertEval("class CCC {}", added(VALID));
+ assertEval("void f1() { CCC.xxxx(); }", added(RECOVERABLE_DEFINED));
+ // external case, not recoverable
+ assertDeclareFail("void f2() { System.xxxx(); }", "compiler.err.cant.resolve.location.args");
+ }
+
public void methods() {
assertEval("int x() { return 10; }");
assertEval("String y() { return null; }");
assertEval("long z() { return 0; }");
assertMethods(method("()int", "x"), method("()String", "y"), method("()long", "z"));