8167320: Trying to document only java.base causes a NPE in javac
Ensure ModuleSymbol.getDirectives completes the Symbol Reviewed-by: ksrini, jjg
This commit is contained in:
parent
24a4e49180
commit
5794656914
@ -949,6 +949,7 @@ public abstract class Symbol extends AnnoConstruct implements Element {
|
||||
|
||||
@Override @DefinedBy(Api.LANGUAGE_MODEL)
|
||||
public java.util.List<Directive> getDirectives() {
|
||||
complete();
|
||||
completeUsesProvides();
|
||||
return Collections.unmodifiableList(directives);
|
||||
}
|
||||
|
@ -23,7 +23,7 @@
|
||||
|
||||
/*
|
||||
* @test
|
||||
* @bug 8154283
|
||||
* @bug 8154283 8167320
|
||||
* @summary tests for multi-module mode compilation
|
||||
* @library /tools/lib
|
||||
* @modules
|
||||
@ -54,6 +54,7 @@ import com.sun.source.tree.CompilationUnitTree;
|
||||
//import com.sun.source.util.JavacTask; // conflicts with toolbox.JavacTask
|
||||
import com.sun.tools.javac.api.JavacTaskImpl;
|
||||
import com.sun.tools.javac.code.Symbol.ModuleSymbol;
|
||||
import com.sun.tools.javac.code.Symtab;
|
||||
|
||||
import toolbox.JarTask;
|
||||
import toolbox.JavacTask;
|
||||
@ -449,4 +450,12 @@ public class EdgeCases extends ModuleTestBase {
|
||||
}
|
||||
}
|
||||
|
||||
@Test
|
||||
public void testGetDirectivesComplete(Path base) throws Exception {
|
||||
JavaCompiler compiler = ToolProvider.getSystemJavaCompiler();
|
||||
JavacTaskImpl task = (JavacTaskImpl) compiler.getTask(null, null, null, null, null, null);
|
||||
Symtab syms = Symtab.instance(task.getContext());
|
||||
|
||||
syms.java_base.getDirectives();
|
||||
}
|
||||
}
|
||||
|
Loading…
x
Reference in New Issue
Block a user