--- old/src/jdk.javadoc/share/classes/jdk/javadoc/internal/doclets/toolkit/util/links/LinkFactory.java 2018-02-02 13:16:39.412775756 -0800 +++ new/src/jdk.javadoc/share/classes/jdk/javadoc/internal/doclets/toolkit/util/links/LinkFactory.java 2018-02-02 13:16:39.064760518 -0800 @@ -28,7 +28,6 @@ import java.util.ArrayList; import java.util.List; -import javax.lang.model.element.AnnotationMirror; import javax.lang.model.element.Element; import javax.lang.model.element.TypeElement; import javax.lang.model.element.TypeParameterElement; @@ -39,7 +38,6 @@ import javax.lang.model.type.WildcardType; import javax.lang.model.util.SimpleTypeVisitor9; -import jdk.javadoc.internal.doclets.formats.html.LinkInfoImpl; import jdk.javadoc.internal.doclets.toolkit.Content; import jdk.javadoc.internal.doclets.toolkit.util.Utils; @@ -54,6 +52,11 @@ * @author Jamie Ho */ public abstract class LinkFactory { + protected final Utils utils; + + protected LinkFactory(Utils utils) { + this.utils = utils; + } /** * Return an empty instance of a content object. @@ -69,7 +72,6 @@ * @return the output of the link. */ public Content getLink(LinkInfo linkInfo) { - Utils utils = ((LinkInfoImpl) linkInfo).configuration.utils; if (linkInfo.type != null) { SimpleTypeVisitor9 linkVisitor = new SimpleTypeVisitor9() { @@ -207,26 +209,27 @@ } /** - * Return the link to the given class. + * Returns a link to the given class. * - * @param linkInfo the information about the link to construct. + * @param linkInfo the information about the link to construct * * @return the link for the given class. */ protected abstract Content getClassLink(LinkInfo linkInfo); /** - * Return the link to the given type parameter. + * Returns a link to the given type parameter. * - * @param linkInfo the information about the link to construct. - * @param typeParam the type parameter to link to. + * @param linkInfo the information about the link to construct + * @param typeParam the type parameter to link to + * @return the link */ protected abstract Content getTypeParameterLink(LinkInfo linkInfo, TypeMirror typeParam); /** - * Return the links to the type parameters. + * Returns links to the type parameters. * - * @param linkInfo the information about the link to construct. + * @param linkInfo the information about the link to construct * @return the links to the type parameters. */ public Content getTypeParameterLinks(LinkInfo linkInfo) { @@ -234,15 +237,14 @@ } /** - * Return the links to the type parameters. + * Returns links to the type parameters. * - * @param linkInfo the information about the link to construct. - * @param isClassLabel true if this is a class label. False if it is - * the type parameters portion of the link. - * @return the links to the type parameters. + * @param linkInfo the information about the link to construct + * @param isClassLabel true if this is a class label, or false if it is + * the type parameters portion of the link + * @return the links to the type parameters */ public Content getTypeParameterLinks(LinkInfo linkInfo, boolean isClassLabel) { - Utils utils = ((LinkInfoImpl)linkInfo).utils; Content links = newContent(); List vars = new ArrayList<>(); TypeMirror ctype = linkInfo.type != null