public void buildContents() {
        writer.writeContentsHeader();
        PackageDoc[] packages = configuration.packages;
        printedPackageHeaders = new HashSet();
        for (int i = 0; i < packages.length; i++) {
            if (hasConstantField(packages[i]) && ! hasPrintedPackageIndex(packages[i].name())) {
                writer.writeLinkToPackageContent(packages[i],
                    parsePackageName(packages[i].name()),
                    printedPackageHeaders);
            }
        }
        writer.writeContentsFooter();
    }