--- a/test/langtools/jdk/jshell/MethodsTest.java Fri Oct 20 15:39:50 2017 -0700
+++ b/test/langtools/jdk/jshell/MethodsTest.java Fri Oct 20 19:08:25 2017 -0700
@@ -1,5 +1,5 @@
/*
- * Copyright (c) 2015, 2016, Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 2015, 2017, 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 8080357 8167643
+ * @bug 8080357 8167643 8187359
* @summary Tests for EvaluationState.methods
* @build KullaTesting TestingInputStream ExpectedDiagnostic
* @run testng MethodsTest
@@ -230,6 +230,24 @@
assertActiveKeys();
}
+ public void objectMethodNamedMethodsErrors() {
+ assertDeclareFail("boolean equals(double d1, double d2) { return d1 == d2; }",
+ new ExpectedDiagnostic("jdk.eval.error.object.method", 8, 14, 8, -1, -1, Diagnostic.Kind.ERROR));
+ assertNumberOfActiveMethods(0);
+ assertActiveKeys();
+
+ assertDeclareFail("void wait() { }",
+ new ExpectedDiagnostic("jdk.eval.error.object.method", 14, 18, 14, -1, -1, Diagnostic.Kind.ERROR));
+ assertNumberOfActiveMethods(0);
+ assertActiveKeys();
+
+ assertDeclareFail(" String toString() throws NullPointerException{ }",
+ new ExpectedDiagnostic("jdk.eval.error.object.method", 11, 19, 11, -1, -1, Diagnostic.Kind.ERROR));
+ assertNumberOfActiveMethods(0);
+ assertActiveKeys();
+
+ }
+
public void methodsAccessModifierIgnored() {
Snippet f = methodKey(assertEval("public String f() {return null;}",