8129418: JShell: better highlighting of errors in imports on demand
Reviewed-by: jlahoda
This commit is contained in:
parent
6422efa3c7
commit
ae999eae7e
@ -4428,7 +4428,7 @@ public class Check {
|
||||
TypeSymbol tsym = imp.qualid.selected.type.tsym;
|
||||
if (tsym.kind == PCK && tsym.members().isEmpty() &&
|
||||
!(Feature.IMPORT_ON_DEMAND_OBSERVABLE_PACKAGES.allowedInSource(source) && tsym.exists())) {
|
||||
log.error(DiagnosticFlag.RESOLVE_ERROR, imp.pos, Errors.DoesntExist(tsym));
|
||||
log.error(DiagnosticFlag.RESOLVE_ERROR, imp.qualid.selected.pos(), Errors.DoesntExist(tsym));
|
||||
}
|
||||
}
|
||||
}
|
||||
|
@ -23,7 +23,7 @@
|
||||
|
||||
/*
|
||||
* @test
|
||||
* @bug 8141415
|
||||
* @bug 8141415 8129418
|
||||
* @summary Test imports
|
||||
* @modules jdk.compiler/com.sun.tools.javac.api
|
||||
* jdk.compiler/com.sun.tools.javac.main
|
||||
@ -80,12 +80,11 @@ public class ImportTest extends KullaTesting {
|
||||
assertEval("abs(cos(PI / 2)) < 0.00001;", "true");
|
||||
}
|
||||
|
||||
@Test(enabled = false) // TODO 8129418
|
||||
public void testUnknownPackage() {
|
||||
assertDeclareFail("import unknown.qqq;",
|
||||
new ExpectedDiagnostic("compiler.err.doesnt.exist", 7, 18, 14, -1, -1, Diagnostic.Kind.ERROR));
|
||||
assertDeclareFail("import unknown.*;",
|
||||
new ExpectedDiagnostic("compiler.err.doesnt.exist", 7, 15, 7, -1, -1, Diagnostic.Kind.ERROR));
|
||||
new ExpectedDiagnostic("compiler.err.doesnt.exist", 7, 14, 7, -1, -1, Diagnostic.Kind.ERROR));
|
||||
}
|
||||
|
||||
public void testBogusImportIgnoredInFuture() {
|
||||
|
@ -1,2 +1,2 @@
|
||||
TestImportStar.java:16:1: compiler.err.doesnt.exist: xxx
|
||||
TestImportStar.java:16:8: compiler.err.doesnt.exist: xxx
|
||||
1 error
|
||||
|
@ -1,4 +1,4 @@
|
||||
- compiler.note.proc.messager: RUNNING - lastRound = false
|
||||
TestImportStar.java:16:1: compiler.err.doesnt.exist: xxx
|
||||
TestImportStar.java:16:8: compiler.err.doesnt.exist: xxx
|
||||
- compiler.note.proc.messager: RUNNING - lastRound = true
|
||||
1 error
|
||||
|
@ -1,2 +1,2 @@
|
||||
ImportIsFullyQualified.java:11:1: compiler.err.doesnt.exist: JobAttributes
|
||||
ImportIsFullyQualified.java:11:8: compiler.err.doesnt.exist: JobAttributes
|
||||
1 error
|
||||
|
@ -1,2 +1,2 @@
|
||||
ImportsObservable.java:9:1: compiler.err.doesnt.exist: javax
|
||||
ImportsObservable.java:9:8: compiler.err.doesnt.exist: javax
|
||||
1 error
|
||||
|
@ -799,7 +799,7 @@ public class ConvenientAccessErrorsTest extends ModuleTestBase {
|
||||
.getOutputLines(Task.OutputKind.DIRECT);
|
||||
|
||||
List<String> expected = Arrays.asList(
|
||||
"Test.java:1:31: compiler.err.doesnt.exist: ma",
|
||||
"Test.java:1:38: compiler.err.doesnt.exist: ma",
|
||||
"1 error");
|
||||
|
||||
if (!expected.equals(log))
|
||||
@ -827,7 +827,7 @@ public class ConvenientAccessErrorsTest extends ModuleTestBase {
|
||||
.getOutputLines(Task.OutputKind.DIRECT);
|
||||
|
||||
List<String> expected = Arrays.asList(
|
||||
"Test.java:1:15: compiler.err.doesnt.exist: ma",
|
||||
"Test.java:1:22: compiler.err.doesnt.exist: ma",
|
||||
"1 error");
|
||||
|
||||
if (!expected.equals(log))
|
||||
@ -861,7 +861,7 @@ public class ConvenientAccessErrorsTest extends ModuleTestBase {
|
||||
.getOutputLines(Task.OutputKind.DIRECT);
|
||||
|
||||
List<String> expected = Arrays.asList(
|
||||
"Test.java:1:15: compiler.err.doesnt.exist: ma",
|
||||
"Test.java:1:22: compiler.err.doesnt.exist: ma",
|
||||
"1 error");
|
||||
|
||||
if (!expected.equals(log))
|
||||
|
Loading…
Reference in New Issue
Block a user