src/jdk.javadoc/share/classes/jdk/javadoc/internal/doclets/toolkit/builders/AbstractBuilder.java

Print this page

        

@@ -1,7 +1,7 @@
 /*
- * Copyright (c) 2003, 2014, Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 2003, 2015, 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
  * under the terms of the GNU General Public License version 2 only, as
  * published by the Free Software Foundation.  Oracle designates this

@@ -21,20 +21,25 @@
  * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
  * or visit www.oracle.com if you need additional information or have any
  * questions.
  */
 
-package com.sun.tools.doclets.internal.toolkit.builders;
+package jdk.javadoc.internal.doclets.toolkit.builders;
 
 import java.io.*;
 import java.lang.reflect.*;
 import java.util.*;
 
-import com.sun.javadoc.PackageDoc;
-import com.sun.tools.doclets.internal.toolkit.*;
-import com.sun.tools.doclets.internal.toolkit.util.*;
+import javax.lang.model.element.PackageElement;
 
+import jdk.javadoc.internal.doclets.toolkit.Configuration;
+import jdk.javadoc.internal.doclets.toolkit.Content;
+import jdk.javadoc.internal.doclets.toolkit.util.DocletAbortException;
+import jdk.javadoc.internal.doclets.toolkit.util.Utils;
+
+import static javax.tools.Diagnostic.Kind.*;
+
 /**
  * The superclass for all builders.  A builder is a class that provides
  * the structure and content of API documentation.  A builder is completely
  * doclet independent which means that any doclet can use builders to
  * construct documentation, as long as it impelements the appropriate

@@ -62,19 +67,19 @@
         /**
          * Keep track of which packages we have seen for
          * efficiency purposes.  We don't want to copy the
          * doc files multiple times for a single package.
          */
-        final Set<PackageDoc> containingPackagesSeen;
+        final Set<PackageElement> containingPackagesSeen;
 
         /**
          * Shared parser for the builder XML file
          */
         final LayoutParser layoutParser;
 
         Context(Configuration configuration,
-                Set<PackageDoc> containingPackagesSeen,
+                Set<PackageElement> containingPackagesSeen,
                 LayoutParser layoutParser) {
             this.configuration = configuration;
             this.containingPackagesSeen = containingPackagesSeen;
             this.layoutParser = layoutParser;
         }

@@ -90,11 +95,11 @@
     /**
      * Keep track of which packages we have seen for
      * efficiency purposes.  We don't want to copy the
      * doc files multiple times for a single package.
      */
-    protected final Set<PackageDoc> containingPackagesSeen;
+    protected final Set<PackageElement> containingPackagesSeen;
 
     protected final LayoutParser layoutParser;
 
     /**
      * True if we want to print debug output.

@@ -139,17 +144,17 @@
             invokeMethod("build" + component,
                     new Class<?>[]{XMLNode.class, Content.class},
                     new Object[]{node, contentTree});
         } catch (NoSuchMethodException e) {
             e.printStackTrace();
-            configuration.root.printError("Unknown element: " + component);
+            configuration.reporter.print(ERROR, "Unknown element: " + component);
             throw new DocletAbortException(e);
         } catch (InvocationTargetException e) {
             throw new DocletAbortException(e.getCause());
         } catch (Exception e) {
             e.printStackTrace();
-            configuration.root.printError("Exception " +
+            configuration.reporter.print(ERROR, "Exception " +
                     e.getClass().getName() +
                     " thrown while processing element: " + component);
             throw new DocletAbortException(e);
         }
     }

@@ -176,11 +181,12 @@
      */
     protected void invokeMethod(String methodName, Class<?>[] paramClasses,
             Object[] params)
     throws Exception {
         if (DEBUG) {
-            configuration.root.printError("DEBUG: " + this.getClass().getName() + "." + methodName);
+            configuration.reporter.print(ERROR, "DEBUG: " +
+                    this.getClass().getName() + "." + methodName);
         }
         Method method = this.getClass().getMethod(methodName, paramClasses);
         method.invoke(this, params);
     }
 }