This commit is contained in:
Lana Steuck 2016-02-04 16:50:04 -08:00
commit 97fbcf6bfb
4 changed files with 29 additions and 3 deletions

View File

@ -520,7 +520,7 @@
<package-root>${root}/build/bootstrap/jdk.jshell/gensrc</package-root>
<package-root>${root}/../jdk/src/jdk.internal.le/share/classes</package-root>
<package-root>${root}/../jdk/src/jdk.jdi/share/classes</package-root>
<classpath mode="compile">${root}/build/java.compiler/classes:${root}/build/jdk.compiler/classes:${root}/build/jdk.internal.le/aux:${root}/build/jdk.jdi/aux:${root}/build/jdk.internal.le/classes:${root}/build/jdk.jdi/classes</classpath>
<classpath mode="compile">${root}/build/java.compiler/classes:${root}/build/jdk.compiler/classes:${root}/build/jdk.internal.le/classes:${root}/build/jdk.jdi/classes</classpath>
<built-to>${root}/build/jdk.jshell/classes</built-to>
<source-level>1.8</source-level>
</compilation-unit>

View File

@ -31,6 +31,7 @@ import java.util.Locale;
import javax.tools.Diagnostic;
import javax.tools.JavaFileObject;
import jdk.jshell.MemoryFileManager.SourceMemoryJavaFileObject;
import static jdk.internal.jshell.debug.InternalDebugControl.DBG_GEN;
/**
*
@ -182,6 +183,22 @@ final class OuterWrap implements GeneralWrap {
return null;
}
@Override
boolean isResolutionError() {
if (!super.isResolutionError()) {
return false;
}
for (String line : diag.getMessage(PARSED_LOCALE).split("\\r?\\n")) {
if (line.trim().startsWith("location:")) {
if (!line.contains(REPL_CLASS_PREFIX)) {
// Resolution error must occur within a REPL class or it is not resolvable
return false;
}
}
}
return true;
}
@Override
public String toString() {
return "WrappedDiagnostic(" + getMessage(null) + ":" + getPosition() + ")";

View File

@ -23,6 +23,7 @@
/*
* @test
* @bug 8081431
* @summary Test of JShell#drop().
* @build KullaTesting TestingInputStream
* @run testng DropTest
@ -79,7 +80,6 @@ public class DropTest extends KullaTesting {
assertActiveKeys();
}
@Test(enabled = false) // TODO 8081431
public void testDropImport() {
PersistentSnippet imp = importKey(assertEval("import java.util.*;"));
PersistentSnippet decl = varKey(

View File

@ -23,6 +23,7 @@
/*
* @test
* @bug 8080357
* @summary Tests for EvaluationState.methods
* @build KullaTesting TestingInputStream ExpectedDiagnostic
* @run testng MethodsTest
@ -36,7 +37,6 @@ 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 {
@ -74,6 +74,15 @@ public class MethodsTest extends KullaTesting {
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; }");