--- a/langtools/test/jdk/jshell/DropTest.java Thu Mar 10 09:51:46 2016 -0800
+++ b/langtools/test/jdk/jshell/DropTest.java Thu Mar 10 14:47:14 2016 -0800
@@ -1,5 +1,5 @@
/*
- * Copyright (c) 2015, Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 2015, 2016, 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 8081431
+ * @bug 8081431 8080069
* @summary Test of JShell#drop().
* @build KullaTesting TestingInputStream
* @run testng DropTest
@@ -31,6 +31,7 @@
import jdk.jshell.DeclarationSnippet;
import jdk.jshell.PersistentSnippet;
+import jdk.jshell.VarSnippet;
import org.testng.annotations.Test;
import static jdk.jshell.Snippet.Status.*;
@@ -45,21 +46,27 @@
assertDrop(var,
ste(var, VALID, DROPPED, true, null),
ste(method, VALID, RECOVERABLE_DEFINED, false, var));
- //assertDrop(method,
- // ste(method, RECOVERABLE_DEFINED, DROPPED, false, null),
- // ste(clazz, RECOVERABLE_NOT_DEFINED, RECOVERABLE_NOT_DEFINED, false, method));
- //assertDeclareFail("new C();", "compiler.err.cant.resolve.location");
+ assertDrop(method,
+ ste(method, RECOVERABLE_DEFINED, DROPPED, true, null),
+ ste(clazz, VALID, RECOVERABLE_DEFINED, false, method));
+ VarSnippet cc = varKey(assertEval("C c;"));
+ assertEvalUnresolvedException("new C();", "C", 1, 0);
assertVariables();
assertMethods();
assertClasses();
assertActiveKeys();
+ method = methodKey(assertEval("int mu() { return x * 4; }",
+ ste(MAIN_SNIPPET, DROPPED, RECOVERABLE_DEFINED, true, null),
+ ste(clazz, RECOVERABLE_DEFINED, VALID, false, MAIN_SNIPPET)));
assertEval("int x = 10;", "10",
- ste(var, DROPPED, VALID, true, null),
+ ste(MAIN_SNIPPET, DROPPED, VALID, true, null),
ste(method, RECOVERABLE_DEFINED, VALID, false, MAIN_SNIPPET));
PersistentSnippet c0 = varKey(assertEval("C c0 = new C();"));
assertEval("c0.v();", "\"#40\"");
- assertEval("C c = new C();");
+ assertEval("C c = new C();",
+ ste(MAIN_SNIPPET, VALID, VALID, false, null),
+ ste(cc, VALID, OVERWRITTEN, false, MAIN_SNIPPET));
assertEval("c.v();", "\"#40\"");
assertEval("int mu() { return x * 3; }",
ste(MAIN_SNIPPET, VALID, VALID, false, null),
@@ -144,9 +151,10 @@
DiagCheck.DIAG_OK,
DiagCheck.DIAG_ERROR,
ste(x, VALID, DROPPED, true, null),
- ste(a, VALID, RECOVERABLE_NOT_DEFINED, true, x));
- assertUnresolvedDependencies1(a, RECOVERABLE_NOT_DEFINED, "variable x");
- assertDeclareFail("new A().a;", "compiler.err.cant.resolve.location");
+ ste(a, VALID, RECOVERABLE_DEFINED, false, x));
+ assertEval("A foo() { return null; }");
+ assertUnresolvedDependencies1(a, RECOVERABLE_DEFINED, "variable x");
+ assertEvalUnresolvedException("new A();", "A", 1, 0);
assertVariables();
assertActiveKeys();
}
@@ -158,9 +166,9 @@
DiagCheck.DIAG_OK,
DiagCheck.DIAG_ERROR,
ste(x, VALID, DROPPED, true, null),
- ste(a, VALID, RECOVERABLE_NOT_DEFINED, true, x));
- assertUnresolvedDependencies1(a, RECOVERABLE_NOT_DEFINED, "method x()");
- assertDeclareFail("new A().a;", "compiler.err.cant.resolve.location");
+ ste(a, VALID, RECOVERABLE_DEFINED, false, x));
+ assertUnresolvedDependencies1(a, RECOVERABLE_DEFINED, "method x()");
+ assertEvalUnresolvedException("new A();", "A", 1, 0);
assertMethods();
assertActiveKeys();
}
--- a/langtools/test/jdk/jshell/ReplaceTest.java Thu Mar 10 09:51:46 2016 -0800
+++ b/langtools/test/jdk/jshell/ReplaceTest.java Thu Mar 10 14:47:14 2016 -0800
@@ -1,5 +1,5 @@
/*
- * Copyright (c) 2015, Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 2015, 2016, 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
@@ -22,7 +22,7 @@
*/
/*
- * @test
+ * @test 8080069
* @summary Test of Snippet redefinition and replacement.
* @build KullaTesting TestingInputStream
* @run testng ReplaceTest
@@ -30,6 +30,7 @@
import java.util.Collection;
+import java.util.List;
import jdk.jshell.Snippet;
import jdk.jshell.MethodSnippet;
import jdk.jshell.PersistentSnippet;
@@ -38,9 +39,11 @@
import jdk.jshell.DeclarationSnippet;
import org.testng.annotations.Test;
+import jdk.jshell.SnippetEvent;
+import jdk.jshell.UnresolvedReferenceException;
+import static org.testng.Assert.assertEquals;
import static jdk.jshell.Snippet.Status.*;
import static jdk.jshell.Snippet.SubKind.*;
-import static org.testng.Assert.assertEquals;
import static org.testng.Assert.assertTrue;
@Test
@@ -259,7 +262,7 @@
ste(MAIN_SNIPPET, VALID, VALID, true, null),
ste(g, VALID, OVERWRITTEN, false, MAIN_SNIPPET),
ste(f, VALID, RECOVERABLE_DEFINED, false, MAIN_SNIPPET));
- MethodSnippet exsn = assertEvalUnresolvedException("t();", "f", 0, 1);
+ DeclarationSnippet exsn = assertEvalUnresolvedException("t();", "f", 0, 1);
assertTrue(exsn == f, "Identity must not change");
assertActiveKeys();
}
@@ -289,13 +292,95 @@
}
public void testForwardVarToClass() {
- DeclarationSnippet a = classKey(assertEval("class A { int f() { return g; } }", added(RECOVERABLE_NOT_DEFINED)));
- assertUnresolvedDependencies1(a, RECOVERABLE_NOT_DEFINED, "variable g");
+ DeclarationSnippet a = classKey(assertEval("class A { int f() { return g; } }", added(RECOVERABLE_DEFINED)));
+ assertUnresolvedDependencies1(a, RECOVERABLE_DEFINED, "variable g");
+ Snippet g = varKey(assertEval("int g = 10;", "10",
+ added(VALID),
+ ste(a, RECOVERABLE_DEFINED, VALID, false, null)));
+ assertEval("new A().f();", "10");
+ assertEval("double g = 10;", "10.0", null,
+ DiagCheck.DIAG_OK,
+ DiagCheck.DIAG_ERROR,
+ ste(MAIN_SNIPPET, VALID, VALID, true, null),
+ ste(g, VALID, OVERWRITTEN, false, MAIN_SNIPPET),
+ ste(a, VALID, RECOVERABLE_DEFINED, false, MAIN_SNIPPET));
+ assertUnresolvedDependencies(a, 0);
+ assertActiveKeys();
+ }
+
+ public void testForwardVarToClassGeneric() {
+ DeclarationSnippet a = classKey(assertEval("class A<T> { final T x; A(T v) { this.x = v; } ; T get() { return x; } int core() { return g; } }", added(RECOVERABLE_DEFINED)));
+ assertUnresolvedDependencies1(a, RECOVERABLE_DEFINED, "variable g");
+
+ List<SnippetEvent> events = assertEval("A<String> as = new A<>(\"hi\");", null,
+ UnresolvedReferenceException.class, DiagCheck.DIAG_OK, DiagCheck.DIAG_OK, null);
+ SnippetEvent ste = events.get(0);
+ Snippet assn = ste.snippet();
+ DeclarationSnippet unsn = ((UnresolvedReferenceException) ste.exception()).getSnippet();
+ assertEquals(unsn.name(), "A", "Wrong with unresolved");
+ assertEquals(getState().unresolvedDependencies(unsn).size(), 1, "Wrong size unresolved");
+ assertEquals(getState().diagnostics(unsn).size(), 0, "Expected no diagnostics");
+
Snippet g = varKey(assertEval("int g = 10;", "10",
added(VALID),
+ ste(a, RECOVERABLE_DEFINED, VALID, false, MAIN_SNIPPET)));
+ assertEval("A<String> as = new A<>(\"low\");",
+ ste(MAIN_SNIPPET, VALID, VALID, false, null),
+ ste(assn, VALID, OVERWRITTEN, false, MAIN_SNIPPET));
+ assertEval("as.get();", "\"low\"");
+ assertUnresolvedDependencies(a, 0);
+ assertActiveKeys();
+ }
+
+ public void testForwardVarToClassExtendsImplements() {
+ DeclarationSnippet ik = classKey(assertEval("interface I { default int ii() { return 1; } }", added(VALID)));
+ DeclarationSnippet jk = classKey(assertEval("interface J { default int jj() { return 2; } }", added(VALID)));
+ DeclarationSnippet ck = classKey(assertEval("class C { int cc() { return 3; } }", added(VALID)));
+ DeclarationSnippet dk = classKey(assertEval("class D extends C implements I,J { int dd() { return g; } }", added(RECOVERABLE_DEFINED)));
+ DeclarationSnippet ek = classKey(assertEval("class E extends D { int ee() { return 5; } }", added(VALID)));
+ assertUnresolvedDependencies1(dk, RECOVERABLE_DEFINED, "variable g");
+ assertEvalUnresolvedException("new D();", "D", 1, 0);
+ assertEvalUnresolvedException("new E();", "D", 1, 0);
+ VarSnippet g = varKey(assertEval("int g = 10;", "10",
+ added(VALID),
+ ste(dk, RECOVERABLE_DEFINED, VALID, false, MAIN_SNIPPET)));
+ assertEval("E e = new E();");
+ assertDrop(g,
+ ste(g, VALID, DROPPED, true, null),
+ ste(dk, VALID, RECOVERABLE_DEFINED, false, g));
+ assertEvalUnresolvedException("new D();", "D", 1, 0);
+ assertEvalUnresolvedException("new E();", "D", 1, 0);
+ assertEval("e.ee();", "5");
+ assertEvalUnresolvedException("e.dd();", "D", 1, 0);
+ assertEval("e.cc();", "3");
+ assertEval("e.jj();", "2");
+ assertEval("e.ii();", "1");
+ assertActiveKeys();
+ }
+
+ public void testForwardVarToInterface() {
+ DeclarationSnippet i = classKey(assertEval("interface I { default int f() { return x; } }", added(RECOVERABLE_DEFINED)));
+ assertUnresolvedDependencies1(i, RECOVERABLE_DEFINED, "variable x");
+ DeclarationSnippet c = classKey(assertEval("class C implements I { int z() { return 2; } }", added(VALID)));
+ assertEval("C c = new C();");
+ assertEval("c.z();", "2");
+ assertEvalUnresolvedException("c.f()", "I", 1, 0);
+ Snippet g = varKey(assertEval("int x = 55;", "55",
+ added(VALID),
+ ste(i, RECOVERABLE_DEFINED, VALID, false, null)));
+ assertEval("c.f();", "55");
+ assertUnresolvedDependencies(i, 0);
+ assertActiveKeys();
+ }
+
+ public void testForwardVarToEnum() {
+ DeclarationSnippet a = classKey(assertEval("enum E { Q, W, E; float ff() { return fff; } }", added(RECOVERABLE_NOT_DEFINED)));
+ assertUnresolvedDependencies1(a, RECOVERABLE_NOT_DEFINED, "variable fff");
+ Snippet g = varKey(assertEval("float fff = 4.5f;", "4.5",
+ added(VALID),
ste(a, RECOVERABLE_NOT_DEFINED, VALID, true, null)));
- assertEval("new A().f();", "10");
- assertEval("double g = 10;", "10.0", null,
+ assertEval("E.Q.ff();", "4.5");
+ assertEval("double fff = 3.3;", "3.3", null,
DiagCheck.DIAG_OK,
DiagCheck.DIAG_ERROR,
ste(MAIN_SNIPPET, VALID, VALID, true, null),
@@ -305,20 +390,21 @@
assertActiveKeys();
}
-
public void testForwardMethodToClass() {
- DeclarationSnippet a = classKey(assertEval("class A { int f() { return g(); } }", added(RECOVERABLE_NOT_DEFINED)));
- assertUnresolvedDependencies1(a, RECOVERABLE_NOT_DEFINED, "method g()");
+ DeclarationSnippet a = classKey(assertEval("class A { int f() { return g(); } }", added(RECOVERABLE_DEFINED)));
+ assertUnresolvedDependencies1(a, RECOVERABLE_DEFINED, "method g()");
+ assertEval("A foo() { return null; }");
+ assertEvalUnresolvedException("new A();", "A", 1, 0);
Snippet g = methodKey(assertEval("int g() { return 10; }",
added(VALID),
- ste(a, RECOVERABLE_NOT_DEFINED, VALID, true, null)));
+ ste(a, RECOVERABLE_DEFINED, VALID, false, null)));
assertEval("new A().f();", "10");
assertEval("double g() { return 10; }",
DiagCheck.DIAG_OK,
DiagCheck.DIAG_ERROR,
ste(MAIN_SNIPPET, VALID, VALID, true, null),
ste(g, VALID, OVERWRITTEN, false, MAIN_SNIPPET),
- ste(a, VALID, RECOVERABLE_NOT_DEFINED, true, MAIN_SNIPPET));
+ ste(a, VALID, RECOVERABLE_DEFINED, false, MAIN_SNIPPET));
assertUnresolvedDependencies(a, 0);
assertActiveKeys();
}
@@ -336,8 +422,8 @@
DiagCheck.DIAG_ERROR,
ste(MAIN_SNIPPET, VALID, VALID, true, null),
ste(b, VALID, OVERWRITTEN, false, MAIN_SNIPPET),
- ste(a, VALID, RECOVERABLE_NOT_DEFINED, true, MAIN_SNIPPET));
- assertDeclareFail("new A().b;", "compiler.err.cant.resolve.location");
+ ste(a, VALID, RECOVERABLE_DEFINED, true, MAIN_SNIPPET));
+ assertEvalUnresolvedException("new A().b;", "A", 0, 1);
assertActiveKeys();
}
@@ -503,42 +589,42 @@
public void testForwardSingleImportMethodToClass1() {
PersistentSnippet a = classKey(assertEval("class A { String s = format(\"%d\", 10); }",
- added(RECOVERABLE_NOT_DEFINED)));
- assertDeclareFail("new A();", "compiler.err.cant.resolve.location");
+ added(RECOVERABLE_DEFINED)));
+ assertEvalUnresolvedException("new A();", "A", 1, 0);
assertEval("import static java.lang.String.format;",
added(VALID),
- ste(a, RECOVERABLE_NOT_DEFINED, VALID, true, null));
+ ste(a, RECOVERABLE_DEFINED, VALID, false, null));
assertEval("new A().s;", "\"10\"");
PersistentSnippet format = methodKey(assertEval("void format(String s, int d) { }",
DiagCheck.DIAG_OK,
DiagCheck.DIAG_ERROR,
added(VALID),
- ste(a, VALID, RECOVERABLE_NOT_DEFINED, true, MAIN_SNIPPET)));
- assertDeclareFail("new A().s;", "compiler.err.cant.resolve.location");
+ ste(a, VALID, RECOVERABLE_DEFINED, false, MAIN_SNIPPET)));
+ assertEvalUnresolvedException("new A();", "A", 0, 1);
assertActiveKeys();
assertDrop(format,
ste(format, VALID, DROPPED, true, null),
- ste(a, RECOVERABLE_NOT_DEFINED, VALID, true, format));
+ ste(a, RECOVERABLE_DEFINED, VALID, false, format));
}
public void testForwardSingleImportMethodToClass2() {
PersistentSnippet a = classKey(assertEval("class A { String s() { return format(\"%d\", 10); } }",
- added(RECOVERABLE_NOT_DEFINED)));
- assertDeclareFail("new A();", "compiler.err.cant.resolve.location");
+ added(RECOVERABLE_DEFINED)));
+ assertEvalUnresolvedException("new A();", "A", 1, 0);
assertEval("import static java.lang.String.format;",
added(VALID),
- ste(a, RECOVERABLE_NOT_DEFINED, VALID, true, null));
+ ste(a, RECOVERABLE_DEFINED, VALID, false, null));
assertEval("new A().s();", "\"10\"");
PersistentSnippet format = methodKey(assertEval("void format(String s, int d) { }",
DiagCheck.DIAG_OK,
DiagCheck.DIAG_ERROR,
added(VALID),
- ste(a, VALID, RECOVERABLE_NOT_DEFINED, true, null)));
- assertDeclareFail("new A().s();", "compiler.err.cant.resolve.location");
+ ste(a, VALID, RECOVERABLE_DEFINED, false, null)));
+ assertEvalUnresolvedException("new A();", "A", 0, 1);
assertActiveKeys();
assertDrop(format,
ste(format, VALID, DROPPED, true, null),
- ste(a, RECOVERABLE_NOT_DEFINED, VALID, true, format));
+ ste(a, RECOVERABLE_DEFINED, VALID, false, format));
}
public void testForwardSingleImportClassToClass1() {
@@ -589,42 +675,44 @@
public void testForwardImportOnDemandMethodToClass1() {
PersistentSnippet a = classKey(assertEval("class A { String s = format(\"%d\", 10); }",
- added(RECOVERABLE_NOT_DEFINED)));
- assertDeclareFail("new A();", "compiler.err.cant.resolve.location");
+ added(RECOVERABLE_DEFINED)));
+ assertEvalUnresolvedException("new A();", "A", 1, 0);
assertEval("import static java.lang.String.*;",
added(VALID),
- ste(a, RECOVERABLE_NOT_DEFINED, VALID, true, null));
- assertEval("new A().s;", "\"10\"");
+ ste(a, RECOVERABLE_DEFINED, VALID, false, null));
+ assertEval("A x = new A();");
+ assertEval("x.s;", "\"10\"");
PersistentSnippet format = methodKey(assertEval("void format(String s, int d) { }",
DiagCheck.DIAG_OK,
DiagCheck.DIAG_ERROR,
added(VALID),
- ste(a, VALID, RECOVERABLE_NOT_DEFINED, true, null)));
- assertDeclareFail("new A().s;", "compiler.err.cant.resolve.location");
+ ste(a, VALID, RECOVERABLE_DEFINED, false, null)));
+ assertEvalUnresolvedException("new A();", "A", 0, 1);
assertActiveKeys();
assertDrop(format,
ste(format, VALID, DROPPED, true, null),
- ste(a, RECOVERABLE_NOT_DEFINED, VALID, true, format));
+ ste(a, RECOVERABLE_DEFINED, VALID, false, format));
+ assertEval("x.s;", "\"10\"");
}
public void testForwardImportOnDemandMethodToClass2() {
PersistentSnippet a = classKey(assertEval("class A { String s() { return format(\"%d\", 10); } }",
- added(RECOVERABLE_NOT_DEFINED)));
- assertDeclareFail("new A();", "compiler.err.cant.resolve.location");
+ added(RECOVERABLE_DEFINED)));
+ assertEvalUnresolvedException("new A();", "A", 1, 0);
assertEval("import static java.lang.String.*;",
added(VALID),
- ste(a, RECOVERABLE_NOT_DEFINED, VALID, true, null));
+ ste(a, RECOVERABLE_DEFINED, VALID, false, null));
assertEval("new A().s();", "\"10\"");
PersistentSnippet format = methodKey(assertEval("void format(String s, int d) { }",
DiagCheck.DIAG_OK,
DiagCheck.DIAG_ERROR,
added(VALID),
- ste(a, VALID, RECOVERABLE_NOT_DEFINED, true, null)));
- assertDeclareFail("new A().s();", "compiler.err.cant.resolve.location");
+ ste(a, VALID, RECOVERABLE_DEFINED, false, null)));
+ assertEvalUnresolvedException("new A();", "A", 0, 1);
assertActiveKeys();
assertDrop(format,
ste(format, VALID, DROPPED, true, null),
- ste(a, RECOVERABLE_NOT_DEFINED, VALID, true, format));
+ ste(a, RECOVERABLE_DEFINED, VALID, false, format));
}
public void testForwardImportOnDemandClassToClass1() {
@@ -673,86 +761,87 @@
public void testForwardSingleImportFieldToClass1() {
PersistentSnippet a = classKey(assertEval("class A { static double pi() { return PI; } }",
- added(RECOVERABLE_NOT_DEFINED)));
- assertDeclareFail("new A();", "compiler.err.cant.resolve.location");
+ added(RECOVERABLE_DEFINED)));
+ assertEvalUnresolvedException("new A();", "A", 1, 0);
assertEval("import static java.lang.Math.PI;",
added(VALID),
- ste(a, RECOVERABLE_NOT_DEFINED, VALID, true, null));
+ ste(a, RECOVERABLE_DEFINED, VALID, false, null));
assertEval("Math.abs(A.pi() - 3.1415) < 0.001;", "true");
PersistentSnippet list = varKey(assertEval("String PI;",
DiagCheck.DIAG_OK,
DiagCheck.DIAG_ERROR,
added(VALID),
- ste(a, VALID, RECOVERABLE_NOT_DEFINED, true, null)));
- assertDeclareFail("new A();", "compiler.err.cant.resolve.location");
+ ste(a, VALID, RECOVERABLE_DEFINED, false, null)));
+ assertEvalUnresolvedException("new A();", "A", 0, 1);
assertActiveKeys();
assertDrop(list,
ste(list, VALID, DROPPED, true, null),
- ste(a, RECOVERABLE_NOT_DEFINED, VALID, true, list));
+ ste(a, RECOVERABLE_DEFINED, VALID, false, list));
}
public void testForwardSingleImportFieldToClass2() {
PersistentSnippet a = classKey(assertEval("class A { static double pi = PI; }",
- added(RECOVERABLE_NOT_DEFINED)));
- assertDeclareFail("new A();", "compiler.err.cant.resolve.location");
+ added(RECOVERABLE_DEFINED)));
+ assertEvalUnresolvedException("new A();", "A", 1, 0);
assertEval("import static java.lang.Math.PI;",
added(VALID),
- ste(a, RECOVERABLE_NOT_DEFINED, VALID, true, null));
+ ste(a, RECOVERABLE_DEFINED, VALID, true, null));
assertEval("Math.abs(A.pi - 3.1415) < 0.001;", "true");
PersistentSnippet list = varKey(assertEval("String PI;",
DiagCheck.DIAG_OK,
DiagCheck.DIAG_ERROR,
added(VALID),
- ste(a, VALID, RECOVERABLE_NOT_DEFINED, true, null)));
- assertDeclareFail("new A();", "compiler.err.cant.resolve.location");
+ ste(a, VALID, RECOVERABLE_DEFINED, true, null)));
+ assertEvalUnresolvedException("new A();", "A", 0, 1);
assertActiveKeys();
assertDrop(list,
ste(list, VALID, DROPPED, true, null),
- ste(a, RECOVERABLE_NOT_DEFINED, VALID, true, list));
+ ste(a, RECOVERABLE_DEFINED, VALID, true, list));
}
public void testForwardImportOnDemandFieldToClass1() {
PersistentSnippet a = classKey(assertEval("class A { static double pi() { return PI; } }",
- added(RECOVERABLE_NOT_DEFINED)));
- assertDeclareFail("new A();", "compiler.err.cant.resolve.location");
+ added(RECOVERABLE_DEFINED)));
+ assertEvalUnresolvedException("new A();", "A", 1, 0);
assertEval("import static java.lang.Math.*;",
added(VALID),
- ste(a, RECOVERABLE_NOT_DEFINED, VALID, true, null));
+ ste(a, RECOVERABLE_DEFINED, VALID, false, null));
assertEval("Math.abs(A.pi() - 3.1415) < 0.001;", "true");
PersistentSnippet list = varKey(assertEval("String PI;",
DiagCheck.DIAG_OK,
DiagCheck.DIAG_ERROR,
added(VALID),
- ste(a, VALID, RECOVERABLE_NOT_DEFINED, true, null)));
- assertDeclareFail("new A();", "compiler.err.cant.resolve.location");
+ ste(a, VALID, RECOVERABLE_DEFINED, false, null)));
+ assertEvalUnresolvedException("new A();", "A", 0, 1);
assertActiveKeys();
assertDrop(list,
ste(list, VALID, DROPPED, true, null),
- ste(a, RECOVERABLE_NOT_DEFINED, VALID, true, list));
+ ste(a, RECOVERABLE_DEFINED, VALID, false, list));
}
public void testForwardImportOnDemandFieldToClass2() {
PersistentSnippet a = classKey(assertEval("class A { static double pi = PI; }",
- added(RECOVERABLE_NOT_DEFINED)));
- assertDeclareFail("new A();", "compiler.err.cant.resolve.location");
+ added(RECOVERABLE_DEFINED)));
+ assertEvalUnresolvedException("new A();", "A", 1, 0);
assertEval("import static java.lang.Math.*;",
added(VALID),
- ste(a, RECOVERABLE_NOT_DEFINED, VALID, true, null));
+ ste(a, RECOVERABLE_DEFINED, VALID, true, null));
assertEval("Math.abs(A.pi - 3.1415) < 0.001;", "true");
PersistentSnippet list = varKey(assertEval("String PI;",
DiagCheck.DIAG_OK,
DiagCheck.DIAG_ERROR,
added(VALID),
- ste(a, VALID, RECOVERABLE_NOT_DEFINED, true, null)));
- assertDeclareFail("new A();", "compiler.err.cant.resolve.location");
+ ste(a, VALID, RECOVERABLE_DEFINED, true, null)));
+ assertEvalUnresolvedException("new A();", "A", 0, 1);
assertActiveKeys();
assertDrop(list,
ste(list, VALID, DROPPED, true, null),
- ste(a, RECOVERABLE_NOT_DEFINED, VALID, true, list));
+ ste(a, RECOVERABLE_DEFINED, VALID, true, list));
+ assertEval("Math.abs(A.pi - 3.1415) < 0.001;", "true");
}
public void testReplaceCausesMethodReferenceError() {