8211407: Bad links to non-existent entries on serialized-form page

Reviewed-by: jlahoda
This commit is contained in:
Jonathan Gibbons 2018-10-08 11:14:59 -07:00
parent 40d81d4bcc
commit f8d8a72a27
2 changed files with 160 additions and 1 deletions

View file

@ -1,5 +1,5 @@
/*
* Copyright (c) 2001, 2017, Oracle and/or its affiliates. All rights reserved.
* Copyright (c) 2001, 2018, 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
@ -34,6 +34,8 @@ import java.util.List;
import java.util.Map;
import java.util.Set;
import javax.lang.model.element.Element;
import javax.lang.model.element.ElementKind;
import javax.tools.JavaFileObject;
import javax.tools.StandardJavaFileManager;
@ -41,6 +43,7 @@ import com.sun.tools.javac.code.ClassFinder;
import com.sun.tools.javac.code.DeferredCompletionFailureHandler;
import com.sun.tools.javac.code.Symbol.Completer;
import com.sun.tools.javac.code.Symbol.CompletionFailure;
import com.sun.tools.javac.code.Symbol.PackageSymbol;
import com.sun.tools.javac.comp.Enter;
import com.sun.tools.javac.tree.JCTree;
import com.sun.tools.javac.tree.JCTree.JCClassDecl;
@ -213,6 +216,17 @@ public class JavadocTool extends com.sun.tools.javac.main.JavaCompiler {
dcfh.setHandler(dcfh.userCodeHandler);
etable.analyze();
// Ensure that package-info is read for all included packages
for (Element e : etable.getIncludedElements()) {
if (e.getKind() == ElementKind.PACKAGE) {
PackageSymbol packge = (PackageSymbol) e;
if (packge.package_info != null) {
packge.package_info.complete();
}
}
}
} catch (CompletionFailure cf) {
throw new ToolException(ABNORMAL, cf.getMessage(), cf);
} catch (Abort abort) {