changeset 44015:27aa35eb727c

8151220: Extend sample API to use modules. Reviewed-by: ksrini
author shurailine
date Tue, 21 Feb 2017 15:38:07 -0800
parents a6dc784b18a8
children 7ceaef603725
files langtools/test/jdk/javadoc/tool/sampleapi/lib/sampleapi/SampleApi.java langtools/test/jdk/javadoc/tool/sampleapi/lib/sampleapi/SampleApiDefaultRunner.java langtools/test/jdk/javadoc/tool/sampleapi/lib/sampleapi/generator/ModuleGenerator.java langtools/test/jdk/javadoc/tool/sampleapi/lib/sampleapi/generator/PackageGenerator.java langtools/test/jdk/javadoc/tool/sampleapi/lib/sampleapi/util/SimpleMultiplier.java langtools/test/jdk/javadoc/tool/sampleapi/res/fx.xml langtools/test/jdk/javadoc/tool/sampleapi/res/simple.xml langtools/test/jdk/javadoc/tool/sampleapi/res/sub.xml langtools/test/jdk/javadoc/tool/sampleapi/res/tiny.xml langtools/test/jdk/javadoc/tool/sampleapi/res/tinysub.xml langtools/test/jdk/javadoc/tool/sampleapi/res/transitive.xml langtools/test/tools/javadoc/sampleapi/SampleApiTest.java langtools/test/tools/javadoc/sampleapi/res/fx.xml langtools/test/tools/javadoc/sampleapi/res/simple.xml langtools/test/tools/javadoc/sampleapi/res/sub.xml langtools/test/tools/javadoc/sampleapi/res/tiny.xml
diffstat 16 files changed, 1802 insertions(+), 1322 deletions(-) [+]
line wrap: on
line diff
--- a/langtools/test/jdk/javadoc/tool/sampleapi/lib/sampleapi/SampleApi.java	Thu Feb 16 14:47:39 2017 -0800
+++ b/langtools/test/jdk/javadoc/tool/sampleapi/lib/sampleapi/SampleApi.java	Tue Feb 21 15:38:07 2017 -0800
@@ -20,42 +20,135 @@
  * or visit www.oracle.com if you need additional information or have any
  * questions.
  */
-
 package sampleapi;
 
-import java.io.File;
-import java.io.FilenameFilter;
+import com.sun.source.util.JavacTask;
+import com.sun.tools.javac.api.JavacTaskImpl;
+import com.sun.tools.javac.api.JavacTool;
+import com.sun.tools.javac.util.Context;
+import java.io.IOException;
+import java.io.InputStream;
+import java.io.UncheckedIOException;
+import java.nio.file.Files;
 import java.nio.file.Path;
