8221759: Crash when completing \"java.io.File.path\"
Do not provide documentation for inaccessible elements. Reviewed-by: rfield
This commit is contained in:
parent
d2472e6dcd
commit
55e1da1813
@ -1229,6 +1229,13 @@ class SourceCodeAnalysisImpl extends SourceCodeAnalysis {
|
||||
return Collections.emptyList();
|
||||
}
|
||||
|
||||
Predicate<Element> accessibility = createAccessibilityFilter(at, tp);
|
||||
|
||||
if (!accessibility.test(el)) {
|
||||
//not accessible
|
||||
return Collections.emptyList();
|
||||
}
|
||||
|
||||
elements = Stream.of(el);
|
||||
} else {
|
||||
return Collections.emptyList();
|
||||
|
@ -23,7 +23,7 @@
|
||||
|
||||
/*
|
||||
* @test
|
||||
* @bug 8131025 8141092 8153761 8145263 8131019 8175886 8176184 8176241 8176110 8177466 8197439
|
||||
* @bug 8131025 8141092 8153761 8145263 8131019 8175886 8176184 8176241 8176110 8177466 8197439 8221759
|
||||
* @summary Test Completion and Documentation
|
||||
* @library /tools/lib
|
||||
* @modules jdk.compiler/com.sun.tools.javac.api
|
||||
@ -325,6 +325,14 @@ public class CompletionSuggestionTest extends KullaTesting {
|
||||
assertSignature("\"\".getBytes(\"\" |", "void String.getBytes(int, int, byte[], int)",
|
||||
"byte[] String.getBytes(String) throws java.io.UnsupportedEncodingException",
|
||||
"byte[] String.getBytes(java.nio.charset.Charset)");
|
||||
//JDK-8221759:
|
||||
Compiler compiler = new Compiler();
|
||||
Path testOutDir = Paths.get("WithPrivateField");
|
||||
String input = "package field; public class FieldTest { private static String field; private static String field2; }";
|
||||
compiler.compile(testOutDir, input);
|
||||
addToClasspath(compiler.getPath(testOutDir));
|
||||
assertSignature("field.FieldTest.field|");
|
||||
assertSignature("field.FieldTest.field2|");
|
||||
}
|
||||
|
||||
public void testMethodsWithNoArguments() throws Exception {
|
||||
|
@ -23,7 +23,7 @@
|
||||
|
||||
/**
|
||||
* @test
|
||||
* @bug 8177076 8185426 8189595 8188072
|
||||
* @bug 8177076 8185426 8189595 8188072 8221759
|
||||
* @modules
|
||||
* jdk.compiler/com.sun.tools.javac.api
|
||||
* jdk.compiler/com.sun.tools.javac.main
|
||||
@ -266,6 +266,15 @@ public class ToolTabSnippetTest extends UITesting {
|
||||
});
|
||||
}
|
||||
|
||||
public void testCrash8221759() throws Exception {
|
||||
doRunTest((inputSink, out) -> {
|
||||
inputSink.write("java.io.File.path" + TAB);
|
||||
waitOutput(out, "java.io.File.path\n" +
|
||||
"pathSeparator pathSeparatorChar " +
|
||||
REDRAW_PROMPT + "java.io.File.pathSeparator");
|
||||
});
|
||||
}
|
||||
|
||||
private Path prepareZip() {
|
||||
String clazz1 =
|
||||
"package jshelltest;\n" +
|
||||
|
Loading…
Reference in New Issue
Block a user