+import java.nio.file.Paths;
+import java.util.ArrayList;
+import java.util.List;
+import java.util.Optional;
+import static java.util.stream.Collectors.toList;
+import javax.xml.parsers.DocumentBuilder;
+import javax.xml.parsers.DocumentBuilderFactory;
+import javax.xml.parsers.ParserConfigurationException;
+import org.w3c.dom.Document;
+import org.w3c.dom.Element;
+import org.w3c.dom.NodeList;
+import org.xml.sax.SAXException;
+import sampleapi.generator.ModuleGenerator;
 
 import sampleapi.generator.PackageGenerator;
 
 public class SampleApi {
 
-    PackageGenerator pkgGen = new PackageGenerator();
+    private final Context ctx;
+    private final List<ModuleGenerator> modules = new ArrayList<>();
 
-    public void generate(File resDir, File outDir) throws Fault {
-        FilenameFilter filter = (dir, name) -> { return name.endsWith(".xml"); };
-        File[] resFiles = resDir.listFiles(filter);
-        for (File resFile : resFiles) {
-            pkgGen.processDataSet(resFile);
-            pkgGen.generate(outDir);
-        }
+    public SampleApi() {
+        JavacTool jt = JavacTool.create();
+        JavacTask task = jt.getTask(null, null, null, null, null, null);
+        ctx = ((JavacTaskImpl) task).getContext();
     }
 
-    public void generate(Path res, Path dir) throws Fault {
-        generate(res.toFile(), dir.toFile());
+    public static SampleApi load(Path resDir)
+            throws ParserConfigurationException, IOException, SAXException {
+        SampleApi result = new SampleApi();
+        System.out.println("Loading resources from " + resDir);
+        DocumentBuilderFactory factory = DocumentBuilderFactory.newInstance();
+        DocumentBuilder builder = factory.newDocumentBuilder();
+        Files.list(resDir)
+                .peek(f -> System.out.println(f.getFileName()))
+                .filter(f -> f.getFileName().toString().endsWith(".xml"))
+                .peek(f -> System.out.println(f.getFileName()))
+                .forEach(resFile -> {
+                    try (InputStream is = Files.newInputStream(resFile)) {
+                        Document document = builder.parse(is);
+                        NodeList moduleElements = document.getElementsByTagName("module");
+                        for (int i = 0; i < moduleElements.getLength(); i++) {
+                            result.modules.add(ModuleGenerator
+                                    .load((Element) moduleElements.item(i)));
+                        }
+                    } catch (IOException ex) {
+                        throw new UncheckedIOException(ex);
+                    } catch (SAXException ex) {
+                        throw new RuntimeException(ex);
+                    }
+                });
+        return result;
     }
 
-    public void generate(String res, String dir) throws Fault {
-        generate(new File(res), new File(dir));
+    public Context getContext() {
+        return ctx;
     }
 
-    public static class Fault extends Exception {
-        public Fault(String msg) {
-            super(msg);
+    public List<ModuleGenerator> getModules() {
+        return modules;
+    }
+
+
+    public void generate(Path outDir) {
+        //resolveIDs(modules);
+        modules.forEach(m -> {
+            try {
+                m.generate(outDir, this);
+            } catch (IOException ex) {
+                throw new UncheckedIOException(ex);
+            }
+        });
+    }
+
+    public void generate(String dir)
+            throws ParserConfigurationException, IOException, SAXException {
+        generate(Paths.get(dir));
+    }
+
+    public ModuleGenerator moduleById(String id) {
+        String real_id = getId(id);
+        return modules.stream()
+                            .filter(m -> m.id.equals(real_id))
+                            .findAny().orElseThrow(() -> new IllegalStateException("No module with id: " + real_id));
+    }
+
+    public PackageGenerator packageById(String id) {
+        String real_id = getId(id);
+        return modules.stream()
+                .flatMap(m -> m.packages.stream())
+                .filter(p -> p.id.equals(real_id)).findAny()
+                .orElseThrow(() -> new IllegalStateException("No package with id: " + real_id));
+    }
+
+    public String classById(String id) {
+        String real_id = getId(id);
+        return modules.stream()
+                .flatMap(m -> m.packages.stream())
+                .peek(p -> System.out.println(p.packageName + " " + p.idBases.size()))
+                .flatMap(p -> p.idBases.entrySet().stream()
+                    .filter(e -> e.getKey().equals(real_id))
+                    .map(e -> p.packageName + "." + e.getValue().name.toString())
+                    .peek(System.out::println))
+                .findAny().orElseThrow(() -> new IllegalStateException("No class with id: " + id));
+    }
+
+    public boolean isId(String name) {
+        return name.startsWith("$");
+    }
+
+    public boolean isIdEqual(String name, String id) {
+        return isId(name) && getId(name).equals(id);
+    }
+
+    public String getId(String name) {
+        if(!isId(name)) {
+            throw new IllegalStateException("Not an id: " + name);
         }
-        public Fault(String msg, Throwable th) {
-            super(msg, th);
-        }
+        return name.substring(1);
     }
 }
--- a/langtools/test/jdk/javadoc/tool/sampleapi/lib/sampleapi/SampleApiDefaultRunner.java	Thu Feb 16 14:47:39 2017 -0800
+++ b/langtools/test/jdk/javadoc/tool/sampleapi/lib/sampleapi/SampleApiDefaultRunner.java	Tue Feb 21 15:38:07 2017 -0800
@@ -23,9 +23,9 @@
 
 package sampleapi;
 
-import java.io.File;
-
-import sampleapi.SampleApi.Fault;
+import java.nio.file.Files;
+import java.nio.file.Path;
+import java.nio.file.Paths;
 
 public class SampleApiDefaultRunner {
 
@@ -132,12 +132,12 @@
             return 1;
         }
 
-        File resDir = new File(resDirName);
-        File outDir = new File(outDirName);
-        outDir.mkdirs();
+        Path resDir = Paths.get(resDirName);
+        Path outDir = Paths.get(outDirName);
+        Files.createDirectories(outDir);
         SampleApi apiGen = new SampleApi();
 
-        apiGen.generate(resDir, outDir);
+        apiGen.load(resDir).generate(outDir);
 
         return 0;
     }
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/langtools/test/jdk/javadoc/tool/sampleapi/lib/sampleapi/generator/ModuleGenerator.java	Tue Feb 21 15:38:07 2017 -0800
@@ -0,0 +1,270 @@
+/*
+ * Copyright (c) 2016, 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.
+ *
+ * This code is distributed in the hope that it will be useful, but WITHOUT
+ * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
+ * FITNESS FOR A PARTICULAR PURPOSE.  See the GNU General Public License
+ * version 2 for more details (a copy is included in the LICENSE file that
+ * accompanied this code).
+ *
+ * You should have received a copy of the GNU General Public License version
+ * 2 along with this work; if not, write to the Free Software Foundation,
+ * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
+ *
+ * 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 sampleapi.generator;
+
+import com.sun.source.tree.ModuleTree.ModuleKind;
+import com.sun.tools.javac.code.Symbol;
+import com.sun.tools.javac.parser.Scanner;
+import com.sun.tools.javac.parser.ScannerFactory;
+import com.sun.tools.javac.parser.Tokens;
+import com.sun.tools.javac.tree.JCTree;
+import com.sun.tools.javac.tree.JCTree.JCDirective;
+import com.sun.tools.javac.tree.JCTree.JCExpression;
+import com.sun.tools.javac.tree.TreeMaker;
+import com.sun.tools.javac.util.Context;
+import com.sun.tools.javac.util.Names;
+import com.sun.tools.javac.util.ListBuffer;
+import java.io.IOException;
+import java.io.OutputStream;
+import java.nio.file.Files;
+import java.nio.file.Path;
+import java.util.List;
+import java.util.ArrayList;
+import org.w3c.dom.Element;
+import org.w3c.dom.NodeList;
+
+import sampleapi.SampleApi;
+import sampleapi.util.PoorDocCommentTable;
+
+import static com.sun.tools.javac.parser.Tokens.Comment.CommentStyle.JAVADOC;
+
+/**
+ *
+ * This class is responsible for loading module description from an XML and then generating the
+ * <code>module-info.java</code>. It is using {@link PackageGenerator} class for parsing content of the module.
+ */
+public class ModuleGenerator {
+
+    private static final String UNNAMED = "UNNAMED";
+    private static final String MODULE_INFO = "module-info.java";
+
+    public String name;
+    public String id;
+    public ModuleKind kind;
+    public final List<Exports> exportss = new ArrayList<>();
+    public final List<Opens> openss = new ArrayList<>();
+    public final List<Requires> requiress = new ArrayList<>();
+    public final List<Uses> usess = new ArrayList<>();
+    public final List<Provides> providess = new ArrayList<>();
+    public final List<PackageGenerator> packages = new ArrayList<>();
+
+    private ModuleGenerator() {
+    }
+
+    public static ModuleGenerator load(Element rootElement) {
+        ModuleGenerator result = new ModuleGenerator();
+        result.name = rootElement.getAttribute("name");
+        result.id = rootElement.getAttribute("id");
+        String kind = rootElement.getAttribute("kind");
+        result.kind = kind.isEmpty() ? ModuleKind.STRONG :
+                ModuleKind.valueOf(kind.toUpperCase());
+        //exports
+        NodeList exportsList = rootElement.getElementsByTagName("exports");
+        for (int i = 0; i < exportsList.getLength(); i++) {
+            Element exportsEl = (Element) exportsList.item(i);
+            Exports exports = new Exports(exportsEl.getAttribute("package"));
+            NodeList toList = exportsEl.getElementsByTagName("to");
+            for (int j = 0; j < toList.getLength(); j++) {
+                Element toElement = (Element) toList.item(j);
+                exports.modules.add(toElement.getAttribute("module"));
+            }
+            result.exportss.add(exports);
+        }
+        //opens
+        NodeList opensList = rootElement.getElementsByTagName("opens");
+        for (int i = 0; i < opensList.getLength(); i++) {
+            Element opensEl = (Element) opensList.item(i);
+            Opens opens = new Opens(opensEl.getAttribute("package"));
+            NodeList toList = opensEl.getElementsByTagName("to");
+            for (int j = 0; j < toList.getLength(); j++) {
+                Element toElement = (Element) toList.item(j);
+                opens.modules.add(toElement.getAttribute("module"));
+            }
+            result.openss.add(opens);
+        }
+        //requires
+        NodeList requiresList = rootElement.getElementsByTagName("requires");
+        for (int i = 0; i < requiresList.getLength(); i++) {
+            Element requiresEl = (Element) requiresList.item(i);
+            result.requiress.add(new Requires(requiresEl.getAttribute("module"),
+                    Boolean.parseBoolean(requiresEl.getAttribute("transitive")),
+                    Boolean.parseBoolean(requiresEl.getAttribute("static"))));
+        }
+        //uses
+        NodeList usesList = rootElement.getElementsByTagName("uses");
+        for (int i = 0; i < usesList.getLength(); i++) {
+            Element usesEl = (Element) usesList.item(i);
+            result.usess.add(new Uses(usesEl.getAttribute("service")));
+        }
+        //provides
+        NodeList providesList = rootElement.getElementsByTagName("provides");
+        for (int i = 0; i < providesList.getLength(); i++) {
+            Element providesEl = (Element) providesList.item(i);
+            Provides provides = new Provides(providesEl.getAttribute("service"));
+            NodeList implList = providesEl.getElementsByTagName("implementation");
+            for (int j = 0; j < implList.getLength(); j++) {
+                Element implElement = (Element) implList.item(j);
+                provides.implementations.add(implElement.getAttribute("class"));
+            }
+            result.providess.add(provides);
+        }
+        //packages
+        NodeList packagesList = rootElement.getElementsByTagName("package");
+        for (int i = 0; i < packagesList.getLength(); i++) {
+            result.packages.add(PackageGenerator
+                    .processDataSet((Element) packagesList.item(i)));
+        }
+        return result;
+    }
+
+    public void generate(Path outDir, SampleApi api) throws IOException {
+        Files.createDirectories(outDir);
+        Path moduleSourceDir;
+        if (!name.equals(UNNAMED)) {
+            moduleSourceDir = outDir.resolve(name);
+            Files.createDirectory(moduleSourceDir);
+            generateModuleInfo(moduleSourceDir, api);
+        } else {
+            moduleSourceDir = outDir;
+        }
+        packages.forEach(pkg -> pkg.generate(moduleSourceDir));
+    }
+
+    private void generateModuleInfo(Path moduleSourceDir, SampleApi api) throws IOException {
+        TreeMaker make = TreeMaker.instance(api.getContext());
+        Names names = Names.instance(api.getContext());
+        JCTree.JCExpression modQual = make.QualIdent(
+                new Symbol.ModuleSymbol(names.fromString(name), null));
+        ListBuffer<JCDirective> exportsBuffer = new ListBuffer<>();
+        exportss.forEach(e -> {
+            ListBuffer<JCExpression> modulesBuffer = new ListBuffer<>();
+            e.modules.stream()
+                    .map(m -> api.isId(m) ? api.moduleById(m).name : m)
+                    .forEach(m -> {
+                modulesBuffer.add(make.Ident(
+                        names.fromString(m)));
+            });
+            exportsBuffer.add(make.Exports(
+                    make.Ident(names.fromString(api.isId(e.pkg) ?
+                            api.packageById(e.pkg).packageName : e.pkg)),
+                    (modulesBuffer.size() > 0) ? modulesBuffer.toList() : null));
+        });
+        openss.forEach(o -> {
+            ListBuffer<JCExpression> modulesBuffer = new ListBuffer<>();
+            o.modules.stream()
+                    .map(m -> api.isId(m) ? api.moduleById(m).name : m)
+                    .forEach(m -> {
+                modulesBuffer.add(make.Ident(
+                        names.fromString(m)));
+            });
+            exportsBuffer.add(make.Opens(
+                    make.Ident(names.fromString(api.isId(o.pkg) ?
+                            api.packageById(o.pkg).packageName : o.pkg)),
+                    (modulesBuffer.size() > 0) ? modulesBuffer.toList() : null));
+        });
+        ListBuffer<JCDirective> requiresBuffer = new ListBuffer<>();
+        requiress.forEach(r -> requiresBuffer.add(make.Requires(
+                r.transitive, r.statc,
+                make.Ident(names.fromString(api.isId(r.module)
+                        ? api.moduleById(r.module).name : r.module)))));
+        ListBuffer<JCDirective> usesBuffer = new ListBuffer<>();
+        usess.forEach(u -> usesBuffer
+                .add(make.Uses(make.Ident(names.fromString(api.isId(u.service)
+                        ? api.classById(u.service) : u.service)))));
+        ListBuffer<JCDirective> providesBuffer = new ListBuffer<>();
+        providess.forEach(p -> {
+            ListBuffer<JCExpression> implementationsBuffer = new ListBuffer<>();
+            p.implementations.stream()
+                    .map(c -> api.isId(c) ? api.classById(c) : c)
+                    .forEach(i -> {
+                implementationsBuffer.add(make.Ident(names.fromString(i)));
+            });
+            providesBuffer.add(make.Provides(
+                make.Ident(names.fromString(api.isId(p.service) ?
+                        api.classById(p.service) : p.service)),
+                implementationsBuffer.toList()));
+        });
+        ListBuffer<JCDirective> fullList = new ListBuffer<>();
+        fullList.addAll(exportsBuffer.toList());
+        fullList.addAll(requiresBuffer.toList());
+        fullList.addAll(usesBuffer.toList());
+        fullList.addAll(providesBuffer.toList());
+        JCTree.JCModuleDecl mod = make.ModuleDef(
+                make.Modifiers(0), //TODO how to support this?
+                kind, modQual, fullList.toList());
+        ListBuffer<JCTree> top = new ListBuffer<>();
+        top.add(mod);
+        JCTree.JCCompilationUnit compilationUnit = make.TopLevel(top.toList());
+        try (OutputStream module_info = Files.newOutputStream(moduleSourceDir.resolve(MODULE_INFO))) {
+            module_info.write(compilationUnit.toString().getBytes());
+        }
+    }
+
+
+    public static class Requires {
+        public String module;
+        public boolean transitive;
+        public boolean statc;
+
+        private Requires(String module, boolean transitive, boolean statc) {
+            this.module = module;
+            this.transitive = transitive;
+            this.statc = this.statc;
+        }
+    }
+
+    public static class Exports {
+        public final String pkg;
+        public final List<String> modules = new ArrayList<>();
+
+        private Exports(String pkg) {
+            this.pkg = pkg;
+        }
+    }
+
+    public static class Opens {
+        public final String pkg;
+        public final List<String> modules = new ArrayList<>();
+
+        private Opens(String pkg) {
+            this.pkg = pkg;
+        }
+    }
+
+    public static class Uses {
+        public final String service;
+
+        private Uses(String service) {
+            this.service = service;
+        }
+    }
+
+    public static class Provides {
+        public final String service;
+        public final List<String> implementations = new ArrayList<>();
+
+        private Provides(String service) {
+            this.service = service;
+        }
+    }
+}
--- a/langtools/test/jdk/javadoc/tool/sampleapi/lib/sampleapi/generator/PackageGenerator.java	Thu Feb 16 14:47:39 2017 -0800
+++ b/langtools/test/jdk/javadoc/tool/sampleapi/lib/sampleapi/generator/PackageGenerator.java	Tue Feb 21 15:38:07 2017 -0800
@@ -25,17 +25,11 @@
 
 import java.io.File;
 import java.io.FileWriter;
-import java.io.InputStream;
-import java.io.FileInputStream;
 import java.io.IOException;
 import java.util.ArrayList;
 import java.util.HashMap;
 import java.util.Map;
 import javax.xml.parsers.DocumentBuilderFactory;
-import javax.xml.parsers.DocumentBuilder;
-import javax.xml.parsers.ParserConfigurationException;
-import org.xml.sax.SAXException;
-import org.w3c.dom.Document;
 import org.w3c.dom.Element;
 import org.w3c.dom.Node;
 import org.w3c.dom.NodeList;
@@ -56,18 +50,19 @@
 import com.sun.tools.javac.code.TypeTag;
 import com.sun.tools.javac.code.Symbol;
 import com.sun.tools.javac.code.Symtab;
+import java.nio.file.Path;
 
 import sampleapi.util.*;
-import sampleapi.SampleApi.Fault;
 
 public class PackageGenerator {
 
-    String packageName;
+    public String packageName;
     String packageDirName;
+    public String id;
 
     ArrayList<JCCompilationUnit> topLevels;
     Map<String, Integer> nameIndex;
-    Map<String, JCClassDecl> idBases;
+    public Map<String, JCClassDecl> idBases;
     Map<String, JCAnnotation> idAnnos;
 
     TreeMaker make;
@@ -92,48 +87,43 @@
 
     boolean isDataSetProcessed = false;
 
-    public void processDataSet(File dsFile) throws Fault {
-        isDataSetProcessed = true;
-        topLevels = new ArrayList<>();
-        nameIndex = new HashMap<>();
-        idBases =  new HashMap<>();
-        idAnnos =  new HashMap<>();
-        fx = false;
+    public static PackageGenerator processDataSet(Element rootElement) {
+        PackageGenerator result = new PackageGenerator();
+        result.isDataSetProcessed = true;
+        result.topLevels = new ArrayList<>();
+        result.nameIndex = new HashMap<>();
+        result.idBases = new HashMap<>();
+        result.idAnnos = new HashMap<>();
+        result.fx = false;
+
+        if (!rootElement.getTagName().equals("package")) {
+            throw new IllegalStateException("Unexpected tag name: "
+                    + rootElement.getTagName());
+        }
+        result.packageName = rootElement.getAttribute("name");
+        result.id = rootElement.getAttribute("id");
+        result.fx = "fx".equals(rootElement.getAttribute("style"));
+        result.packageDirName = result.packageName.replace('.', '/');
+
+        // process nodes (toplevels)
+        NodeList nodeList = rootElement.getChildNodes();
+        for (int i = 0; i < nodeList.getLength(); i++) {
+            Node node = nodeList.item(i);
+
+            if (!(node instanceof Element)) {
+                continue;
+            }
+            result.processTopLevel((Element) node);
+        }
+        return result;
+    }
+
+    public void generate(Path outDir) {
+        if (!isDataSetProcessed)
+            throw new RuntimeException("No Data Set processed");
 
         try {
-            InputStream is = new FileInputStream(dsFile);
-
-            DocumentBuilder builder = factory.newDocumentBuilder();
-            Document document = builder.parse(is);
-
-            Element rootElement = document.getDocumentElement();
-            if (!rootElement.getTagName().equals("package"))
-                throw new IllegalStateException("Unexpected tag name: "
-                        + rootElement.getTagName());
-            packageName = rootElement.getAttribute("name");
-            fx = "fx".equals(rootElement.getAttribute("style"));
-            packageDirName = packageName.replace('.', '/');
-
-            // process nodes (toplevels)
-            NodeList nodeList = rootElement.getChildNodes();
-            for (int i = 0; i < nodeList.getLength(); i++) {
-                Node node = nodeList.item(i);
-
-                if (!(node instanceof Element))
-                    continue;
-                processTopLevel((Element) node);
-            }
-        } catch (ParserConfigurationException | SAXException | IOException e) {
-            throw new Fault("Error parsing dataset " + dsFile, e);
-        }
-    }
-
-    public void generate(File outDir) throws Fault {
-        if (!isDataSetProcessed)
-            throw new Fault("No Data Set processed");
-
-        try {
-            File pkgDir = new File(outDir, packageDirName);
+            File pkgDir = new File(outDir.toFile(), packageDirName);
             pkgDir.mkdirs();
 
             for (JCCompilationUnit decl : topLevels) {
@@ -168,7 +158,7 @@
             writer.flush();
             writer.close();
         } catch (IOException e) {
-            throw new Fault("Error writing output");
+            throw new RuntimeException("Error writing output");
         }
     }
 
@@ -211,6 +201,7 @@
         String baseName = baseTag.getAttribute("basename");
         String typeParam = baseTag.getAttribute("tparam");
         String baseId = baseTag.getAttribute("id");
+        System.out.println("Found class id: " + baseId);
 
         long kindFlag = 0;
         switch (kind) {
--- a/langtools/test/jdk/javadoc/tool/sampleapi/lib/sampleapi/util/SimpleMultiplier.java	Thu Feb 16 14:47:39 2017 -0800
+++ b/langtools/test/jdk/javadoc/tool/sampleapi/lib/sampleapi/util/SimpleMultiplier.java	Tue Feb 21 15:38:07 2017 -0800
@@ -72,8 +72,8 @@
     }
 
     public void initIterator() {
+        size = 1;
         if (!valueSpace.isEmpty()) {
-            size = 1;
             for (int i = 0; i < valueSpace.size(); i++)
                 size *= valueSpace.get(i).size();
         }
--- a/langtools/test/jdk/javadoc/tool/sampleapi/res/fx.xml	Thu Feb 16 14:47:39 2017 -0800
+++ b/langtools/test/jdk/javadoc/tool/sampleapi/res/fx.xml	Tue Feb 21 15:38:07 2017 -0800
@@ -21,25 +21,27 @@
  or visit www.oracle.com if you need additional information or have any
  questions.
 -->
-<package name="sampleapi.fx" style="fx">
-
-    <class basename="FXClass">
-        <modifier>public</modifier>
-        <member>
-            <field basename="id">
+<sampleapi>
+    <module name="UNNAMED">
+        <package name="sampleapi.fx" style="fx">
+            <class basename="FXClass">
                 <modifier>public</modifier>
-                <type>int|boolean</type>
-            </field>
-            <method basename="setProp">
-                <modifier>public|protected|private</modifier>
-                <param>int|String</param>
-                <type>void</type>
-            </method>
-            <method basename="getProp">
-                <modifier>public|protected|private</modifier>
-                <type>int|int|String</type>
-            </method>
-        </member>
-    </class>
-
-</package>
+                <member>
+                    <field basename="id">
+                        <modifier>public</modifier>
+                        <type>int|boolean</type>
+                    </field>
+                    <method basename="setProp">
+                        <modifier>public|protected|private</modifier>
+                        <param>int|String</param>
+                        <type>void</type>
+                    </method>
+                    <method basename="getProp">
+                        <modifier>public|protected|private</modifier>
+                        <type>int|int|String</type>
+                    </method>
+                </member>
+            </class>
+        </package>
+    </module>
+</sampleapi>
--- a/langtools/test/jdk/javadoc/tool/sampleapi/res/simple.xml	Thu Feb 16 14:47:39 2017 -0800
+++ b/langtools/test/jdk/javadoc/tool/sampleapi/res/simple.xml	Tue Feb 21 15:38:07 2017 -0800
@@ -21,509 +21,512 @@
  or visit www.oracle.com if you need additional information or have any
  questions.
 -->
-<package name="sampleapi.simple">
+<sampleapi>
+    <module name="UNNAMED">
+        <package name="sampleapi.simple">
+            <class basename="SampleClass" id="baseclass">
+                <modifier>public</modifier>
+                <modifier>none|abstract</modifier>
+                <member>
+                    <field basename="field">
+                        <modifier>none|public</modifier>
+                        <modifier>none|static</modifier>
+                        <modifier>none|final</modifier>
+                        <type>boolean|int|String</type>
+                    </field>
+                    <field basename="field">
+                        <modifier>protected|private</modifier>
+                        <type>String</type>
+                    </field>
+                    <constructor>
+                        <modifier>public</modifier>
+                        <param>none|int|int,boolean|int,String</param>
+                    </constructor>
+                    <constructor>
+                        <modifier>public</modifier>
+                        <param>String</param>
+                        <throw>NullPointerException</throw>
+                        <throw>SampleException0</throw>
+                    </constructor>
+                    <method basename="set">
+                        <modifier>public</modifier>
+                        <type>void</type>
+                        <param>int</param>
+                    </method>
+                    <method basename="get">
+                        <modifier>public</modifier>
+                        <type>int|boolean|String</type>
+                    </method>
+                    <method basename="doSomething">
+                        <modifier>public</modifier>
+                        <type>void|int</type>
+                        <param>none|int|Object,int</param>
+                        <throw>NullPointerException</throw>
+                        <throw>ArithmeticException</throw>
+                    </method>
+                </member>
+            </class>
 
-    <class basename="SampleClass" id="baseclass">
-        <modifier>public</modifier>
-        <modifier>none|abstract</modifier>
-        <member>
-            <field basename="field">
-                <modifier>none|public</modifier>
-                <modifier>none|static</modifier>
-                <modifier>none|final</modifier>
-                <type>boolean|int|String</type>
-            </field>
-            <field basename="field">
-                <modifier>protected|private</modifier>
-                <type>String</type>
-            </field>
-            <constructor>
+            <class basename="Derived">
                 <modifier>public</modifier>
-                <param>none|int|int,boolean|int,String</param>
-            </constructor>
-            <constructor>
+                <extend id="baseclass"/>
+                <member>
+                    <field basename="myField">
+                        <modifier>public</modifier>
+                        <type>int|boolean</type>
+                    </field>
+                    <constructor>
+                        <modifier>public</modifier>
+                        <param>none|int|int,boolean|int,String</param>
+                    </constructor>
+                    <method basename="myGet">
+                        <modifier>public</modifier>
+                        <type>int|boolean</type>
+                    </method>
+                </member>
+            </class>
+
+            <class basename="SampleSerial">
+                <import>java.io.Serializable</import>
                 <modifier>public</modifier>
-                <param>String</param>
-                <throw>NullPointerException</throw>
-                <throw>SampleException0</throw>
-            </constructor>
-            <method basename="set">
-                <modifier>public</modifier>
-                <type>void</type>
-                <param>int</param>
-            </method>
-            <method basename="get">
-                <modifier>public</modifier>
-                <type>int|boolean|String</type>
-            </method>
-            <method basename="doSomething">
-                <modifier>public</modifier>
-                <type>void|int</type>
-                <param>none|int|Object,int</param>
-                <throw>NullPointerException</throw>
-                <throw>ArithmeticException</throw>
-            </method>
-        </member>
-    </class>
-
-    <class basename="Derived">
-        <modifier>public</modifier>
-        <extend id="baseclass"/>
-        <member>
-            <field basename="myField">
-                <modifier>public</modifier>
-                <type>int|boolean</type>
-            </field>
-            <constructor>
-                <modifier>public</modifier>
-                <param>none|int|int,boolean|int,String</param>
-            </constructor>
-            <method basename="myGet">
-                <modifier>public</modifier>
-                <type>int|boolean</type>
-            </method>
-        </member>
-    </class>
-
-    <class basename="SampleSerial">
-        <import>java.io.Serializable</import>
-        <modifier>public</modifier>
-        <implement ref="Serializable"/>
-        <member>
-            <field basename="specialData">
-                <modifier>private|none|public</modifier>
-                <type>boolean|int|String</type>
-            </field>
-        </member>
-    </class>
-
-    <class basename="SampleSerial">
-        <import>java.io.Serializable</import>
-        <import>java.io.ObjectStreamField</import>
-        <modifier>public</modifier>
-        <implement ref="Serializable"/>
-        <member>
-            <serialfield basename="serialField">String,Long,Boolean</serialfield>
-            <method basename="justToBeHere">
-                <modifier>public</modifier>
-                <type>String|long|boolean</type>
-            </method>
-        </member>
-    </class>
-
-    <class basename="SampleSerial">
-        <import>java.io.Serializable</import>
-        <import>java.io.ObjectOutputStream</import>
-        <import>java.io.ObjectOutput</import>
-        <import>java.io.IOException</import>
-        <import>java.io.ObjectStreamException</import>
-        <modifier>public</modifier>
-        <implement ref="Serializable"/>
-        <member>
-            <method name="writeObject">
-                <modifier>private</modifier>
-                <param>ObjectOutputStream</param>
-                <type>void</type>
-                <throw>IOException</throw>
-            </method>
-            <method name="writeExternal">
-                <modifier>public</modifier>
-                <param>ObjectOutput</param>
-                <type>void</type>
-                <throw>IOException</throw>
-            </method>
-            <method name="writeReplace">
-                <modifier>protected</modifier>
-                <param>none</param>
-                <type>Object</type>
-                <throw>ObjectStreamException</throw>
-            </method>
-            <method name="writeSomethingElse">
-                <modifier>public</modifier>
-                <param>Object</param>
-                <type>void</type>
-                <throw>IOException</throw>
-            </method>
-        </member>
-    </class>
-
-    <class basename="SampleSerial">
-        <import>java.io.Serializable</import>
-        <import>java.io.ObjectInputStream</import>
-        <import>java.io.ObjectInput</import>
-        <import>java.io.IOException</import>
-        <import>java.io.ObjectStreamException</import>
-        <modifier>public</modifier>
-        <implement ref="Serializable"/>
-        <member>
-            <method name="readObject">
-                <modifier>private</modifier>
-                <param>ObjectInputStream</param>
-                <type>void</type>
-                <throw>IOException</throw>
-                <throw>ClassNotFoundException</throw>
-            </method>
-            <method name="readExternal">
-                <modifier>public</modifier>
-                <param>ObjectInput</param>
-                <type>void</type>
-                <throw>IOException</throw>
-            </method>
-            <method name="readResolve">
-                <modifier>protected</modifier>
-                <param>none</param>
-                <type>Object</type>
-                <throw>ObjectStreamException</throw>
-            </method>
-            <method name="readSomethingElse">
-                <modifier>public</modifier>
-                <param>Object</param>
-                <type>void</type>
-                <throw>IOException</throw>
-            </method>
-        </member>
-    </class>
-
-    <class basename="Container">
-        <modifier>public</modifier>
-        <member>
-            <class basename="Inner">
-                <modifier>public</modifier>
+                <implement ref="Serializable"/>
                 <member>
-                    <field basename="value">
-                        <modifier>public</modifier>
-                        <type>int</type>
+                    <field basename="specialData">
+                        <modifier>private|none|public</modifier>
+                        <type>boolean|int|String</type>
                     </field>
                 </member>
             </class>
-            <class basename="Nested">
+
+            <class basename="SampleSerial">
+                <import>java.io.Serializable</import>
+                <import>java.io.ObjectStreamField</import>
                 <modifier>public</modifier>
-                <modifier>static</modifier>
+                <implement ref="Serializable"/>
+                <member>
+                    <serialfield basename="serialField">String,Long,Boolean</serialfield>
+                    <method basename="justToBeHere">
+                        <modifier>public</modifier>
+                        <type>String|long|boolean</type>
+                    </method>
+                </member>
             </class>
-            <interface basename="EventListener">
+
+            <class basename="SampleSerial">
+                <import>java.io.Serializable</import>
+                <import>java.io.ObjectOutputStream</import>
+                <import>java.io.ObjectOutput</import>
+                <import>java.io.IOException</import>
+                <import>java.io.ObjectStreamException</import>
                 <modifier>public</modifier>
-                <modifier>static</modifier>
+                <implement ref="Serializable"/>
                 <member>
-                    <method basename="onEvent">
-                         <modifier>public</modifier>
-                         <type>void</type>
+                    <method name="writeObject">
+                        <modifier>private</modifier>
+                        <param>ObjectOutputStream</param>
+                        <type>void</type>
+                        <throw>IOException</throw>
+                    </method>
+                    <method name="writeExternal">
+                        <modifier>public</modifier>
+                        <param>ObjectOutput</param>
+                        <type>void</type>
+                        <throw>IOException</throw>
+                    </method>
+                    <method name="writeReplace">
+                        <modifier>protected</modifier>
+                        <param>none</param>
+                        <type>Object</type>
+                        <throw>ObjectStreamException</throw>
+                    </method>
+                    <method name="writeSomethingElse">
+                        <modifier>public</modifier>
+                        <param>Object</param>
+                        <type>void</type>
+                        <throw>IOException</throw>
+                    </method>
+                </member>
+            </class>
+
+            <class basename="SampleSerial">
+                <import>java.io.Serializable</import>
+                <import>java.io.ObjectInputStream</import>
+                <import>java.io.ObjectInput</import>
+                <import>java.io.IOException</import>
+                <import>java.io.ObjectStreamException</import>
+                <modifier>public</modifier>
+                <implement ref="Serializable"/>
+                <member>
+                    <method name="readObject">
+                        <modifier>private</modifier>
+                        <param>ObjectInputStream</param>
+                        <type>void</type>
+                        <throw>IOException</throw>
+                        <throw>ClassNotFoundException</throw>
+                    </method>
+                    <method name="readExternal">
+                        <modifier>public</modifier>
+                        <param>ObjectInput</param>
+                        <type>void</type>
+                        <throw>IOException</throw>
+                    </method>
+                    <method name="readResolve">
+                        <modifier>protected</modifier>
+                        <param>none</param>
+                        <type>Object</type>
+                        <throw>ObjectStreamException</throw>
+                    </method>
+                    <method name="readSomethingElse">
+                        <modifier>public</modifier>
+                        <param>Object</param>
+                        <type>void</type>
+                        <throw>IOException</throw>
+                    </method>
+                </member>
+            </class>
+
+            <class basename="Container">
+                <modifier>public</modifier>
+                <member>
+                    <class basename="Inner">
+                        <modifier>public</modifier>
+                        <member>
+                            <field basename="value">
+                                <modifier>public</modifier>
+                                <type>int</type>
+                            </field>
+                        </member>
+                    </class>
+                    <class basename="Nested">
+                        <modifier>public</modifier>
+                        <modifier>static</modifier>
+                    </class>
+                    <interface basename="EventListener">
+                        <modifier>public</modifier>
+                        <modifier>static</modifier>
+                        <member>
+                            <method basename="onEvent">
+                                <modifier>public</modifier>
+                                <type>void</type>
+                            </method>
+                        </member>
+                    </interface>
+                </member> 
+            </class>
+
+            <!-- Errors and exceptions -->
+            <class basename="SampleError">
+                <modifier>public</modifier>
+                <extend ref="java.lang.Error"/>
+                <member>
+                    <field basename="errorInfo">
+                        <modifier>private</modifier>
+                        <type>boolean|int|String</type>
+                    </field>
+                    <constructor>
+                        <modifier>public</modifier>
+                        <param>String</param>
+                    </constructor>
+                    <method basename="getSampleData">
+                        <modifier>public</modifier>
+                        <type>int|String</type>
+                    </method>
+                </member>
+            </class>
+
+            <class basename="SampleException">
+                <modifier>public</modifier>
+                <extend ref="java.lang.Exception"/>
+                <member>
+                    <field basename="exceptionInfo">
+                        <modifier>private</modifier>
+                        <type>boolean|int|String</type>
+                    </field>
+                    <constructor>
+                        <modifier>public</modifier>
+                        <param>String</param>
+                    </constructor>
+                    <method basename="getSampleData">
+                        <modifier>public</modifier>
+                        <type>int|String</type>
+                    </method>
+                </member>
+            </class>
+
+            <interface basename="SampleInterface" id="baseinterface">
+                <modifier>public|none</modifier>
+                <member>
+                    <method basename="method">
+                        <modifier>public</modifier>
+                        <type>void|int|Object</type>
                     </method>
                 </member>
             </interface>
-        </member> 
-    </class>
 
-    <!-- Errors and exceptions -->
-    <class basename="SampleError">
-        <modifier>public</modifier>
-        <extend ref="java.lang.Error"/>
-        <member>
-            <field basename="errorInfo">
-                <modifier>private</modifier>
-                <type>boolean|int|String</type>
-            </field>
-            <constructor>
+            <class basename="Implementor">
                 <modifier>public</modifier>
-                <param>String</param>
-            </constructor>
-            <method basename="getSampleData">
+                <implement id="baseinterface"/>
+                <member>
+                    <field basename="myField">
+                        <modifier>public</modifier>
+                        <type>int|boolean</type>
+                    </field>
+                    <method basename="myGet">
+                        <modifier>public</modifier>
+                        <type>int|boolean</type>
+                    </method>
+                </member>
+            </class>
+
+            <class basename="GenericClass" tparam="T">
+                <import>java.util.List</import>
                 <modifier>public</modifier>
-                <type>int|String</type>
-            </method>
-        </member>
-    </class>
+                <member>
+                    <method basename="put">
+                        <modifier>public</modifier>
+                        <type>void</type>
+                        <param>T</param>
+                    </method>
+                    <method basename="get">
+                        <modifier>public</modifier>
+                        <type>T</type>
+                        <param>int</param>
+                    </method>
+                    <method basename="get">
+                        <modifier>public</modifier>
+                        <type>List&lt;T&gt;</type>
+                    </method>
+                </member>
+            </class>
 
-    <class basename="SampleException">
-        <modifier>public</modifier>
-        <extend ref="java.lang.Exception"/>
-        <member>
-            <field basename="exceptionInfo">
-                <modifier>private</modifier>
-                <type>boolean|int|String</type>
-            </field>
-            <constructor>
+            <class basename="GenericClass" tparam="K,V">
+                <import>java.util.Set</import>
+                <import>java.util.List</import>
+                <import>java.util.Map</import>
                 <modifier>public</modifier>
-                <param>String</param>
-            </constructor>
-            <method basename="getSampleData">
+                <member>
+                    <method basename="put">
+                        <modifier>public</modifier>
+                        <type>void</type>
+                        <param>K,V</param>
+                    </method>
+                    <method basename="putMap">
+                        <modifier>public</modifier>
+                        <type>void</type>
+                        <param>Map&lt;K,V&gt;</param>
+                    </method>
+                    <method basename="get">
+                        <modifier>public</modifier>
+                        <type>V</type>
+                        <param>K</param>
+                    </method>
+                    <method basename="getV">
+                        <modifier>public</modifier>
+                        <type>Set&lt;V&gt;|List&lt;V&gt;</type>
+                    </method>
+                    <method basename="getK">
+                        <modifier>public</modifier>
+                        <type>Set&lt;K&gt;|List&lt;K&gt;</type>
+                    </method>
+                </member>
+            </class>
+
+            <class basename="GenericClass" tparam="M,N,O">
+                <import>java.util.Set</import>
+                <import>java.util.List</import>
+                <import>java.util.Map</import>
                 <modifier>public</modifier>
-                <type>int|String</type>
-            </method>
-        </member>
-    </class>
+                <member>
+                    <method basename="get">
+                        <modifier>public</modifier>
+                        <type>Set&lt;M&gt;|List&lt;M&gt;</type>
+                        <param>Map&lt;N,O&gt;</param>
+                    </method>
+                    <method basename="get">
+                        <modifier>public</modifier>
+                        <type>Set&lt;N&gt;|List&lt;N&gt;</type>
+                        <param>Map&lt;M,O&gt;</param>
+                    </method>
+                    <method basename="get">
+                        <modifier>public</modifier>
+                        <type>Set&lt;O&gt;|List&lt;O&gt;</type>
+                        <param>Map&lt;M,N&gt;</param>
+                    </method>
+                </member>
+            </class>
 
-    <interface basename="SampleInterface" id="baseinterface">
-        <modifier>public|none</modifier>
-        <member>
-            <method basename="method">
+            <class basename="GenericUtil"> <!-- public static generic methods like Collections -->
+                <import>java.util.Set</import>
+                <import>java.util.List</import>
+                <import>java.util.Map</import>
+                <import>java.util.function.Supplier</import>
                 <modifier>public</modifier>
-                <type>void|int|Object</type>
-            </method>
-        </member>
-    </interface>
+                <member>
+                    <method tparam="E" basename="getSomething">
+                        <modifier>public</modifier>
+                        <modifier>static</modifier>
+                        <type>Set&lt;? extends E&gt;|List&lt;? extends E&gt;</type>
+                    </method>
+                    <method tparam="V,K" basename="getMore">
+                        <modifier>public|private</modifier>
+                        <modifier>static</modifier>
+                        <type>Map&lt;V,K&gt;</type>
+                    </method>
+                    <method tparam="E" basename="doSomething">
+                        <modifier>public</modifier>
+                        <modifier>static</modifier>
+                        <type>void</type>
+                        <param>E</param>
+                    </method>
+                    <method tparam="X extends Throwable" basename="orElseThrow">
+                        <modifier>public|private</modifier>
+                        <modifier>static</modifier>
+                        <type>X</type>
+                        <param>Supplier&lt;? extends X&gt;</param>
+                        <throw>X</throw>
+                    </method>
+                </member>
+            </class>
 
-    <class basename="Implementor">
-        <modifier>public</modifier>
-        <implement id="baseinterface"/>
-        <member>
-            <field basename="myField">
+            <enum basename="SampleEnum">
                 <modifier>public</modifier>
-                <type>int|boolean</type>
-            </field>
-            <method basename="myGet">
+                <member>
+                    <constant basename="VALUE" count="3"/>
+                </member>
+            </enum>
+        
+            <enum basename="SampleEnum">
                 <modifier>public</modifier>
-                <type>int|boolean</type>
-            </method>
-        </member>
-    </class>
+                <member>
+                    <constant basename="VALUE" count="2"/>
+                    <constant basename="NOVALUE" count="1"/>
+                    <field basename="field">
+                        <modifier>private</modifier>
+                        <type>int|String</type>
+                    </field>
+                    <method basename="method">
+                        <modifier>public</modifier>
+                        <type>void|String</type>
+                    </method>
+                </member>
+            </enum>
 
-    <class basename="GenericClass" tparam="T">
-        <import>java.util.List</import>
-        <modifier>public</modifier>
-        <member>
-            <method basename="put">
+            <annodecl id="documented">
+                <class>Documented</class>
+            </annodecl>
+
+            <annodecl id="reten-source">
+                <class>Retention</class>
+                <arg name="value" value="RetentionPolicy.SOURCE"/>
+            </annodecl>
+
+            <annodecl id="reten-class">
+                <class>Retention</class>
+                <arg name="value" value="RetentionPolicy.CLASS"/>
+            </annodecl>
+
+            <annodecl id="reten-runtime">
+                <class>Retention</class>
+                <arg name="value" value="RetentionPolicy.RUNTIME"/>
+            </annodecl>
+
+            <annodecl id="target-method">
+                <class>Target</class>
+                <arg value="ElementType.METHOD"/>
+            </annodecl>
+
+            <annodecl id="target-field">
+                <class>Target</class>
+                <arg value="ElementType.FIELD"/>
+            </annodecl>
+
+            <annodecl id="target-type">
+                <class>Target</class>
+                <arg value="{ElementType.TYPE, ElementType.TYPE_USE}"/>
+            </annodecl>
+
+            <annotation basename="AnnotatedAnno">
+                <import>java.lang.annotation.Documented</import>
+                <anno>@documented</anno>
                 <modifier>public</modifier>
-                <type>void</type>
-                <param>T</param>
-            </method>
-            <method basename="get">
-                <modifier>public</modifier>
-                <type>T</type>
-                <param>int</param>
-            </method>
-            <method basename="get">
-                <modifier>public</modifier>
-                <type>List&lt;T&gt;</type>
-            </method>
-        </member>
-    </class>
-
-    <class basename="GenericClass" tparam="K,V">
-        <import>java.util.Set</import>
-        <import>java.util.List</import>
-        <import>java.util.Map</import>
-        <modifier>public</modifier>
-        <member>
-            <method basename="put">
-                <modifier>public</modifier>
-                <type>void</type>
-                <param>K,V</param>
-            </method>
-            <method basename="putMap">
-                <modifier>public</modifier>
-                <type>void</type>
-                <param>Map&lt;K,V&gt;</param>
-            </method>
-            <method basename="get">
-                <modifier>public</modifier>
-                <type>V</type>
-                <param>K</param>
-            </method>
-            <method basename="getV">
-                <modifier>public</modifier>
-                <type>Set&lt;V&gt;|List&lt;V&gt;</type>
-            </method>
-            <method basename="getK">
-                <modifier>public</modifier>
-                <type>Set&lt;K&gt;|List&lt;K&gt;</type>
-            </method>
-        </member>
-    </class>
-
-    <class basename="GenericClass" tparam="M,N,O">
-        <import>java.util.Set</import>
-        <import>java.util.List</import>
-        <import>java.util.Map</import>
-        <modifier>public</modifier>
-        <member>
-            <method basename="get">
-                <modifier>public</modifier>
-                <type>Set&lt;M&gt;|List&lt;M&gt;</type>
-                <param>Map&lt;N,O&gt;</param>
-            </method>
-            <method basename="get">
-                <modifier>public</modifier>
-                <type>Set&lt;N&gt;|List&lt;N&gt;</type>
-                <param>Map&lt;M,O&gt;</param>
-            </method>
-            <method basename="get">
-                <modifier>public</modifier>
-                <type>Set&lt;O&gt;|List&lt;O&gt;</type>
-                <param>Map&lt;M,N&gt;</param>
-            </method>
-        </member>
-    </class>
-
-    <class basename="GenericUtil"> <!-- public static generic methods like Collections -->
-        <import>java.util.Set</import>
-        <import>java.util.List</import>
-        <import>java.util.Map</import>
-        <import>java.util.function.Supplier</import>
-        <modifier>public</modifier>
-        <member>
-            <method tparam="E" basename="getSomething">
-                <modifier>public</modifier>
-                <modifier>static</modifier>
-                <type>Set&lt;? extends E&gt;|List&lt;? extends E&gt;</type>
-            </method>
-            <method tparam="V,K" basename="getMore">
-                <modifier>public|private</modifier>
-                <modifier>static</modifier>
-                <type>Map&lt;V,K&gt;</type>
-            </method>
-            <method tparam="E" basename="doSomething">
-                <modifier>public</modifier>
-                <modifier>static</modifier>
-                <type>void</type>
-                <param>E</param>
-            </method>
-            <method tparam="X extends Throwable" basename="orElseThrow">
-                <modifier>public|private</modifier>
-                <modifier>static</modifier>
-                <type>X</type>
-                <param>Supplier&lt;? extends X&gt;</param>
-                <throw>X</throw>
-            </method>
-        </member>
-    </class>
-
-    <enum basename="SampleEnum">
-        <modifier>public</modifier>
-        <member>
-            <constant basename="VALUE" count="3"/>
-        </member>
-    </enum>
-        
-    <enum basename="SampleEnum">
-        <modifier>public</modifier>
-        <member>
-            <constant basename="VALUE" count="2"/>
-            <constant basename="NOVALUE" count="1"/>
-            <field basename="field">
-                <modifier>private</modifier>
-                <type>int|String</type>
-            </field>
-            <method basename="method">
-                <modifier>public</modifier>
-                <type>void|String</type>
-            </method>
-        </member>
-    </enum>
-
-    <annodecl id="documented">
-        <class>Documented</class>
-    </annodecl>
-
-    <annodecl id="reten-source">
-        <class>Retention</class>
-        <arg name="value" value="RetentionPolicy.SOURCE"/>
-    </annodecl>
-
-    <annodecl id="reten-class">
-        <class>Retention</class>
-        <arg name="value" value="RetentionPolicy.CLASS"/>
-    </annodecl>
-
-    <annodecl id="reten-runtime">
-        <class>Retention</class>
-        <arg name="value" value="RetentionPolicy.RUNTIME"/>
-    </annodecl>
-
-    <annodecl id="target-method">
-        <class>Target</class>
-        <arg value="ElementType.METHOD"/>
-    </annodecl>
-
-    <annodecl id="target-field">
-        <class>Target</class>
-        <arg value="ElementType.FIELD"/>
-    </annodecl>
-
-    <annodecl id="target-type">
-        <class>Target</class>
-        <arg value="{ElementType.TYPE, ElementType.TYPE_USE}"/>
-    </annodecl>
-
-    <annotation basename="AnnotatedAnno">
-        <import>java.lang.annotation.Documented</import>
-        <anno>@documented</anno>
-        <modifier>public</modifier>
-        <member>
-            <method basename="value">
-                <modifier>public</modifier>
-                <type>boolean|String</type>
-            </method>
-        </member>
-    </annotation>
-
-    <annotation basename="AnnotatedAnno">
-        <import>java.lang.annotation.Retention</import>
-        <import>java.lang.annotation.RetentionPolicy</import>
-        <anno>@reten-source|@reten-class|@reten-runtime</anno>
-        <modifier>public</modifier>
-        <member>
-            <method basename="value">
-                <modifier>public</modifier>
-                <type>int</type>
-            </method>
-        </member>
-    </annotation>
-
-    <class basename="AnnoContainer">
-        <import>java.lang.annotation.Retention</import>
-        <import>java.lang.annotation.RetentionPolicy</import>
-        <import>java.lang.annotation.Target</import>
-        <import>java.lang.annotation.ElementType</import>
-        <modifier>public</modifier>
-        <member>
-            <annotation basename="AnnotatedAnno">
-                <anno>@reten-source|@reten-class|@reten-runtime</anno>
-                <anno>@target-method|@target-field|@target-type</anno>
-                <modifier>public</modifier>
-                <modifier>static</modifier>
                 <member>
                     <method basename="value">
                         <modifier>public</modifier>
-                        <type>String</type>
+                        <type>boolean|String</type>
                     </method>
                 </member>
             </annotation>
-        </member>
-    </class>
 
-    <annodecl id="deprecated">
-        <class>Deprecated</class>
-    </annodecl>
+            <annotation basename="AnnotatedAnno">
+                <import>java.lang.annotation.Retention</import>
+                <import>java.lang.annotation.RetentionPolicy</import>
+                <anno>@reten-source|@reten-class|@reten-runtime</anno>
+                <modifier>public</modifier>
+                <member>
+                    <method basename="value">
+                        <modifier>public</modifier>
+                        <type>int</type>
+                    </method>
+                </member>
+            </annotation>
 
-    <annodecl id="safevarargs">
-        <class>SafeVarargs</class>
-    </annodecl>
+            <class basename="AnnoContainer">
+                <import>java.lang.annotation.Retention</import>
+                <import>java.lang.annotation.RetentionPolicy</import>
+                <import>java.lang.annotation.Target</import>
+                <import>java.lang.annotation.ElementType</import>
+                <modifier>public</modifier>
+                <member>
+                    <annotation basename="AnnotatedAnno">
+                        <anno>@reten-source|@reten-class|@reten-runtime</anno>
+                        <anno>@target-method|@target-field|@target-type</anno>
+                        <modifier>public</modifier>
+                        <modifier>static</modifier>
+                        <member>
+                            <method basename="value">
+                                <modifier>public</modifier>
+                                <type>String</type>
+                            </method>
+                        </member>
+                    </annotation>
+                </member>
+            </class>
 
-    <annodecl id="suppresswarnings">
-        <class>SuppressWarnings</class>
-        <arg value="{&quot;unchecked&quot;, &quot;rawtypes&quot;}"/>
-    </annodecl>
+            <annodecl id="deprecated">
+                <class>Deprecated</class>
+            </annodecl>
 
-    <class basename="AnnotatedClass">
-        <modifier>public</modifier>
-        <member>
-            <method basename="deprecatedMethod">
-                <anno>@deprecated</anno>
+            <annodecl id="safevarargs">
+                <class>SafeVarargs</class>
+            </annodecl>
+
+            <annodecl id="suppresswarnings">
+                <class>SuppressWarnings</class>
+                <arg value="{&quot;unchecked&quot;, &quot;rawtypes&quot;}"/>
+            </annodecl>
+
+            <class basename="AnnotatedClass">
                 <modifier>public</modifier>
-                <type>void</type>
-            </method>
-            <method basename="safeVarargsMethod">
-                <anno>@safevarargs</anno>
-                <modifier>public</modifier>
-                <type>void|int</type>
-                <param>String...</param>
-            </method>
-            <method basename="suppressWarningsMethod">
-                <anno>@suppresswarnings</anno>
-                <modifier>public</modifier>
-                <type>void</type>
-                <param>int|Object</param>
-            </method>
-        </member>
-    </class>
-</package>
+                <member>
+                    <method basename="deprecatedMethod">
+                        <anno>@deprecated</anno>
+                        <modifier>public</modifier>
+                        <type>void</type>
+                    </method>
+                    <method basename="safeVarargsMethod">
+                        <anno>@safevarargs</anno>
+                        <modifier>public</modifier>
+                        <type>void|int</type>
+                        <param>String...</param>
+                    </method>
+                    <method basename="suppressWarningsMethod">
+                        <anno>@suppresswarnings</anno>
+                        <modifier>public</modifier>
+                        <type>void</type>
+                        <param>int|Object</param>
+                    </method>
+                </member>
+            </class>
+        </package>
+    </module>
+</sampleapi>
--- a/langtools/test/jdk/javadoc/tool/sampleapi/res/sub.xml	Thu Feb 16 14:47:39 2017 -0800
+++ b/langtools/test/jdk/javadoc/tool/sampleapi/res/sub.xml	Tue Feb 21 15:38:07 2017 -0800
@@ -21,69 +21,72 @@
  or visit www.oracle.com if you need additional information or have any
  questions.
 -->
-<package name="sampleapi.simple.sub">
+<sampleapi>
+    <module name="UNNAMED">
+        <package name="sampleapi.simple.sub">
+            <class basename="SClass">
+                <modifier>public</modifier>
+                <modifier>none|abstract</modifier>
+                <implement>SInterface0</implement>
+                <member>
+                    <field basename="id">
+                        <modifier>public</modifier>
+                        <type>int</type>
+                    </field>
+                    <method basename="get">
+                        <modifier>public</modifier>
+                        <type>int</type>
+                        <throw>SException0</throw>
+                    </method>
+                    <method basename="put">
+                        <modifier>public</modifier>
+                        <param>int</param>
+                        <type>void</type>
+                        <throw>SException0</throw>
+                    </method>
+                </member>
+            </class>
 
-    <class basename="SClass">
-        <modifier>public</modifier>
-        <modifier>none|abstract</modifier>
-        <implement>SInterface0</implement>
-        <member>
-            <field basename="id">
+            <class basename="SException">
                 <modifier>public</modifier>
-                <type>int</type>
-            </field>
-            <method basename="get">
+                <extend ref="java.lang.Exception"/>
+                <member>
+                    <constructor>
+                        <modifier>public</modifier>
+                        <param>String</param>
+                    </constructor>
+                </member>
+            </class>
+
+            <interface basename="SInterface">
                 <modifier>public</modifier>
-                <type>int</type>
-                <throw>SException0</throw>
-            </method>
-            <method basename="put">
+                <member>
+                    <method basename="put">
+                        <modifier>public</modifier>
+                        <type>void</type>
+                        <param>int</param>
+                    </method>
+                </member>
+            </interface>
+
+            <enum basename="SEnum">
                 <modifier>public</modifier>
-                <param>int</param>
-                <type>void</type>
-                <throw>SException0</throw>
-            </method>
-        </member>
-    </class>
+                <member>
+                    <constant basename="ON" count="1"/>
+                    <constant basename="OFF" count="1"/>
+                </member>
+            </enum>
 
-    <class basename="SException">
-        <modifier>public</modifier>
-        <extend ref="java.lang.Exception"/>
-        <member>
-            <constructor>
+            <annotation basename="SAnno">
                 <modifier>public</modifier>
-                <param>String</param>
-            </constructor>
-        </member>
-    </class>
-
-    <interface basename="SInterface">
-        <modifier>public</modifier>
-        <member>
-            <method basename="put">
-                <modifier>public</modifier>
-                <type>void</type>
-                <param>int</param>
-            </method>
-        </member>
-    </interface>
-
-    <enum basename="SEnum">
-        <modifier>public</modifier>
-        <member>
-            <constant basename="ON" count="1"/>
-            <constant basename="OFF" count="1"/>
-        </member>
-    </enum>
-
-    <annotation basename="SAnno">
-        <modifier>public</modifier>
-        <member>
-            <method basename="value">
-                <modifier>public</modifier>
-                <type>boolean</type>
-            </method>
-        </member>
-    </annotation>
+                <member>
+                    <method basename="value">
+                        <modifier>public</modifier>
+                        <type>boolean</type>
+                    </method>
+                </member>
+            </annotation>
         
-</package>
+        </package>
+    </module>
+</sampleapi>
--- a/langtools/test/jdk/javadoc/tool/sampleapi/res/tiny.xml	Thu Feb 16 14:47:39 2017 -0800
+++ b/langtools/test/jdk/javadoc/tool/sampleapi/res/tiny.xml	Tue Feb 21 15:38:07 2017 -0800
@@ -21,51 +21,53 @@
  or visit www.oracle.com if you need additional information or have any
  questions.
 -->
-<package name="sampleapi.tiny" module="sat.sampleapi">
+<sampleapi>
+    <module name="UNNAMED">
+        <package name="sampleapi.tiny" module="sat.sampleapi">
+            <class basename="TinyClass">
+                <modifier>public</modifier>
+                <modifier>none|abstract</modifier>
+                <member>
+                    <field basename="id">
+                        <modifier>public</modifier>
+                        <type>int</type>
+                    </field>
+                    <method basename="get">
+                        <modifier>public</modifier>
+                        <type>int</type>
+                    </method>
+                </member>
+            </class>
 
-    <class basename="TinyClass">
-        <modifier>public</modifier>
-        <modifier>none|abstract</modifier>
-        <member>
-            <field basename="id">
+            <interface basename="TinyInterface">
                 <modifier>public</modifier>
-                <type>int</type>
-            </field>
-            <method basename="get">
+                <member>
+                    <method basename="put">
+                        <modifier>public</modifier>
+                        <type>void</type>
+                        <param>int</param>
+                    </method>
+                </member>
+            </interface>
+
+            <enum basename="TinyEnum">
                 <modifier>public</modifier>
-                <type>int</type>
-            </method>
-        </member>
-    </class>
+                <member>
+                    <constant basename="YES" count="1"/>
+                    <constant basename="NO" count="1"/>
+                    <constant basename="MAYBE" count="1"/>
+                </member>
+            </enum>
 
-    <interface basename="TinyInterface">
-        <modifier>public</modifier>
-        <member>
-            <method basename="put">
+            <annotation basename="TinyAnno">
                 <modifier>public</modifier>
-                <type>void</type>
-                <param>int</param>
-            </method>
-        </member>
-    </interface>
-
-    <enum basename="TinyEnum">
-        <modifier>public</modifier>
-        <member>
-            <constant basename="YES" count="1"/>
-            <constant basename="NO" count="1"/>
-            <constant basename="MAYBE" count="1"/>
-        </member>
-    </enum>
-
-    <annotation basename="TinyAnno">
-        <modifier>public</modifier>
-        <member>
-            <method basename="value">
-                <modifier>public</modifier>
-                <type>boolean</type>
-            </method>
-        </member>
-    </annotation>
-        
-</package>
+                <member>
+                    <method basename="value">
+                        <modifier>public</modifier>
+                        <type>boolean</type>
+                    </method>
+                </member>
+            </annotation>
+        </package>
+    </module>
+</sampleapi>
--- a/langtools/test/jdk/javadoc/tool/sampleapi/res/tinysub.xml	Thu Feb 16 14:47:39 2017 -0800
+++ b/langtools/test/jdk/javadoc/tool/sampleapi/res/tinysub.xml	Tue Feb 21 15:38:07 2017 -0800
@@ -21,69 +21,71 @@
  or visit www.oracle.com if you need additional information or have any
  questions.
 -->
-<package name="sampleapi.tiny.sub" module="sat.sampleapi">
+<sampleapi>
+    <module name="UNNAMED">
+        <package name="sampleapi.tiny.sub" module="sat.sampleapi">
+            <class basename="TSClass">
+                <modifier>public</modifier>
+                <modifier>none|abstract</modifier>
+                <implement>TSInterface0</implement>
+                <member>
+                    <field basename="id">
+                        <modifier>public</modifier>
+                        <type>int</type>
+                    </field>
+                    <method basename="get">
+                        <modifier>public</modifier>
+                        <type>int</type>
+                        <throw>TSException0</throw>
+                    </method>
+                    <method basename="put">
+                        <modifier>public</modifier>
+                        <param>int</param>
+                        <type>void</type>
+                        <throw>TSException0</throw>
+                    </method>
+                </member>
+            </class>
 
-    <class basename="TSClass">
-        <modifier>public</modifier>
-        <modifier>none|abstract</modifier>
-        <implement>TSInterface0</implement>
-        <member>
-            <field basename="id">
+            <class basename="TSException">
                 <modifier>public</modifier>
-                <type>int</type>
-            </field>
-            <method basename="get">
+                <extend ref="java.lang.Exception"/>
+                <member>
+                    <constructor>
+                        <modifier>public</modifier>
+                        <param>String</param>
+                    </constructor>
+                </member>
+            </class>
+
+            <interface basename="TSInterface">
                 <modifier>public</modifier>
-                <type>int</type>
-                <throw>TSException0</throw>
-            </method>
-            <method basename="put">
+                <member>
+                    <method basename="put">
+                        <modifier>public</modifier>
+                        <type>void</type>
+                        <param>int</param>
+                    </method>
+                </member>
+            </interface>
+
+            <enum basename="TSEnum">
                 <modifier>public</modifier>
-                <param>int</param>
-                <type>void</type>
-                <throw>TSException0</throw>
-            </method>
-        </member>
-    </class>
+                <member>
+                    <constant basename="ON" count="1"/>
+                    <constant basename="OFF" count="1"/>
+                </member>
+            </enum>
 
-    <class basename="TSException">
-        <modifier>public</modifier>
-        <extend ref="java.lang.Exception"/>
-        <member>
-            <constructor>
+            <annotation basename="TSAnno">
                 <modifier>public</modifier>
-                <param>String</param>
-            </constructor>
-        </member>
-    </class>
-
-    <interface basename="TSInterface">
-        <modifier>public</modifier>
-        <member>
-            <method basename="put">
-                <modifier>public</modifier>
-                <type>void</type>
-                <param>int</param>
-            </method>
-        </member>
-    </interface>
-
-    <enum basename="TSEnum">
-        <modifier>public</modifier>
-        <member>
-            <constant basename="ON" count="1"/>
-            <constant basename="OFF" count="1"/>
-        </member>
-    </enum>
-
-    <annotation basename="TSAnno">
-        <modifier>public</modifier>
-        <member>
-            <method basename="value">
-                <modifier>public</modifier>
-                <type>boolean</type>
-            </method>
-        </member>
-    </annotation>
-        
-</package>
+                <member>
+                    <method basename="value">
+                        <modifier>public</modifier>
+                        <type>boolean</type>
+                    </method>
+                </member>
+            </annotation> 
+        </package>
+    </module>
+</sampleapi>
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/langtools/test/jdk/javadoc/tool/sampleapi/res/transitive.xml	Tue Feb 21 15:38:07 2017 -0800
@@ -0,0 +1,98 @@
+<?xml version="1.0" encoding="utf-8"?>
+<!--
+ Copyright (c) 2016, 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.
+
+ This code is distributed in the hope that it will be useful, but WITHOUT
+ ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
+ FITNESS FOR A PARTICULAR PURPOSE.  See the GNU General Public License
+ version 2 for more details (a copy is included in the LICENSE file that
+ accompanied this code).
+
+ You should have received a copy of the GNU General Public License version
+ 2 along with this work; if not, write to the Free Software Foundation,
+ Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
+
+ 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.
+-->
+<sampleapi>
+    <module name="my.first.module" id="first">
+        <exports package="$exported"/>
+        <exports package="$exported.to">
+            <to module="$second"/>
+        </exports>
+        <opens package="$internal">
+            <to module="$second"/>
+        </opens>
+        <uses service="$service"/>
+        <package name="sampleapi.exported" id="exported">
+            <class basename="API" id="service">
+                <modifier>public</modifier>
+                <member>
+                    <method basename="get">
+                        <modifier>public</modifier>
+                        <type>Object</type>
+                    </method>
+                </member>
+            </class>
+        </package>
+        <package name="sampleapi.exported.to"  id="exported.to">
+            <class basename="API" id="baseclass">
+                <modifier>public</modifier>
+                <member>
+                    <method basename="put">
+                        <param>Object</param>
+                        <type>void</type>
+                    </method>
+                </member>
+            </class>
+        </package>
+        <package name="sampleapi.not.exported" id="internal">
+            <class basename="AnImplementationDetail"/>
+        </package>
+    </module>
+    <module name="my.second.module" id="second" kind="open">
+        <requires module="$first" transitive="true"/>
+        <requires module="java.xml" static="true"/>
+        <provides service="$service">
+            <implementation class="$second.impl"/>
+            <implementation class="$third.impl"/>
+        </provides>
+        <package name="sampleapi.exported.second">
+            <class basename="API" id="second.impl">
+                <extend id="baseclass"/>
+            </class>
+            <class basename="OtherAPI" id="third.impl">
+                <extend id="baseclass"/>
+            </class>
+            <class basename="TClass">
+                <modifier>public</modifier>
+                <modifier>none|abstract</modifier>
+                <implement>SInterface0</implement>
+                <member>
+                    <field basename="id">
+                        <modifier>public</modifier>
+                        <type>int</type>
+                    </field>
+                    <method basename="get">
+                        <modifier>public</modifier>
+                        <type>int</type>
+                        <throw>SException0</throw>
+                    </method>
+                    <method basename="put">
+                        <modifier>public</modifier>
+                        <param>int</param>
+                        <type>void</type>
+                        <throw>SException0</throw>
+                    </method>
+                </member>
+            </class>
+        </package>
+    </module>
+</sampleapi>
--- a/langtools/test/tools/javadoc/sampleapi/SampleApiTest.java	Thu Feb 16 14:47:39 2017 -0800
+++ b/langtools/test/tools/javadoc/sampleapi/SampleApiTest.java	Tue Feb 21 15:38:07 2017 -0800
@@ -30,6 +30,8 @@
  *          jdk.compiler/com.sun.tools.javac.parser
  *          jdk.compiler/com.sun.tools.javac.tree
  *          jdk.compiler/com.sun.tools.javac.util
+ *          jdk.javadoc/jdk.javadoc.internal.tool
+ * @build sampleapi.SampleApiDefaultRunner
  * @run main SampleApiTest
  */
 
--- a/langtools/test/tools/javadoc/sampleapi/res/fx.xml	Thu Feb 16 14:47:39 2017 -0800
+++ b/langtools/test/tools/javadoc/sampleapi/res/fx.xml	Tue Feb 21 15:38:07 2017 -0800
@@ -1,6 +1,6 @@
 <?xml version="1.0" encoding="utf-8"?>
 <!--
- Copyright (c) 2015, Oracle and/or its affiliates. All rights reserved.
+ Copyright (c) 2015, 2016 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
@@ -21,25 +21,29 @@
  or visit www.oracle.com if you need additional information or have any
  questions.
 -->
-<package name="sampleapi.fx" style="fx">
+<sampleapi>
+    <module name="UNNAMED">
+        <package name="sampleapi.fx" style="fx">
+            <class basename="FXClass">
+                <modifier>public</modifier>
+                <member>
+                    <field basename="id">
+                        <modifier>public</modifier>
+                        <type>int|boolean</type>
+                    </field>
+                    <method basename="setProp">
+                        <modifier>public|protected|private</modifier>
+                        <param>int|String</param>
+                        <type>void</type>
+                    </method>
+                    <method basename="getProp">
+                        <modifier>public|protected|private</modifier>
+                        <type>int|int|String</type>
+                    </method>
+                </member>
+            </class>
 
-    <class basename="FXClass">
-        <modifier>public</modifier>
-        <member>
-            <field basename="id">
-                <modifier>public</modifier>
-                <type>int|boolean</type>
-            </field>
-            <method basename="setProp">
-                <modifier>public|protected|private</modifier>
-                <param>int|String</param>
-                <type>void</type>
-            </method>
-            <method basename="getProp">
-                <modifier>public|protected|private</modifier>
-                <type>int|int|String</type>
-            </method>
-        </member>
-    </class>
+        </package>
+    </module>
+</sampleapi>
 
-</package>
--- a/langtools/test/tools/javadoc/sampleapi/res/simple.xml	Thu Feb 16 14:47:39 2017 -0800
+++ b/langtools/test/tools/javadoc/sampleapi/res/simple.xml	Tue Feb 21 15:38:07 2017 -0800
@@ -1,6 +1,6 @@
 <?xml version="1.0" encoding="utf-8"?>
 <!--
- Copyright (c) 2015, Oracle and/or its affiliates. All rights reserved.
+ Copyright (c) 2015, 2016 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
@@ -21,509 +21,514 @@
  or visit www.oracle.com if you need additional information or have any
  questions.
 -->
-<package name="sampleapi.simple">
+<sampleapi>
+    <module name="UNNAMED">
+        <package name="sampleapi.simple">
 
-    <class basename="SampleClass" id="baseclass">
-        <modifier>public</modifier>
-        <modifier>none|abstract</modifier>
-        <member>
-            <field basename="field">
-                <modifier>none|public</modifier>
-                <modifier>none|static</modifier>
-                <modifier>none|final</modifier>
-                <type>boolean|int|String</type>
-            </field>
-            <field basename="field">
-                <modifier>protected|private</modifier>
-                <type>String</type>
-            </field>
-            <constructor>
+            <class basename="SampleClass" id="baseclass">
                 <modifier>public</modifier>
-                <param>none|int|int,boolean|int,String</param>
-            </constructor>
-            <constructor>
+                <modifier>none|abstract</modifier>
+                <member>
+                    <field basename="field">
+                        <modifier>none|public</modifier>
+                        <modifier>none|static</modifier>
+                        <modifier>none|final</modifier>
+                        <type>boolean|int|String</type>
+                    </field>
+                    <field basename="field">
+                        <modifier>protected|private</modifier>
+                        <type>String</type>
+                    </field>
+                    <constructor>
+                        <modifier>public</modifier>
+                        <param>none|int|int,boolean|int,String</param>
+                    </constructor>
+                    <constructor>
+                        <modifier>public</modifier>
+                        <param>String</param>
+                        <throw>NullPointerException</throw>
+                        <throw>SampleException0</throw>
+                    </constructor>
+                    <method basename="set">
+                        <modifier>public</modifier>
+                        <type>void</type>
+                        <param>int</param>
+                    </method>
+                    <method basename="get">
+                        <modifier>public</modifier>
+                        <type>int|boolean|String</type>
+                    </method>
+                    <method basename="doSomething">
+                        <modifier>public</modifier>
+                        <type>void|int</type>
+                        <param>none|int|Object,int</param>
+                        <throw>NullPointerException</throw>
+                        <throw>ArithmeticException</throw>
+                    </method>
+                </member>
+            </class>
+
+            <class basename="Derived">
                 <modifier>public</modifier>
-                <param>String</param>
-                <throw>NullPointerException</throw>
-                <throw>SampleException0</throw>
-            </constructor>
-            <method basename="set">
+                <extend id="baseclass"/>
+                <member>
+                    <field basename="myField">
+                        <modifier>public</modifier>
+                        <type>int|boolean</type>
+                    </field>
+                    <constructor>
+                        <modifier>public</modifier>
+                        <param>none|int|int,boolean|int,String</param>
+                    </constructor>
+                    <method basename="myGet">
+                        <modifier>public</modifier>
+                        <type>int|boolean</type>
+                    </method>
+                </member>
+            </class>
+
+            <class basename="SampleSerial">
+                <import>java.io.Serializable</import>
                 <modifier>public</modifier>
-                <type>void</type>
-                <param>int</param>
-            </method>
-            <method basename="get">
-                <modifier>public</modifier>
-                <type>int|boolean|String</type>
-            </method>
-            <method basename="doSomething">
-                <modifier>public</modifier>
-                <type>void|int</type>
-                <param>none|int|Object,int</param>
-                <throw>NullPointerException</throw>
-                <throw>ArithmeticException</throw>
-            </method>
-        </member>
-    </class>
-
-    <class basename="Derived">
-        <modifier>public</modifier>
-        <extend id="baseclass"/>
-        <member>
-            <field basename="myField">
-                <modifier>public</modifier>
-                <type>int|boolean</type>
-            </field>
-            <constructor>
-                <modifier>public</modifier>
-                <param>none|int|int,boolean|int,String</param>
-            </constructor>
-            <method basename="myGet">
-                <modifier>public</modifier>
-                <type>int|boolean</type>
-            </method>
-        </member>
-    </class>
-
-    <class basename="SampleSerial">
-        <import>java.io.Serializable</import>
-        <modifier>public</modifier>
-        <implement ref="Serializable"/>
-        <member>
-            <field basename="specialData">
-                <modifier>private|none|public</modifier>
-                <type>boolean|int|String</type>
-            </field>
-        </member>
-    </class>
-
-    <class basename="SampleSerial">
-        <import>java.io.Serializable</import>
-        <import>java.io.ObjectStreamField</import>
-        <modifier>public</modifier>
-        <implement ref="Serializable"/>
-        <member>
-            <serialfield basename="serialField">String,Long,Boolean</serialfield>
-            <method basename="justToBeHere">
-                <modifier>public</modifier>
-                <type>String|long|boolean</type>
-            </method>
-        </member>
-    </class>
-
-    <class basename="SampleSerial">
-        <import>java.io.Serializable</import>
-        <import>java.io.ObjectOutputStream</import>
-        <import>java.io.ObjectOutput</import>
-        <import>java.io.IOException</import>
-        <import>java.io.ObjectStreamException</import>
-        <modifier>public</modifier>
-        <implement ref="Serializable"/>
-        <member>
-            <method name="writeObject">
-                <modifier>private</modifier>
-                <param>ObjectOutputStream</param>
-                <type>void</type>
-                <throw>IOException</throw>
-            </method>
-            <method name="writeExternal">
-                <modifier>public</modifier>
-                <param>ObjectOutput</param>
-                <type>void</type>
-                <throw>IOException</throw>
-            </method>
-            <method name="writeReplace">
-                <modifier>protected</modifier>
-                <param>none</param>
-                <type>Object</type>
-                <throw>ObjectStreamException</throw>
-            </method>
-            <method name="writeSomethingElse">
-                <modifier>public</modifier>
-                <param>Object</param>
-                <type>void</type>
-                <throw>IOException</throw>
-            </method>
-        </member>
-    </class>
-
-    <class basename="SampleSerial">
-        <import>java.io.Serializable</import>
-        <import>java.io.ObjectInputStream</import>
-        <import>java.io.ObjectInput</import>
-        <import>java.io.IOException</import>
-        <import>java.io.ObjectStreamException</import>
-        <modifier>public</modifier>
-        <implement ref="Serializable"/>
-        <member>
-            <method name="readObject">
-                <modifier>private</modifier>
-                <param>ObjectInputStream</param>
-                <type>void</type>
-                <throw>IOException</throw>
-                <throw>ClassNotFoundException</throw>
-            </method>
-            <method name="readExternal">
-                <modifier>public</modifier>
-                <param>ObjectInput</param>
-                <type>void</type>
-                <throw>IOException</throw>
-            </method>
-            <method name="readResolve">
-                <modifier>protected</modifier>
-                <param>none</param>
-                <type>Object</type>
-                <throw>ObjectStreamException</throw>
-            </method>
-            <method name="readSomethingElse">
-                <modifier>public</modifier>
-                <param>Object</param>
-                <type>void</type>
-                <throw>IOException</throw>
-            </method>
-        </member>
-    </class>
-
-    <class basename="Container">
-        <modifier>public</modifier>
-        <member>
-            <class basename="Inner">
-                <modifier>public</modifier>
+                <implement ref="Serializable"/>
                 <member>
-                    <field basename="value">
-                        <modifier>public</modifier>
-                        <type>int</type>
+                    <field basename="specialData">
+                        <modifier>private|none|public</modifier>
+                        <type>boolean|int|String</type>
                     </field>
                 </member>
             </class>
-            <class basename="Nested">
+
+            <class basename="SampleSerial">
+                <import>java.io.Serializable</import>
+                <import>java.io.ObjectStreamField</import>
                 <modifier>public</modifier>
-                <modifier>static</modifier>
+                <implement ref="Serializable"/>
+                <member>
+                    <serialfield basename="serialField">String,Long,Boolean</serialfield>
+                    <method basename="justToBeHere">
+                        <modifier>public</modifier>
+                        <type>String|long|boolean</type>
+                    </method>
+                </member>
             </class>
-            <interface basename="EventListener">
+
+            <class basename="SampleSerial">
+                <import>java.io.Serializable</import>
+                <import>java.io.ObjectOutputStream</import>
+                <import>java.io.ObjectOutput</import>
+                <import>java.io.IOException</import>
+                <import>java.io.ObjectStreamException</import>
                 <modifier>public</modifier>
-                <modifier>static</modifier>
+                <implement ref="Serializable"/>
                 <member>
-                    <method basename="onEvent">
-                         <modifier>public</modifier>
-                         <type>void</type>
+                    <method name="writeObject">
+                        <modifier>private</modifier>
+                        <param>ObjectOutputStream</param>
+                        <type>void</type>
+                        <throw>IOException</throw>
+                    </method>
+                    <method name="writeExternal">
+                        <modifier>public</modifier>
+                        <param>ObjectOutput</param>
+                        <type>void</type>
+                        <throw>IOException</throw>
+                    </method>
+                    <method name="writeReplace">
+                        <modifier>protected</modifier>
+                        <param>none</param>
+                        <type>Object</type>
+                        <throw>ObjectStreamException</throw>
+                    </method>
+                    <method name="writeSomethingElse">
+                        <modifier>public</modifier>
+                        <param>Object</param>
+                        <type>void</type>
+                        <throw>IOException</throw>
+                    </method>
+                </member>
+            </class>
+
+            <class basename="SampleSerial">
+                <import>java.io.Serializable</import>
+                <import>java.io.ObjectInputStream</import>
+                <import>java.io.ObjectInput</import>
+                <import>java.io.IOException</import>
+                <import>java.io.ObjectStreamException</import>
+                <modifier>public</modifier>
+                <implement ref="Serializable"/>
+                <member>
+                    <method name="readObject">
+                        <modifier>private</modifier>
+                        <param>ObjectInputStream</param>
+                        <type>void</type>
+                        <throw>IOException</throw>
+                        <throw>ClassNotFoundException</throw>
+                    </method>
+                    <method name="readExternal">
+                        <modifier>public</modifier>
+                        <param>ObjectInput</param>
+                        <type>void</type>
+                        <throw>IOException</throw>
+                    </method>
+                    <method name="readResolve">
+                        <modifier>protected</modifier>
+                        <param>none</param>
+                        <type>Object</type>
+                        <throw>ObjectStreamException</throw>
+                    </method>
+                    <method name="readSomethingElse">
+                        <modifier>public</modifier>
+                        <param>Object</param>
+                        <type>void</type>
+                        <throw>IOException</throw>
+                    </method>
+                </member>
+            </class>
+
+            <class basename="Container">
+                <modifier>public</modifier>
+                <member>
+                    <class basename="Inner">
+                        <modifier>public</modifier>
+                        <member>
+                            <field basename="value">
+                                <modifier>public</modifier>
+                                <type>int</type>
+                            </field>
+                        </member>
+                    </class>
+                    <class basename="Nested">
+                        <modifier>public</modifier>
+                        <modifier>static</modifier>
+                    </class>
+                    <interface basename="EventListener">
+                        <modifier>public</modifier>
+                        <modifier>static</modifier>
+                        <member>
+                            <method basename="onEvent">
+                                <modifier>public</modifier>
+                                <type>void</type>
+                            </method>
+                        </member>
+                    </interface>
+                </member>
+            </class>
+
+            <!-- Errors and exceptions -->
+            <class basename="SampleError">
+                <modifier>public</modifier>
+                <extend ref="java.lang.Error"/>
+                <member>
+                    <field basename="errorInfo">
+                        <modifier>private</modifier>
+                        <type>boolean|int|String</type>
+                    </field>
+                    <constructor>
+                        <modifier>public</modifier>
+                        <param>String</param>
+                    </constructor>
+                    <method basename="getSampleData">
+                        <modifier>public</modifier>
+                        <type>int|String</type>
+                    </method>
+                </member>
+            </class>
+
+            <class basename="SampleException">
+                <modifier>public</modifier>
+                <extend ref="java.lang.Exception"/>
+                <member>
+                    <field basename="exceptionInfo">
+                        <modifier>private</modifier>
+                        <type>boolean|int|String</type>
+                    </field>
+                    <constructor>
+                        <modifier>public</modifier>
+                        <param>String</param>
+                    </constructor>
+                    <method basename="getSampleData">
+                        <modifier>public</modifier>
+                        <type>int|String</type>
+                    </method>
+                </member>
+            </class>
+
+            <interface basename="SampleInterface" id="baseinterface">
+                <modifier>public|none</modifier>
+                <member>
+                    <method basename="method">
+                        <modifier>public</modifier>
+                        <type>void|int|Object</type>
                     </method>
                 </member>
             </interface>
-        </member> 
-    </class>
 
-    <!-- Errors and exceptions -->
-    <class basename="SampleError">
-        <modifier>public</modifier>
-        <extend ref="java.lang.Error"/>
-        <member>
-            <field basename="errorInfo">
-                <modifier>private</modifier>
-                <type>boolean|int|String</type>
-            </field>
-            <constructor>
+            <class basename="Implementor">
                 <modifier>public</modifier>
-                <param>String</param>
-            </constructor>
-            <method basename="getSampleData">
+                <implement id="baseinterface"/>
+                <member>
+                    <field basename="myField">
+                        <modifier>public</modifier>
+                        <type>int|boolean</type>
+                    </field>
+                    <method basename="myGet">
+                        <modifier>public</modifier>
+                        <type>int|boolean</type>
+                    </method>
+                </member>
+            </class>
+
+            <class basename="GenericClass" tparam="T">
+                <import>java.util.List</import>
                 <modifier>public</modifier>
-                <type>int|String</type>
-            </method>
-        </member>
-    </class>
+                <member>
+                    <method basename="put">
+                        <modifier>public</modifier>
+                        <type>void</type>
+                        <param>T</param>
+                    </method>
+                    <method basename="get">
+                        <modifier>public</modifier>
+                        <type>T</type>
+                        <param>int</param>
+                    </method>
+                    <method basename="get">
+                        <modifier>public</modifier>
+                        <type>List&lt;T&gt;</type>
+                    </method>
+                </member>
+            </class>
 
-    <class basename="SampleException">
-        <modifier>public</modifier>
-        <extend ref="java.lang.Exception"/>
-        <member>
-            <field basename="exceptionInfo">
-                <modifier>private</modifier>
-                <type>boolean|int|String</type>
-            </field>
-            <constructor>
+            <class basename="GenericClass" tparam="K,V">
+                <import>java.util.Set</import>
+                <import>java.util.List</import>
+                <import>java.util.Map</import>
                 <modifier>public</modifier>
-                <param>String</param>
-            </constructor>
-            <method basename="getSampleData">
+                <member>
+                    <method basename="put">
+                        <modifier>public</modifier>
+                        <type>void</type>
+                        <param>K,V</param>
+                    </method>
+                    <method basename="putMap">
+                        <modifier>public</modifier>
+                        <type>void</type>
+                        <param>Map&lt;K,V&gt;</param>
+                    </method>
+                    <method basename="get">
+                        <modifier>public</modifier>
+                        <type>V</type>
+                        <param>K</param>
+                    </method>
+                    <method basename="getV">
+                        <modifier>public</modifier>
+                        <type>Set&lt;V&gt;|List&lt;V&gt;</type>
+                    </method>
+                    <method basename="getK">
+                        <modifier>public</modifier>
+                        <type>Set&lt;K&gt;|List&lt;K&gt;</type>
+                    </method>
+                </member>
+            </class>
+
+            <class basename="GenericClass" tparam="M,N,O">
+                <import>java.util.Set</import>
+                <import>java.util.List</import>
+                <import>java.util.Map</import>
                 <modifier>public</modifier>
-                <type>int|String</type>
-            </method>
-        </member>
-    </class>
+                <member>
+                    <method basename="get">
+                        <modifier>public</modifier>
+                        <type>Set&lt;M&gt;|List&lt;M&gt;</type>
+                        <param>Map&lt;N,O&gt;</param>
+                    </method>
+                    <method basename="get">
+                        <modifier>public</modifier>
+                        <type>Set&lt;N&gt;|List&lt;N&gt;</type>
+                        <param>Map&lt;M,O&gt;</param>
+                    </method>
+                    <method basename="get">
+                        <modifier>public</modifier>
+                        <type>Set&lt;O&gt;|List&lt;O&gt;</type>
+                        <param>Map&lt;M,N&gt;</param>
+                    </method>
+                </member>
+            </class>
 
-    <interface basename="SampleInterface" id="baseinterface">
-        <modifier>public|none</modifier>
-        <member>
-            <method basename="method">
+            <class basename="GenericUtil"> <!-- public static generic methods like Collections -->
+                <import>java.util.Set</import>
+                <import>java.util.List</import>
+                <import>java.util.Map</import>
+                <import>java.util.function.Supplier</import>
                 <modifier>public</modifier>
-                <type>void|int|Object</type>
-            </method>
-        </member>
-    </interface>
+                <member>
+                    <method tparam="E" basename="getSomething">
+                        <modifier>public</modifier>
+                        <modifier>static</modifier>
+                        <type>Set&lt;? extends E&gt;|List&lt;? extends E&gt;</type>
+                    </method>
+                    <method tparam="V,K" basename="getMore">
+                        <modifier>public|private</modifier>
+                        <modifier>static</modifier>
+                        <type>Map&lt;V,K&gt;</type>
+                    </method>
+                    <method tparam="E" basename="doSomething">
+                        <modifier>public</modifier>
+                        <modifier>static</modifier>
+                        <type>void</type>
+                        <param>E</param>
+                    </method>
+                    <method tparam="X extends Throwable" basename="orElseThrow">
+                        <modifier>public|private</modifier>
+                        <modifier>static</modifier>
+                        <type>X</type>
+                        <param>Supplier&lt;? extends X&gt;</param>
+                        <throw>X</throw>
+                    </method>
+                </member>
+            </class>
 
-    <class basename="Implementor">
-        <modifier>public</modifier>
-        <implement id="baseinterface"/>
-        <member>
-            <field basename="myField">
+            <enum basename="SampleEnum">
                 <modifier>public</modifier>
-                <type>int|boolean</type>
-            </field>
-            <method basename="myGet">
+                <member>
+                    <constant basename="VALUE" count="3"/>
+                </member>
+            </enum>
+
+            <enum basename="SampleEnum">
                 <modifier>public</modifier>
-                <type>int|boolean</type>
-            </method>
-        </member>
-    </class>
+                <member>
+                    <constant basename="VALUE" count="2"/>
+                    <constant basename="NOVALUE" count="1"/>
+                    <field basename="field">
+                        <modifier>private</modifier>
+                        <type>int|String</type>
+                    </field>
+                    <method basename="method">
+                        <modifier>public</modifier>
+                        <type>void|String</type>
+                    </method>
+                </member>
+            </enum>
 
-    <class basename="GenericClass" tparam="T">
-        <import>java.util.List</import>
-        <modifier>public</modifier>
-        <member>
-            <method basename="put">
+            <annodecl id="documented">
+                <class>Documented</class>
+            </annodecl>
+
+            <annodecl id="reten-source">
+                <class>Retention</class>
+                <arg name="value" value="RetentionPolicy.SOURCE"/>
+            </annodecl>
+
+            <annodecl id="reten-class">
+                <class>Retention</class>
+                <arg name="value" value="RetentionPolicy.CLASS"/>
+            </annodecl>
+
+            <annodecl id="reten-runtime">
+                <class>Retention</class>
+                <arg name="value" value="RetentionPolicy.RUNTIME"/>
+            </annodecl>
+
+            <annodecl id="target-method">
+                <class>Target</class>
+                <arg value="ElementType.METHOD"/>
+            </annodecl>
+
+            <annodecl id="target-field">
+                <class>Target</class>
+                <arg value="ElementType.FIELD"/>
+            </annodecl>
+
+            <annodecl id="target-type">
+                <class>Target</class>
+                <arg value="{ElementType.TYPE, ElementType.TYPE_USE}"/>
+            </annodecl>
+
+            <annotation basename="AnnotatedAnno">
+                <import>java.lang.annotation.Documented</import>
+                <anno>@documented</anno>
                 <modifier>public</modifier>
-                <type>void</type>
-                <param>T</param>
-            </method>
-            <method basename="get">
-                <modifier>public</modifier>
-                <type>T</type>
-                <param>int</param>
-            </method>
-            <method basename="get">
-                <modifier>public</modifier>
-                <type>List&lt;T&gt;</type>
-            </method>
-        </member>
-    </class>
-
-    <class basename="GenericClass" tparam="K,V">
-        <import>java.util.Set</import>
-        <import>java.util.List</import>
-        <import>java.util.Map</import>
-        <modifier>public</modifier>
-        <member>
-            <method basename="put">
-                <modifier>public</modifier>
-                <type>void</type>
-                <param>K,V</param>
-            </method>
-            <method basename="putMap">
-                <modifier>public</modifier>
-                <type>void</type>
-                <param>Map&lt;K,V&gt;</param>
-            </method>
-            <method basename="get">
-                <modifier>public</modifier>
-                <type>V</type>
-                <param>K</param>
-            </method>
-            <method basename="getV">
-                <modifier>public</modifier>
-                <type>Set&lt;V&gt;|List&lt;V&gt;</type>
-            </method>
-            <method basename="getK">
-                <modifier>public</modifier>
-                <type>Set&lt;K&gt;|List&lt;K&gt;</type>
-            </method>
-        </member>
-    </class>
-
-    <class basename="GenericClass" tparam="M,N,O">
-        <import>java.util.Set</import>
-        <import>java.util.List</import>
-        <import>java.util.Map</import>
-        <modifier>public</modifier>
-        <member>
-            <method basename="get">
-                <modifier>public</modifier>
-                <type>Set&lt;M&gt;|List&lt;M&gt;</type>
-                <param>Map&lt;N,O&gt;</param>
-            </method>
-            <method basename="get">
-                <modifier>public</modifier>
-                <type>Set&lt;N&gt;|List&lt;N&gt;</type>
-                <param>Map&lt;M,O&gt;</param>
-            </method>
-            <method basename="get">
-                <modifier>public</modifier>
-                <type>Set&lt;O&gt;|List&lt;O&gt;</type>
-                <param>Map&lt;M,N&gt;</param>
-            </method>
-        </member>
-    </class>
-
-    <class basename="GenericUtil"> <!-- public static generic methods like Collections -->
-        <import>java.util.Set</import>
-        <import>java.util.List</import>
-        <import>java.util.Map</import>
-        <import>java.util.function.Supplier</import>
-        <modifier>public</modifier>
-        <member>
-            <method tparam="E" basename="getSomething">
-                <modifier>public</modifier>
-                <modifier>static</modifier>
-                <type>Set&lt;? extends E&gt;|List&lt;? extends E&gt;</type>
-            </method>
-            <method tparam="V,K" basename="getMore">
-                <modifier>public|private</modifier>
-                <modifier>static</modifier>
-                <type>Map&lt;V,K&gt;</type>
-            </method>
-            <method tparam="E" basename="doSomething">
-                <modifier>public</modifier>
-                <modifier>static</modifier>
-                <type>void</type>
-                <param>E</param>
-            </method>
-            <method tparam="X extends Throwable" basename="orElseThrow">
-                <modifier>public|private</modifier>
-                <modifier>static</modifier>
-                <type>X</type>
-                <param>Supplier&lt;? extends X&gt;</param>
-                <throw>X</throw>
-            </method>
-        </member>
-    </class>
-
-    <enum basename="SampleEnum">
-        <modifier>public</modifier>
-        <member>
-            <constant basename="VALUE" count="3"/>
-        </member>
-    </enum>
-        
-    <enum basename="SampleEnum">
-        <modifier>public</modifier>
-        <member>
-            <constant basename="VALUE" count="2"/>
-            <constant basename="NOVALUE" count="1"/>
-            <field basename="field">
-                <modifier>private</modifier>
-                <type>int|String</type>
-            </field>
-            <method basename="method">
-                <modifier>public</modifier>
-                <type>void|String</type>
-            </method>
-        </member>
-    </enum>
-
-    <annodecl id="documented">
-        <class>Documented</class>
-    </annodecl>
-
-    <annodecl id="reten-source">
-        <class>Retention</class>
-        <arg name="value" value="RetentionPolicy.SOURCE"/>
-    </annodecl>
-
-    <annodecl id="reten-class">
-        <class>Retention</class>
-        <arg name="value" value="RetentionPolicy.CLASS"/>
-    </annodecl>
-
-    <annodecl id="reten-runtime">
-        <class>Retention</class>
-        <arg name="value" value="RetentionPolicy.RUNTIME"/>
-    </annodecl>
-
-    <annodecl id="target-method">
-        <class>Target</class>
-        <arg value="ElementType.METHOD"/>
-    </annodecl>
-
-    <annodecl id="target-field">
-        <class>Target</class>
-        <arg value="ElementType.FIELD"/>
-    </annodecl>
-
-    <annodecl id="target-type">
-        <class>Target</class>
-        <arg value="{ElementType.TYPE, ElementType.TYPE_USE}"/>
-    </annodecl>
-
-    <annotation basename="AnnotatedAnno">
-        <import>java.lang.annotation.Documented</import>
-        <anno>@documented</anno>
-        <modifier>public</modifier>
-        <member>
-            <method basename="value">
-                <modifier>public</modifier>
-                <type>boolean|String</type>
-            </method>
-        </member>
-    </annotation>
-
-    <annotation basename="AnnotatedAnno">
-        <import>java.lang.annotation.Retention</import>
-        <import>java.lang.annotation.RetentionPolicy</import>
-        <anno>@reten-source|@reten-class|@reten-runtime</anno>
-        <modifier>public</modifier>
-        <member>
-            <method basename="value">
-                <modifier>public</modifier>
-                <type>int</type>
-            </method>
-        </member>
-    </annotation>
-
-    <class basename="AnnoContainer">
-        <import>java.lang.annotation.Retention</import>
-        <import>java.lang.annotation.RetentionPolicy</import>
-        <import>java.lang.annotation.Target</import>
-        <import>java.lang.annotation.ElementType</import>
-        <modifier>public</modifier>
-        <member>
-            <annotation basename="AnnotatedAnno">
-                <anno>@reten-source|@reten-class|@reten-runtime</anno>
-                <anno>@target-method|@target-field|@target-type</anno>
-                <modifier>public</modifier>
-                <modifier>static</modifier>
                 <member>
                     <method basename="value">
                         <modifier>public</modifier>
-                        <type>String</type>
+                        <type>boolean|String</type>
                     </method>
                 </member>
             </annotation>
-        </member>
-    </class>
 
-    <annodecl id="deprecated">
-        <class>Deprecated</class>
-    </annodecl>
+            <annotation basename="AnnotatedAnno">
+                <import>java.lang.annotation.Retention</import>
+                <import>java.lang.annotation.RetentionPolicy</import>
+                <anno>@reten-source|@reten-class|@reten-runtime</anno>
+                <modifier>public</modifier>
+                <member>
+                    <method basename="value">
+                        <modifier>public</modifier>
+                        <type>int</type>
+                    </method>
+                </member>
+            </annotation>
 
-    <annodecl id="safevarargs">
-        <class>SafeVarargs</class>
-    </annodecl>
+            <class basename="AnnoContainer">
+                <import>java.lang.annotation.Retention</import>
+                <import>java.lang.annotation.RetentionPolicy</import>
+                <import>java.lang.annotation.Target</import>
+                <import>java.lang.annotation.ElementType</import>
+                <modifier>public</modifier>
+                <member>
+                    <annotation basename="AnnotatedAnno">
+                        <anno>@reten-source|@reten-class|@reten-runtime</anno>
+                        <anno>@target-method|@target-field|@target-type</anno>
+                        <modifier>public</modifier>
+                        <modifier>static</modifier>
+                        <member>
+                            <method basename="value">
+                                <modifier>public</modifier>
+                                <type>String</type>
+                            </method>
+                        </member>
+                    </annotation>
+                </member>
+            </class>
 
-    <annodecl id="suppresswarnings">
-        <class>SuppressWarnings</class>
-        <arg value="{&quot;unchecked&quot;, &quot;rawtypes&quot;}"/>
-    </annodecl>
+            <annodecl id="deprecated">
+                <class>Deprecated</class>
+            </annodecl>
 
-    <class basename="AnnotatedClass">
-        <modifier>public</modifier>
-        <member>
-            <method basename="deprecatedMethod">
-                <anno>@deprecated</anno>
+            <annodecl id="safevarargs">
+                <class>SafeVarargs</class>
+            </annodecl>
+
+            <annodecl id="suppresswarnings">
+                <class>SuppressWarnings</class>
+                <arg value="{&quot;unchecked&quot;, &quot;rawtypes&quot;}"/>
+            </annodecl>
+
+            <class basename="AnnotatedClass">
                 <modifier>public</modifier>
-                <type>void</type>
-            </method>
-            <method basename="safeVarargsMethod">
-                <anno>@safevarargs</anno>
-                <modifier>public</modifier>
-                <type>void|int</type>
-                <param>String...</param>
-            </method>
-            <method basename="suppressWarningsMethod">
-                <anno>@suppresswarnings</anno>
-                <modifier>public</modifier>
-                <type>void</type>
-                <param>int|Object</param>
-            </method>
-        </member>
-    </class>
-</package>
+                <member>
+                    <method basename="deprecatedMethod">
+                        <anno>@deprecated</anno>
+                        <modifier>public</modifier>
+                        <type>void</type>
+                    </method>
+                    <method basename="safeVarargsMethod">
+                        <anno>@safevarargs</anno>
+                        <modifier>public</modifier>
+                        <type>void|int</type>
+                        <param>String...</param>
+                    </method>
+                    <method basename="suppressWarningsMethod">
+                        <anno>@suppresswarnings</anno>
+                        <modifier>public</modifier>
+                        <type>void</type>
+                        <param>int|Object</param>
+                    </method>
+                </member>
+            </class>
+        </package>
+    </module>
+</sampleapi>
+
--- a/langtools/test/tools/javadoc/sampleapi/res/sub.xml	Thu Feb 16 14:47:39 2017 -0800
+++ b/langtools/test/tools/javadoc/sampleapi/res/sub.xml	Tue Feb 21 15:38:07 2017 -0800
@@ -21,69 +21,72 @@
  or visit www.oracle.com if you need additional information or have any
  questions.
 -->
-<package name="sampleapi.simple.sub">
+<sampleapi>
+    <module name="UNNAMED">
+        <package name="sampleapi.simple.sub">
+            <class basename="SClass">
+                <modifier>public</modifier>
+                <modifier>none|abstract</modifier>
+                <implement>SInterface0</implement>
+                <member>
+                    <field basename="id">
+                        <modifier>public</modifier>
+                        <type>int</type>
+                    </field>
+                    <method basename="get">
+                        <modifier>public</modifier>
+                        <type>int</type>
+                        <throw>SException0</throw>
+                    </method>
+                    <method basename="put">
+                        <modifier>public</modifier>
+                        <param>int</param>
+                        <type>void</type>
+                        <throw>SException0</throw>
+                    </method>
+                </member>
+            </class>
 
-    <class basename="SClass">
-        <modifier>public</modifier>
-        <modifier>none|abstract</modifier>
-        <implement>SInterface0</implement>
-        <member>
-            <field basename="id">
+            <class basename="SException">
                 <modifier>public</modifier>
-                <type>int</type>
-            </field>
-            <method basename="get">
+                <extend ref="java.lang.Exception"/>
+                <member>
+                    <constructor>
+                        <modifier>public</modifier>
+                        <param>String</param>
+                    </constructor>
+                </member>
+            </class>
+
+            <interface basename="SInterface">
                 <modifier>public</modifier>
-                <type>int</type>
-                <throw>SException0</throw>
-            </method>
-            <method basename="put">
+                <member>
+                    <method basename="put">
+                        <modifier>public</modifier>
+                        <type>void</type>
+                        <param>int</param>
+                    </method>
+                </member>
+            </interface>
+
+            <enum basename="SEnum">
                 <modifier>public</modifier>
-                <param>int</param>
-                <type>void</type>
-                <throw>SException0</throw>
-            </method>
-        </member>
-    </class>
+                <member>
+                    <constant basename="ON" count="1"/>
+                    <constant basename="OFF" count="1"/>
+                </member>
+            </enum>
 
-    <class basename="SException">
-        <modifier>public</modifier>
-        <extend ref="java.lang.Exception"/>
-        <member>
-            <constructor>
+            <annotation basename="SAnno">
                 <modifier>public</modifier>
-                <param>String</param>
-            </constructor>
-        </member>
-    </class>
+                <member>
+                    <method basename="value">
+                        <modifier>public</modifier>
+                        <type>boolean</type>
+                    </method>
+                </member>
+            </annotation>
+        </package>
+    </module>
+</sampleapi>
 
-    <interface basename="SInterface">
-        <modifier>public</modifier>
-        <member>
-            <method basename="put">
-                <modifier>public</modifier>
-                <type>void</type>
-                <param>int</param>
-            </method>
-        </member>
-    </interface>
-
-    <enum basename="SEnum">
-        <modifier>public</modifier>
-        <member>
-            <constant basename="ON" count="1"/>
-            <constant basename="OFF" count="1"/>
-        </member>
-    </enum>
-
-    <annotation basename="SAnno">
-        <modifier>public</modifier>
-        <member>
-            <method basename="value">
-                <modifier>public</modifier>
-                <type>boolean</type>
-            </method>
-        </member>
-    </annotation>
-        
-</package>
--- a/langtools/test/tools/javadoc/sampleapi/res/tiny.xml	Thu Feb 16 14:47:39 2017 -0800
+++ b/langtools/test/tools/javadoc/sampleapi/res/tiny.xml	Tue Feb 21 15:38:07 2017 -0800
@@ -1,6 +1,6 @@
 <?xml version="1.0" encoding="utf-8"?>
 <!--
- Copyright (c) 2015, Oracle and/or its affiliates. All rights reserved.
+ Copyright (c) 2015, 2016 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
@@ -21,51 +21,53 @@
  or visit www.oracle.com if you need additional information or have any
  questions.
 -->
-<package name="sampleapi.tiny">
+<sampleapi>
+    <module name="UNNAMED">
+        <package name="sampleapi.tiny">
+            <class basename="TinyClass">
+                <modifier>public</modifier>
+                <modifier>none|abstract</modifier>
+                <member>
+                    <field basename="id">
+                        <modifier>public</modifier>
+                        <type>int</type>
+                    </field>
+                    <method basename="get">
+                        <modifier>public</modifier>
+                        <type>int</type>
+                    </method>
+                </member>
+            </class>
 
-    <class basename="TinyClass">
-        <modifier>public</modifier>
-        <modifier>none|abstract</modifier>
-        <member>
-            <field basename="id">
+            <interface basename="TinyInterface">
                 <modifier>public</modifier>
-                <type>int</type>
-            </field>
-            <method basename="get">
+                <member>
+                    <method basename="put">
+                        <modifier>public</modifier>
+                        <type>void</type>
+                        <param>int</param>
+                    </method>
+                </member>
+            </interface>
+
+            <enum basename="TinyEnum">
                 <modifier>public</modifier>
-                <type>int</type>
-            </method>
-        </member>
-    </class>
+                <member>
+                    <constant basename="YES" count="1"/>
+                    <constant basename="NO" count="1"/>
+                    <constant basename="MAYBE" count="1"/>
+                </member>
+            </enum>
 
-    <interface basename="TinyInterface">
-        <modifier>public</modifier>
-        <member>
-            <method basename="put">
+            <annotation basename="TinyAnno">
                 <modifier>public</modifier>
-                <type>void</type>
-                <param>int</param>
-            </method>
-        </member>
-    </interface>
-
-    <enum basename="TinyEnum">
-        <modifier>public</modifier>
-        <member>
-            <constant basename="YES" count="1"/>
-            <constant basename="NO" count="1"/>
-            <constant basename="MAYBE" count="1"/>
-        </member>
-    </enum>
-
-    <annotation basename="TinyAnno">
-        <modifier>public</modifier>
-        <member>
-            <method basename="value">
-                <modifier>public</modifier>
-                <type>boolean</type>
-            </method>
-        </member>
-    </annotation>
-        
-</package>
+                <member>
+                    <method basename="value">
+                        <modifier>public</modifier>
+                        <type>boolean</type>
+                    </method>
+                </member>
+            </annotation>
+        </package>
+    </module>
+</sampleapi>