diff --git a/langtools/src/jdk.compiler/share/classes/com/sun/tools/doclint/Checker.java b/langtools/src/jdk.compiler/share/classes/com/sun/tools/doclint/Checker.java index c1627f23f6a..03a62b2019d 100644 --- a/langtools/src/jdk.compiler/share/classes/com/sun/tools/doclint/Checker.java +++ b/langtools/src/jdk.compiler/share/classes/com/sun/tools/doclint/Checker.java @@ -1,5 +1,5 @@ /* - * Copyright (c) 2012, 2013, Oracle and/or its affiliates. All rights reserved. + * Copyright (c) 2012, 2015, Oracle and/or its affiliates. All rights reserved. * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. * * This code is free software; you can redistribute it and/or modify it @@ -108,6 +108,7 @@ public class Checker extends DocTreePathScanner { public enum Flag { TABLE_HAS_CAPTION, HAS_ELEMENT, + HAS_HEADING, HAS_INLINE_TAG, HAS_TEXT, REPORTED_BAD_INLINE @@ -282,6 +283,8 @@ public class Checker extends DocTreePathScanner { final HtmlTag t = HtmlTag.get(treeName); if (t == null) { env.messages.error(HTML, tree, "dc.tag.unknown", treeName); + } else if (t.allowedVersion != HtmlVersion.ALL && t.allowedVersion != env.htmlVersion) { + env.messages.error(HTML, tree, "dc.tag.not.supported", treeName); } else { boolean done = false; for (TagStackItem tsi: tagStack) { @@ -345,6 +348,12 @@ public class Checker extends DocTreePathScanner { parent.flags.add(Flag.TABLE_HAS_CAPTION); break; + case H1: case H2: case H3: case H4: case H5: case H6: + if (parent != null && (parent.tag == HtmlTag.SECTION || parent.tag == HtmlTag.ARTICLE)) { + parent.flags.add(Flag.HAS_HEADING); + } + break; + case IMG: if (!top.attrs.contains(HtmlTag.Attr.ALT)) env.messages.error(ACCESSIBILITY, tree, "dc.no.alt.attr.for.image"); @@ -460,6 +469,14 @@ public class Checker extends DocTreePathScanner { env.messages.error(ACCESSIBILITY, tree, "dc.no.summary.or.caption.for.table"); } + break; + + case SECTION: + case ARTICLE: + if (env.htmlVersion == HtmlVersion.HTML5 && !top.flags.contains(Flag.HAS_HEADING)) { + env.messages.error(HTML, tree, "dc.tag.requires.heading", treeName); + } + break; } warnIfEmpty(top, tree); tagStack.pop(); @@ -519,25 +536,21 @@ public class Checker extends DocTreePathScanner { Name name = tree.getName(); HtmlTag.Attr attr = currTag.getAttr(name); if (attr != null) { + if (env.htmlVersion == HtmlVersion.HTML4 && attr.name().contains("-")) { + env.messages.error(HTML, tree, "dc.attr.not.supported.html4", name); + } boolean first = tagStack.peek().attrs.add(attr); if (!first) env.messages.error(HTML, tree, "dc.attr.repeated", name); } AttrKind k = currTag.getAttrKind(name); - switch (k) { - case OK: + switch (env.htmlVersion) { + case HTML4: + validateHtml4Attrs(tree, name, k); break; - case INVALID: - env.messages.error(HTML, tree, "dc.attr.unknown", name); - break; - - case OBSOLETE: - env.messages.warning(ACCESSIBILITY, tree, "dc.attr.obsolete", name); - break; - - case USE_CSS: - env.messages.warning(ACCESSIBILITY, tree, "dc.attr.obsolete.use.css", name); + case HTML5: + validateHtml5Attrs(tree, name, k); break; } @@ -590,6 +603,20 @@ public class Checker extends DocTreePathScanner { } } break; + + case BORDER: + if (currTag == HtmlTag.TABLE) { + String v = getAttrValue(tree); + try { + if (env.htmlVersion == HtmlVersion.HTML5 + && (v == null || (!v.isEmpty() && Integer.parseInt(v) != 1))) { + env.messages.error(HTML, tree, "dc.attr.table.border.html5", attr); + } + } catch (NumberFormatException ex) { + env.messages.error(HTML, tree, "dc.attr.table.border.html5", attr); + } + } + break; } } } @@ -599,6 +626,45 @@ public class Checker extends DocTreePathScanner { return super.visitAttribute(tree, ignore); } + private void validateHtml4Attrs(AttributeTree tree, Name name, AttrKind k) { + switch (k) { + case ALL: + case HTML4: + break; + + case INVALID: + env.messages.error(HTML, tree, "dc.attr.unknown", name); + break; + + case OBSOLETE: + env.messages.warning(ACCESSIBILITY, tree, "dc.attr.obsolete", name); + break; + + case USE_CSS: + env.messages.warning(ACCESSIBILITY, tree, "dc.attr.obsolete.use.css", name); + break; + + case HTML5: + env.messages.error(HTML, tree, "dc.attr.not.supported.html4", name); + break; + } + } + + private void validateHtml5Attrs(AttributeTree tree, Name name, AttrKind k) { + switch (k) { + case ALL: + case HTML5: + break; + + case INVALID: + case OBSOLETE: + case USE_CSS: + case HTML4: + env.messages.error(HTML, tree, "dc.attr.not.supported.html5", name); + break; + } + } + private boolean checkAnchor(String name) { Element e = getEnclosingPackageOrClass(env.currElement); if (e == null) diff --git a/langtools/src/jdk.compiler/share/classes/com/sun/tools/doclint/DocLint.java b/langtools/src/jdk.compiler/share/classes/com/sun/tools/doclint/DocLint.java index e6ee1e4513b..580e3eb9e66 100644 --- a/langtools/src/jdk.compiler/share/classes/com/sun/tools/doclint/DocLint.java +++ b/langtools/src/jdk.compiler/share/classes/com/sun/tools/doclint/DocLint.java @@ -1,5 +1,5 @@ /* - * Copyright (c) 2012, 2014, Oracle and/or its affiliates. All rights reserved. + * Copyright (c) 2012, 2015, Oracle and/or its affiliates. All rights reserved. * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. * * This code is free software; you can redistribute it and/or modify it @@ -80,6 +80,7 @@ public class DocLint implements Plugin { private static final String STATS = "-stats"; public static final String XIMPLICIT_HEADERS = "-XimplicitHeaders:"; public static final String XCUSTOM_TAGS_PREFIX = "-XcustomTags:"; + public static final String XHTML_VERSION_PREFIX = "-XhtmlVersion:"; public static final String XCHECK_PACKAGE = "-XcheckPackage:"; public static final String SEPARATOR = ","; @@ -210,6 +211,14 @@ public class DocLint implements Plugin { env.messages.setOptions(arg.substring(arg.indexOf(":") + 1)); } else if (arg.startsWith(XCUSTOM_TAGS_PREFIX)) { env.setCustomTags(arg.substring(arg.indexOf(":") + 1)); + } else if (arg.startsWith(XHTML_VERSION_PREFIX)) { + String argsVersion = arg.substring(arg.indexOf(":") + 1); + HtmlVersion htmlVersion = HtmlVersion.getHtmlVersion(argsVersion); + if (htmlVersion != null) { + env.setHtmlVersion(htmlVersion); + } else { + throw new BadArgs("dc.bad.value.for.option", arg, argsVersion); + } } else if (arg.equals("-h") || arg.equals("-help") || arg.equals("--help") || arg.equals("-?") || arg.equals("-usage")) { needHelp = true; @@ -274,6 +283,14 @@ public class DocLint implements Plugin { env.setImplicitHeaders(Character.digit(ch, 10)); } else if (arg.startsWith(XCUSTOM_TAGS_PREFIX)) { env.setCustomTags(arg.substring(arg.indexOf(":") + 1)); + } else if (arg.startsWith(XHTML_VERSION_PREFIX)) { + String argsVersion = arg.substring(arg.indexOf(":") + 1); + HtmlVersion htmlVersion = HtmlVersion.getHtmlVersion(argsVersion); + if (htmlVersion != null) { + env.setHtmlVersion(htmlVersion); + } else { + throw new IllegalArgumentException(argsVersion); + } } else if (arg.startsWith(XCHECK_PACKAGE)) { env.setCheckPackages(arg.substring(arg.indexOf(":") + 1)); } else diff --git a/langtools/src/jdk.compiler/share/classes/com/sun/tools/doclint/Env.java b/langtools/src/jdk.compiler/share/classes/com/sun/tools/doclint/Env.java index 448e4d79c19..f7aaa5a4f01 100644 --- a/langtools/src/jdk.compiler/share/classes/com/sun/tools/doclint/Env.java +++ b/langtools/src/jdk.compiler/share/classes/com/sun/tools/doclint/Env.java @@ -1,5 +1,5 @@ /* - * Copyright (c) 2012, 2013, Oracle and/or its affiliates. All rights reserved. + * Copyright (c) 2012, 2015, Oracle and/or its affiliates. All rights reserved. * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. * * This code is free software; you can redistribute it and/or modify it @@ -99,6 +99,8 @@ public class Env { Set includePackages; Set excludePackages; + HtmlVersion htmlVersion = HtmlVersion.HTML4; + // Utility classes DocTrees trees; Elements elements; @@ -193,6 +195,10 @@ public class Env { return true; } + void setHtmlVersion(HtmlVersion version) { + htmlVersion = version; + } + /** Set the current declaration and its doc comment. */ void setCurrent(TreePath path, DocCommentTree comment) { currPath = path; diff --git a/langtools/src/jdk.compiler/share/classes/com/sun/tools/doclint/HtmlTag.java b/langtools/src/jdk.compiler/share/classes/com/sun/tools/doclint/HtmlTag.java index ac33290e83c..6f42b903526 100644 --- a/langtools/src/jdk.compiler/share/classes/com/sun/tools/doclint/HtmlTag.java +++ b/langtools/src/jdk.compiler/share/classes/com/sun/tools/doclint/HtmlTag.java @@ -1,5 +1,5 @@ /* - * Copyright (c) 2010, 2014, Oracle and/or its affiliates. All rights reserved. + * Copyright (c) 2010, 2015, Oracle and/or its affiliates. All rights reserved. * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. * * This code is free software; you can redistribute it and/or modify it @@ -51,26 +51,37 @@ import com.sun.tools.javac.util.StringUtils; * * @see HTML 4.01 Specification * @see HTML 5 Specification + * @see WAI-ARIA Specification + * @see WAI-ARIA Recommendations Table * @author Bhavesh Patel * @author Jonathan Gibbons (revised) */ public enum HtmlTag { A(BlockType.INLINE, EndKind.REQUIRED, - attrs(AttrKind.OK, HREF, TARGET, NAME)), + attrs(AttrKind.ALL, HREF, TARGET, ID), + attrs(AttrKind.HTML4, REV, CHARSET, SHAPE, COORDS, NAME)), ABBR(BlockType.INLINE, EndKind.REQUIRED, EnumSet.of(Flag.EXPECT_CONTENT, Flag.NO_NEST)), - ACRONYM(BlockType.INLINE, EndKind.REQUIRED, + ACRONYM(HtmlVersion.HTML4, BlockType.INLINE, EndKind.REQUIRED, EnumSet.of(Flag.EXPECT_CONTENT, Flag.NO_NEST)), ADDRESS(BlockType.INLINE, EndKind.REQUIRED, EnumSet.of(Flag.EXPECT_CONTENT, Flag.NO_NEST)), + ARTICLE(HtmlVersion.HTML5, BlockType.BLOCK, EndKind.REQUIRED, + EnumSet.of(Flag.ACCEPTS_BLOCK, Flag.ACCEPTS_INLINE)), + + ASIDE(HtmlVersion.HTML5, BlockType.BLOCK, EndKind.REQUIRED, + EnumSet.of(Flag.ACCEPTS_BLOCK, Flag.ACCEPTS_INLINE)), + B(BlockType.INLINE, EndKind.REQUIRED, EnumSet.of(Flag.EXPECT_CONTENT, Flag.NO_NEST)), - BIG(BlockType.INLINE, EndKind.REQUIRED, + BDI(HtmlVersion.HTML5, BlockType.INLINE, EndKind.REQUIRED), + + BIG(HtmlVersion.HTML4, BlockType.INLINE, EndKind.REQUIRED, EnumSet.of(Flag.EXPECT_CONTENT)), BLOCKQUOTE(BlockType.BLOCK, EndKind.REQUIRED, @@ -82,9 +93,10 @@ public enum HtmlTag { attrs(AttrKind.USE_CSS, CLEAR)), CAPTION(BlockType.TABLE_ITEM, EndKind.REQUIRED, - EnumSet.of(Flag.ACCEPTS_INLINE, Flag.EXPECT_CONTENT)), + EnumSet.of(Flag.ACCEPTS_INLINE, Flag.EXPECT_CONTENT), + attrs(AttrKind.USE_CSS, ALIGN)), - CENTER(BlockType.BLOCK, EndKind.REQUIRED, + CENTER(HtmlVersion.HTML4, BlockType.BLOCK, EndKind.REQUIRED, EnumSet.of(Flag.ACCEPTS_BLOCK, Flag.ACCEPTS_INLINE)), CITE(BlockType.INLINE, EndKind.REQUIRED, @@ -93,18 +105,30 @@ public enum HtmlTag { CODE(BlockType.INLINE, EndKind.REQUIRED, EnumSet.of(Flag.EXPECT_CONTENT, Flag.NO_NEST)), + COL(BlockType.TABLE_ITEM, EndKind.NONE, + attrs(AttrKind.HTML4, ALIGN, CHAR, CHAROFF, VALIGN, WIDTH)), + + COLGROUP(BlockType.TABLE_ITEM, EndKind.REQUIRED, + attrs(AttrKind.HTML4, ALIGN, CHAR, CHAROFF, VALIGN, WIDTH)) { + @Override + public boolean accepts(HtmlTag t) { + return (t == COL); + } + }, + DD(BlockType.LIST_ITEM, EndKind.OPTIONAL, EnumSet.of(Flag.ACCEPTS_BLOCK, Flag.ACCEPTS_INLINE, Flag.EXPECT_CONTENT)), DEL(BlockType.INLINE, EndKind.REQUIRED, EnumSet.of(Flag.EXPECT_CONTENT, Flag.NO_NEST), - attrs(AttrKind.OK, Attr.CITE, Attr.DATETIME)), + attrs(AttrKind.ALL, Attr.CITE, Attr.DATETIME)), DFN(BlockType.INLINE, EndKind.REQUIRED, EnumSet.of(Flag.EXPECT_CONTENT, Flag.NO_NEST)), DIV(BlockType.BLOCK, EndKind.REQUIRED, - EnumSet.of(Flag.ACCEPTS_BLOCK, Flag.ACCEPTS_INLINE)), + EnumSet.of(Flag.ACCEPTS_BLOCK, Flag.ACCEPTS_INLINE), + attrs(AttrKind.USE_CSS, ALIGN)), DL(BlockType.BLOCK, EndKind.REQUIRED, EnumSet.of(Flag.EXPECT_CONTENT), @@ -121,49 +145,95 @@ public enum HtmlTag { EM(BlockType.INLINE, EndKind.REQUIRED, EnumSet.of(Flag.NO_NEST)), - FONT(BlockType.INLINE, EndKind.REQUIRED, // tag itself is deprecated + FONT(HtmlVersion.HTML4, BlockType.INLINE, EndKind.REQUIRED, // tag itself is deprecated EnumSet.of(Flag.EXPECT_CONTENT), attrs(AttrKind.USE_CSS, SIZE, COLOR, FACE)), - FRAME(BlockType.OTHER, EndKind.NONE), + FOOTER(HtmlVersion.HTML5, BlockType.BLOCK, EndKind.REQUIRED, + EnumSet.of(Flag.ACCEPTS_BLOCK, Flag.ACCEPTS_INLINE)) { + @Override + public boolean accepts(HtmlTag t) { + switch (t) { + case HEADER: case FOOTER: case MAIN: + return false; + default: + return (t.blockType == BlockType.BLOCK) || (t.blockType == BlockType.INLINE); + } + } + }, - FRAMESET(BlockType.OTHER, EndKind.REQUIRED), + FIGURE(HtmlVersion.HTML5, BlockType.BLOCK, EndKind.REQUIRED, + EnumSet.of(Flag.ACCEPTS_BLOCK, Flag.ACCEPTS_INLINE)), - H1(BlockType.BLOCK, EndKind.REQUIRED), - H2(BlockType.BLOCK, EndKind.REQUIRED), - H3(BlockType.BLOCK, EndKind.REQUIRED), - H4(BlockType.BLOCK, EndKind.REQUIRED), - H5(BlockType.BLOCK, EndKind.REQUIRED), - H6(BlockType.BLOCK, EndKind.REQUIRED), + FIGCAPTION(HtmlVersion.HTML5, BlockType.BLOCK, EndKind.REQUIRED), + + FRAME(HtmlVersion.HTML4, BlockType.OTHER, EndKind.NONE), + + FRAMESET(HtmlVersion.HTML4, BlockType.OTHER, EndKind.REQUIRED), + + H1(BlockType.BLOCK, EndKind.REQUIRED, + attrs(AttrKind.USE_CSS, ALIGN)), + H2(BlockType.BLOCK, EndKind.REQUIRED, + attrs(AttrKind.USE_CSS, ALIGN)), + H3(BlockType.BLOCK, EndKind.REQUIRED, + attrs(AttrKind.USE_CSS, ALIGN)), + H4(BlockType.BLOCK, EndKind.REQUIRED, + attrs(AttrKind.USE_CSS, ALIGN)), + H5(BlockType.BLOCK, EndKind.REQUIRED, + attrs(AttrKind.USE_CSS, ALIGN)), + H6(BlockType.BLOCK, EndKind.REQUIRED, + attrs(AttrKind.USE_CSS, ALIGN)), HEAD(BlockType.OTHER, EndKind.REQUIRED), + HEADER(HtmlVersion.HTML5, BlockType.BLOCK, EndKind.REQUIRED, + EnumSet.of(Flag.ACCEPTS_BLOCK, Flag.ACCEPTS_INLINE)) { + @Override + public boolean accepts(HtmlTag t) { + switch (t) { + case HEADER: case FOOTER: case MAIN: + return false; + default: + return (t.blockType == BlockType.BLOCK) || (t.blockType == BlockType.INLINE); + } + } + }, + HR(BlockType.BLOCK, EndKind.NONE, - attrs(AttrKind.OK, WIDTH)), // OK in 4.01; not allowed in 5 + attrs(AttrKind.HTML4, WIDTH), + attrs(AttrKind.USE_CSS, ALIGN, NOSHADE, SIZE)), HTML(BlockType.OTHER, EndKind.REQUIRED), I(BlockType.INLINE, EndKind.REQUIRED, EnumSet.of(Flag.EXPECT_CONTENT, Flag.NO_NEST)), + IFRAME(BlockType.OTHER, EndKind.REQUIRED), + IMG(BlockType.INLINE, EndKind.NONE, - attrs(AttrKind.OK, SRC, ALT, HEIGHT, WIDTH), + attrs(AttrKind.ALL, SRC, ALT, HEIGHT, WIDTH), + attrs(AttrKind.HTML5, CROSSORIGIN), attrs(AttrKind.OBSOLETE, NAME), attrs(AttrKind.USE_CSS, ALIGN, HSPACE, VSPACE, BORDER)), INS(BlockType.INLINE, EndKind.REQUIRED, EnumSet.of(Flag.EXPECT_CONTENT, Flag.NO_NEST), - attrs(AttrKind.OK, Attr.CITE, Attr.DATETIME)), + attrs(AttrKind.ALL, Attr.CITE, Attr.DATETIME)), KBD(BlockType.INLINE, EndKind.REQUIRED, EnumSet.of(Flag.EXPECT_CONTENT, Flag.NO_NEST)), LI(BlockType.LIST_ITEM, EndKind.OPTIONAL, EnumSet.of(Flag.ACCEPTS_BLOCK, Flag.ACCEPTS_INLINE), - attrs(AttrKind.OK, VALUE)), + attrs(AttrKind.ALL, VALUE), + attrs(AttrKind.USE_CSS, TYPE)), LINK(BlockType.OTHER, EndKind.NONE), + MAIN(HtmlVersion.HTML5, BlockType.OTHER, EndKind.REQUIRED), + + MARK(HtmlVersion.HTML5, BlockType.INLINE, EndKind.REQUIRED), + MENU(BlockType.BLOCK, EndKind.REQUIRED) { @Override public boolean accepts(HtmlTag t) { @@ -173,13 +243,18 @@ public enum HtmlTag { META(BlockType.OTHER, EndKind.NONE), - NOFRAMES(BlockType.OTHER, EndKind.REQUIRED), + NAV(HtmlVersion.HTML5, BlockType.BLOCK, EndKind.REQUIRED, + EnumSet.of(Flag.ACCEPTS_BLOCK, Flag.ACCEPTS_INLINE)), + + NOFRAMES(HtmlVersion.HTML4, BlockType.OTHER, EndKind.REQUIRED), NOSCRIPT(BlockType.BLOCK, EndKind.REQUIRED), OL(BlockType.BLOCK, EndKind.REQUIRED, EnumSet.of(Flag.EXPECT_CONTENT), - attrs(AttrKind.OK, START, TYPE)) { + attrs(AttrKind.ALL, START, TYPE), + attrs(AttrKind.HTML5, REVERSED), + attrs(AttrKind.USE_CSS, COMPACT)) { @Override public boolean accepts(HtmlTag t) { return (t == LI); @@ -191,7 +266,8 @@ public enum HtmlTag { attrs(AttrKind.USE_CSS, ALIGN)), PRE(BlockType.BLOCK, EndKind.REQUIRED, - EnumSet.of(Flag.EXPECT_CONTENT)) { + EnumSet.of(Flag.EXPECT_CONTENT), + attrs(AttrKind.USE_CSS, WIDTH)) { @Override public boolean accepts(HtmlTag t) { switch (t) { @@ -214,13 +290,16 @@ public enum HtmlTag { SCRIPT(BlockType.OTHER, EndKind.REQUIRED), + SECTION(HtmlVersion.HTML5, BlockType.BLOCK, EndKind.REQUIRED, + EnumSet.of(Flag.ACCEPTS_BLOCK, Flag.ACCEPTS_INLINE)), + SMALL(BlockType.INLINE, EndKind.REQUIRED, EnumSet.of(Flag.EXPECT_CONTENT)), SPAN(BlockType.INLINE, EndKind.REQUIRED, EnumSet.of(Flag.EXPECT_CONTENT)), - STRIKE(BlockType.INLINE, EndKind.REQUIRED, + STRIKE(HtmlVersion.HTML4, BlockType.INLINE, EndKind.REQUIRED, EnumSet.of(Flag.EXPECT_CONTENT)), STRONG(BlockType.INLINE, EndKind.REQUIRED, @@ -234,13 +313,14 @@ public enum HtmlTag { TABLE(BlockType.BLOCK, EndKind.REQUIRED, EnumSet.of(Flag.EXPECT_CONTENT), - attrs(AttrKind.OK, SUMMARY, Attr.FRAME, RULES, BORDER, - CELLPADDING, CELLSPACING, WIDTH), // width OK in 4.01; not allowed in 5 + attrs(AttrKind.ALL, BORDER), + attrs(AttrKind.HTML4, SUMMARY, CELLPADDING, CELLSPACING, Attr.FRAME, RULES, WIDTH), attrs(AttrKind.USE_CSS, ALIGN, BGCOLOR)) { @Override public boolean accepts(HtmlTag t) { switch (t) { case CAPTION: + case COLGROUP: case THEAD: case TBODY: case TFOOT: case TR: // HTML 3.2 return true; @@ -252,7 +332,8 @@ public enum HtmlTag { TBODY(BlockType.TABLE_ITEM, EndKind.REQUIRED, EnumSet.of(Flag.EXPECT_CONTENT), - attrs(AttrKind.OK, ALIGN, CHAR, CHAROFF, VALIGN)) { + attrs(AttrKind.ALL, VALIGN), + attrs(AttrKind.HTML4, ALIGN, CHAR, CHAROFF)) { @Override public boolean accepts(HtmlTag t) { return (t == TR); @@ -261,12 +342,16 @@ public enum HtmlTag { TD(BlockType.TABLE_ITEM, EndKind.OPTIONAL, EnumSet.of(Flag.ACCEPTS_BLOCK, Flag.ACCEPTS_INLINE), - attrs(AttrKind.OK, COLSPAN, ROWSPAN, HEADERS, SCOPE, Attr.ABBR, AXIS, - ALIGN, CHAR, CHAROFF, VALIGN), + attrs(AttrKind.ALL, COLSPAN, ROWSPAN, HEADERS, VALIGN), + attrs(AttrKind.HTML4, AXIS, Attr.ABBR, SCOPE, ALIGN, CHAR, CHAROFF), attrs(AttrKind.USE_CSS, WIDTH, BGCOLOR, HEIGHT, NOWRAP)), + TEMPLATE(HtmlVersion.HTML5, BlockType.BLOCK, EndKind.REQUIRED, + EnumSet.of(Flag.ACCEPTS_BLOCK, Flag.ACCEPTS_INLINE)), + TFOOT(BlockType.TABLE_ITEM, EndKind.REQUIRED, - attrs(AttrKind.OK, ALIGN, CHAR, CHAROFF, VALIGN)) { + attrs(AttrKind.ALL, VALIGN), + attrs(AttrKind.HTML4, ALIGN, CHAR, CHAROFF)) { @Override public boolean accepts(HtmlTag t) { return (t == TR); @@ -275,22 +360,27 @@ public enum HtmlTag { TH(BlockType.TABLE_ITEM, EndKind.OPTIONAL, EnumSet.of(Flag.ACCEPTS_BLOCK, Flag.ACCEPTS_INLINE), - attrs(AttrKind.OK, COLSPAN, ROWSPAN, HEADERS, SCOPE, Attr.ABBR, AXIS, - ALIGN, CHAR, CHAROFF, VALIGN), + attrs(AttrKind.ALL, COLSPAN, ROWSPAN, HEADERS, SCOPE, Attr.ABBR, + VALIGN), + attrs(AttrKind.HTML4, AXIS, ALIGN, CHAR, CHAROFF), attrs(AttrKind.USE_CSS, WIDTH, BGCOLOR, HEIGHT, NOWRAP)), THEAD(BlockType.TABLE_ITEM, EndKind.REQUIRED, - attrs(AttrKind.OK, ALIGN, CHAR, CHAROFF, VALIGN)) { + attrs(AttrKind.ALL, VALIGN), + attrs(AttrKind.HTML4, ALIGN, CHAR, CHAROFF)) { @Override public boolean accepts(HtmlTag t) { return (t == TR); } }, + TIME(HtmlVersion.HTML5, BlockType.INLINE, EndKind.REQUIRED), + TITLE(BlockType.OTHER, EndKind.REQUIRED), TR(BlockType.TABLE_ITEM, EndKind.OPTIONAL, - attrs(AttrKind.OK, ALIGN, CHAR, CHAROFF, VALIGN), + attrs(AttrKind.ALL, VALIGN), + attrs(AttrKind.HTML4, ALIGN, CHAR, CHAROFF), attrs(AttrKind.USE_CSS, BGCOLOR)) { @Override public boolean accepts(HtmlTag t) { @@ -298,7 +388,7 @@ public enum HtmlTag { } }, - TT(BlockType.INLINE, EndKind.REQUIRED, + TT(HtmlVersion.HTML4, BlockType.INLINE, EndKind.REQUIRED, EnumSet.of(Flag.EXPECT_CONTENT, Flag.NO_NEST)), U(BlockType.INLINE, EndKind.REQUIRED, @@ -306,13 +396,15 @@ public enum HtmlTag { UL(BlockType.BLOCK, EndKind.REQUIRED, EnumSet.of(Flag.EXPECT_CONTENT), - attrs(AttrKind.OK, COMPACT, TYPE)) { // OK in 4.01; not allowed in 5 + attrs(AttrKind.HTML4, COMPACT, TYPE)) { @Override public boolean accepts(HtmlTag t) { return (t == LI); } }, + WBR(HtmlVersion.HTML5, BlockType.INLINE, EndKind.REQUIRED), + VAR(BlockType.INLINE, EndKind.REQUIRED); /** @@ -345,34 +437,66 @@ public enum HtmlTag { public static enum Attr { ABBR, ALIGN, + ALINK, ALT, + ARIA_ACTIVEDESCENDANT, + ARIA_CONTROLS, + ARIA_DESCRIBEDBY, + ARIA_EXPANDED, + ARIA_LABEL, + ARIA_LABELLEDBY, + ARIA_LEVEL, + ARIA_MULTISELECTABLE, + ARIA_OWNS, + ARIA_POSINSET, + ARIA_SETSIZE, + ARIA_READONLY, + ARIA_REQUIRED, + ARIA_SELECTED, + ARIA_SORT, AXIS, + BACKGROUND, BGCOLOR, BORDER, CELLSPACING, CELLPADDING, CHAR, CHAROFF, + CHARSET, CITE, CLEAR, CLASS, COLOR, COLSPAN, COMPACT, + COORDS, + CROSSORIGIN, DATETIME, FACE, FRAME, + FRAMEBORDER, HEADERS, HEIGHT, HREF, HSPACE, ID, + LINK, + LONGDESC, + MARGINHEIGHT, + MARGINWIDTH, NAME, + NOSHADE, NOWRAP, + PROFILE, + REV, REVERSED, + ROLE, ROWSPAN, RULES, + SCHEME, SCOPE, + SCROLLING, + SHAPE, SIZE, SPACE, SRC, @@ -380,14 +504,23 @@ public enum HtmlTag { STYLE, SUMMARY, TARGET, + TEXT, TYPE, VALIGN, VALUE, + VERSION, + VLINK, VSPACE, WIDTH; + private final String name; + + Attr() { + name = StringUtils.toLowerCase(name().replace("_", "-")); + } + public String getText() { - return StringUtils.toLowerCase(name()); + return name; } static final Map index = new HashMap<>(); @@ -399,10 +532,12 @@ public enum HtmlTag { } public static enum AttrKind { + HTML4, + HTML5, INVALID, OBSOLETE, USE_CSS, - OK + ALL } // This class exists to avoid warnings from using parameterized vararg type @@ -415,25 +550,52 @@ public enum HtmlTag { } + public final HtmlVersion allowedVersion; public final BlockType blockType; public final EndKind endKind; public final Set flags; private final Map attrs; HtmlTag(BlockType blockType, EndKind endKind, AttrMap... attrMaps) { - this(blockType, endKind, Collections.emptySet(), attrMaps); + this(HtmlVersion.ALL, blockType, endKind, Collections.emptySet(), attrMaps); + } + + HtmlTag(HtmlVersion allowedVersion, BlockType blockType, EndKind endKind, AttrMap... attrMaps) { + this(allowedVersion, blockType, endKind, Collections.emptySet(), attrMaps); } HtmlTag(BlockType blockType, EndKind endKind, Set flags, AttrMap... attrMaps) { + this(HtmlVersion.ALL, blockType, endKind, flags, attrMaps); + } + + HtmlTag(HtmlVersion allowedVersion, BlockType blockType, EndKind endKind, Set flags, AttrMap... attrMaps) { + this.allowedVersion = allowedVersion; this.blockType = blockType; this.endKind = endKind; this.flags = flags; this.attrs = new EnumMap<>(Attr.class); for (Map m: attrMaps) this.attrs.putAll(m); - attrs.put(Attr.CLASS, AttrKind.OK); - attrs.put(Attr.ID, AttrKind.OK); - attrs.put(Attr.STYLE, AttrKind.OK); + attrs.put(Attr.CLASS, AttrKind.ALL); + attrs.put(Attr.ID, AttrKind.ALL); + attrs.put(Attr.STYLE, AttrKind.ALL); + attrs.put(Attr.ROLE, AttrKind.HTML5); + // for now, assume that all ARIA attributes are allowed on all tags. + attrs.put(Attr.ARIA_ACTIVEDESCENDANT, AttrKind.HTML5); + attrs.put(Attr.ARIA_CONTROLS, AttrKind.HTML5); + attrs.put(Attr.ARIA_DESCRIBEDBY, AttrKind.HTML5); + attrs.put(Attr.ARIA_EXPANDED, AttrKind.HTML5); + attrs.put(Attr.ARIA_LABEL, AttrKind.HTML5); + attrs.put(Attr.ARIA_LABELLEDBY, AttrKind.HTML5); + attrs.put(Attr.ARIA_LEVEL, AttrKind.HTML5); + attrs.put(Attr.ARIA_MULTISELECTABLE, AttrKind.HTML5); + attrs.put(Attr.ARIA_OWNS, AttrKind.HTML5); + attrs.put(Attr.ARIA_POSINSET, AttrKind.HTML5); + attrs.put(Attr.ARIA_READONLY, AttrKind.HTML5); + attrs.put(Attr.ARIA_REQUIRED, AttrKind.HTML5); + attrs.put(Attr.ARIA_SELECTED, AttrKind.HTML5); + attrs.put(Attr.ARIA_SETSIZE, AttrKind.HTML5); + attrs.put(Attr.ARIA_SORT, AttrKind.HTML5); } public boolean accepts(HtmlTag t) { diff --git a/langtools/src/jdk.compiler/share/classes/com/sun/tools/doclint/HtmlVersion.java b/langtools/src/jdk.compiler/share/classes/com/sun/tools/doclint/HtmlVersion.java new file mode 100644 index 00000000000..cfa40ba30b9 --- /dev/null +++ b/langtools/src/jdk.compiler/share/classes/com/sun/tools/doclint/HtmlVersion.java @@ -0,0 +1,49 @@ +/* + * Copyright (c) 2015, Oracle and/or its affiliates. All rights reserved. + * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. + * + * This code is free software; you can redistribute it and/or modify it + * under the terms of the GNU General Public License version 2 only, as + * published by the Free Software Foundation. Oracle designates this + * particular file as subject to the "Classpath" exception as provided + * by Oracle in the LICENSE file that accompanied this code. + * + * 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 com.sun.tools.doclint; + +/** + * Enum representing HTML version of the documentation comment. + * + * @author Bhavesh Patel + */ +public enum HtmlVersion { + + HTML4, + HTML5, + ALL; + + public static HtmlVersion getHtmlVersion(String argsVersion) { + switch (argsVersion) { + case "html4": + return HtmlVersion.HTML4; + case "html5": + return HtmlVersion.HTML5; + default: + return null; + } + } +} diff --git a/langtools/src/jdk.compiler/share/classes/com/sun/tools/doclint/resources/doclint.properties b/langtools/src/jdk.compiler/share/classes/com/sun/tools/doclint/resources/doclint.properties index 1f47d94d3bc..03adb82aeaa 100644 --- a/langtools/src/jdk.compiler/share/classes/com/sun/tools/doclint/resources/doclint.properties +++ b/langtools/src/jdk.compiler/share/classes/com/sun/tools/doclint/resources/doclint.properties @@ -27,9 +27,12 @@ dc.anchor.already.defined = anchor already defined: "{0}" dc.anchor.value.missing = no value given for anchor dc.attr.lacks.value = attribute lacks value dc.attr.not.number = attribute value is not a number +dc.attr.not.supported.html4 = attribute not supported in HTML4: {0} +dc.attr.not.supported.html5 = attribute not supported in HTML5: {0} dc.attr.obsolete = attribute obsolete: {0} dc.attr.obsolete.use.css = attribute obsolete, use CSS instead: {0} dc.attr.repeated = repeated attribute: {0} +dc.attr.table.border.html5 = attribute border for table only accepts "" or "1", use CSS instead: {0} dc.attr.unknown = unknown attribute: {0} dc.bad.option = bad option: {0} dc.bad.value.for.option = bad value for option: {0} {1} @@ -63,9 +66,11 @@ dc.tag.not.allowed.inline.tag = block element not allowed within @{1}: {0} dc.tag.not.allowed.inline.other = block element not allowed here: {0} dc.tag.not.closed= element not closed: {0} dc.tag.p.in.pre= unexpected use of

inside

 element
+dc.tag.requires.heading = heading not found for 
 dc.tag.self.closing = self-closing element not allowed
 dc.tag.start.unmatched = end tag missing: 
 dc.tag.unknown = unknown tag: {0}
+dc.tag.not.supported = tag not supported in the generated HTML version: {0}
 dc.text.not.allowed = text not allowed in <{0}> element
 dc.type.arg.not.allowed = type arguments not allowed here
 dc.unexpected.comment=documentation comment not expected here
diff --git a/langtools/src/jdk.javadoc/share/classes/com/sun/tools/doclets/formats/html/AbstractMemberWriter.java b/langtools/src/jdk.javadoc/share/classes/com/sun/tools/doclets/formats/html/AbstractMemberWriter.java
index c42a692803f..54d8046ff1d 100644
--- a/langtools/src/jdk.javadoc/share/classes/com/sun/tools/doclets/formats/html/AbstractMemberWriter.java
+++ b/langtools/src/jdk.javadoc/share/classes/com/sun/tools/doclets/formats/html/AbstractMemberWriter.java
@@ -1,5 +1,5 @@
 /*
- * Copyright (c) 1997, 2014, Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 1997, 2015, Oracle and/or its affiliates. All rights reserved.
  * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
  *
  * This code is free software; you can redistribute it and/or modify it
@@ -415,8 +415,10 @@ public abstract class AbstractMemberWriter {
     protected void addDeprecatedAPI(List deprmembers, String headingKey,
             String tableSummary, String[] tableHeader, Content contentTree) {
         if (deprmembers.size() > 0) {
-            Content table = HtmlTree.TABLE(HtmlStyle.deprecatedSummary, 0, 3, 0, tableSummary,
-                writer.getTableCaption(configuration.getResource(headingKey)));
+            Content caption = writer.getTableCaption(configuration.getResource(headingKey));
+            Content table = (configuration.isOutputHtml5())
+                    ? HtmlTree.TABLE(HtmlStyle.deprecatedSummary, caption)
+                    : HtmlTree.TABLE(HtmlStyle.deprecatedSummary, tableSummary, caption);
             table.addContent(writer.getSummaryTableHeader(tableHeader, "col"));
             Content tbody = new HtmlTree(HtmlTag.TBODY);
             for (int i = 0; i < deprmembers.size(); i++) {
@@ -455,8 +457,10 @@ public abstract class AbstractMemberWriter {
         List members = mems;
         boolean printedUseTableHeader = false;
         if (members.size() > 0) {
-            Content table = HtmlTree.TABLE(HtmlStyle.useSummary, 0, 3, 0, tableSummary,
-                    writer.getTableCaption(heading));
+            Content caption = writer.getTableCaption(heading);
+            Content table = (configuration.isOutputHtml5())
+                    ? HtmlTree.TABLE(HtmlStyle.useSummary, caption)
+                    : HtmlTree.TABLE(HtmlStyle.useSummary, tableSummary, caption);
             Content tbody = new HtmlTree(HtmlTag.TBODY);
             Iterator it = members.iterator();
             for (int i = 0; it.hasNext(); i++) {
diff --git a/langtools/src/jdk.javadoc/share/classes/com/sun/tools/doclets/formats/html/AbstractPackageIndexWriter.java b/langtools/src/jdk.javadoc/share/classes/com/sun/tools/doclets/formats/html/AbstractPackageIndexWriter.java
index 76bf7aae7c8..9378865aacd 100644
--- a/langtools/src/jdk.javadoc/share/classes/com/sun/tools/doclets/formats/html/AbstractPackageIndexWriter.java
+++ b/langtools/src/jdk.javadoc/share/classes/com/sun/tools/doclets/formats/html/AbstractPackageIndexWriter.java
@@ -1,5 +1,5 @@
 /*
- * Copyright (c) 1998, 2014, Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 1998, 2015, Oracle and/or its affiliates. All rights reserved.
  * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
  *
  * This code is free software; you can redistribute it and/or modify it
@@ -149,13 +149,17 @@ public abstract class AbstractPackageIndexWriter extends HtmlDocletWriter {
     protected void addIndexContents(Collection packages, String text,
             String tableSummary, Content body) {
         if (!packages.isEmpty()) {
-            HtmlTree div = new HtmlTree(HtmlTag.DIV);
-            div.addStyle(HtmlStyle.indexHeader);
-            addAllClassesLink(div);
+            HtmlTree htmlTree = (configuration.allowTag(HtmlTag.NAV))
+                    ? HtmlTree.NAV()
+                    : new HtmlTree(HtmlTag.DIV);
+            htmlTree.addStyle(HtmlStyle.indexNav);
+            HtmlTree ul = new HtmlTree(HtmlTag.UL);
+            addAllClassesLink(ul);
             if (configuration.showProfiles) {
-                addAllProfilesLink(div);
+                addAllProfilesLink(ul);
             }
-            body.addContent(div);
+            htmlTree.addContent(ul);
+            body.addContent(htmlTree);
             if (configuration.showProfiles && configuration.profilePackages.size() > 0) {
                 Content profileSummary = configuration.getResource("doclet.Profiles");
                 addProfilesList(profileSummary, body);
diff --git a/langtools/src/jdk.javadoc/share/classes/com/sun/tools/doclets/formats/html/AbstractProfileIndexWriter.java b/langtools/src/jdk.javadoc/share/classes/com/sun/tools/doclets/formats/html/AbstractProfileIndexWriter.java
index c0f7ccf3976..debbdadc10b 100644
--- a/langtools/src/jdk.javadoc/share/classes/com/sun/tools/doclets/formats/html/AbstractProfileIndexWriter.java
+++ b/langtools/src/jdk.javadoc/share/classes/com/sun/tools/doclets/formats/html/AbstractProfileIndexWriter.java
@@ -1,5 +1,5 @@
 /*
- * Copyright (c) 2013, Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 2013, 2015 Oracle and/or its affiliates. All rights reserved.
  * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
  *
  * This code is free software; you can redistribute it and/or modify it
@@ -194,11 +194,15 @@ public abstract class AbstractProfileIndexWriter extends HtmlDocletWriter {
     protected void addIndexContents(Profiles profiles, String text,
             String tableSummary, Content body) {
         if (profiles.getProfileCount() > 0) {
-            HtmlTree div = new HtmlTree(HtmlTag.DIV);
-            div.addStyle(HtmlStyle.indexHeader);
-            addAllClassesLink(div);
-            addAllPackagesLink(div);
-            body.addContent(div);
+            HtmlTree htmlTree = (configuration.allowTag(HtmlTag.NAV))
+                    ? HtmlTree.NAV()
+                    : new HtmlTree(HtmlTag.DIV);
+            htmlTree.addStyle(HtmlStyle.indexNav);
+            HtmlTree ul = new HtmlTree(HtmlTag.UL);
+            addAllClassesLink(ul);
+            addAllPackagesLink(ul);
+            htmlTree.addContent(ul);
+            body.addContent(htmlTree);
             addProfilesList(profiles, text, tableSummary, body);
         }
     }
@@ -215,12 +219,16 @@ public abstract class AbstractProfileIndexWriter extends HtmlDocletWriter {
      */
     protected void addProfilePackagesIndexContents(Profiles profiles, String text,
             String tableSummary, Content body, String profileName) {
-        HtmlTree div = new HtmlTree(HtmlTag.DIV);
-        div.addStyle(HtmlStyle.indexHeader);
-        addAllClassesLink(div);
-        addAllPackagesLink(div);
-        addAllProfilesLink(div);
-        body.addContent(div);
+        HtmlTree htmlTree = (configuration.allowTag(HtmlTag.NAV))
+                ? HtmlTree.NAV()
+                : new HtmlTree(HtmlTag.DIV);
+        htmlTree.addStyle(HtmlStyle.indexNav);
+        HtmlTree ul = new HtmlTree(HtmlTag.UL);
+        addAllClassesLink(ul);
+        addAllPackagesLink(ul);
+        addAllProfilesLink(ul);
+        htmlTree.addContent(ul);
+        body.addContent(htmlTree);
         addProfilePackagesList(profiles, text, tableSummary, body, profileName);
     }
 
diff --git a/langtools/src/jdk.javadoc/share/classes/com/sun/tools/doclets/formats/html/AbstractTreeWriter.java b/langtools/src/jdk.javadoc/share/classes/com/sun/tools/doclets/formats/html/AbstractTreeWriter.java
index fa02e59f692..cd4c70f47bb 100644
--- a/langtools/src/jdk.javadoc/share/classes/com/sun/tools/doclets/formats/html/AbstractTreeWriter.java
+++ b/langtools/src/jdk.javadoc/share/classes/com/sun/tools/doclets/formats/html/AbstractTreeWriter.java
@@ -1,5 +1,5 @@
 /*
- * Copyright (c) 1998, 2014, Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 1998, 2015, Oracle and/or its affiliates. All rights reserved.
  * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
  *
  * This code is free software; you can redistribute it and/or modify it
@@ -53,8 +53,6 @@ public abstract class AbstractTreeWriter extends HtmlDocletWriter {
      */
     protected final ClassTree classtree;
 
-    private static final String LI_CIRCLE  = "circle";
-
     /**
      * Constructor initializes classtree variable. This constructor will be used
      * while generating global tree file "overview-tree.html".
@@ -88,7 +86,7 @@ public abstract class AbstractTreeWriter extends HtmlDocletWriter {
             Content ul = new HtmlTree(HtmlTag.UL);
             for (ClassDoc local : list) {
                 HtmlTree li = new HtmlTree(HtmlTag.LI);
-                li.addAttr(HtmlAttr.TYPE, LI_CIRCLE);
+                li.addStyle(HtmlStyle.circle);
                 addPartialInfo(local, li);
                 addExtendsImplements(parent, local, li);
                 addLevelInfo(local, classtree.subs(local, isEnum),
@@ -108,14 +106,24 @@ public abstract class AbstractTreeWriter extends HtmlDocletWriter {
      * @param heading heading for the tree
      * @param div the content tree to which the tree will be added
      */
-    protected void addTree(SortedSet list, String heading, Content div) {
+    protected void addTree(SortedSet list, String heading, HtmlTree div) {
         if (!list.isEmpty()) {
             ClassDoc firstClassDoc = list.first();
             Content headingContent = getResource(heading);
-            div.addContent(HtmlTree.HEADING(HtmlConstants.CONTENT_HEADING, true,
-                    headingContent));
+            Content sectionHeading = HtmlTree.HEADING(HtmlConstants.CONTENT_HEADING, true,
+                    headingContent);
+            HtmlTree htmlTree;
+            if (configuration.allowTag(HtmlTag.SECTION)) {
+                htmlTree = HtmlTree.SECTION(sectionHeading);
+            } else {
+                div.addContent(sectionHeading);
+                htmlTree = div;
+            }
             addLevelInfo(!firstClassDoc.isInterface()? firstClassDoc : null,
-                    list, list == classtree.baseEnums(), div);
+                    list, list == classtree.baseEnums(), htmlTree);
+            if (configuration.allowTag(HtmlTag.SECTION)) {
+                div.addContent(htmlTree);
+            }
         }
     }
 
diff --git a/langtools/src/jdk.javadoc/share/classes/com/sun/tools/doclets/formats/html/AllClassesFrameWriter.java b/langtools/src/jdk.javadoc/share/classes/com/sun/tools/doclets/formats/html/AllClassesFrameWriter.java
index 71e27df0266..32f30f3331b 100644
--- a/langtools/src/jdk.javadoc/share/classes/com/sun/tools/doclets/formats/html/AllClassesFrameWriter.java
+++ b/langtools/src/jdk.javadoc/share/classes/com/sun/tools/doclets/formats/html/AllClassesFrameWriter.java
@@ -1,5 +1,5 @@
 /*
- * Copyright (c) 1998, 2014, Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 1998, 2015, Oracle and/or its affiliates. All rights reserved.
  * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
  *
  * This code is free software; you can redistribute it and/or modify it
@@ -119,8 +119,10 @@ public class AllClassesFrameWriter extends HtmlDocletWriter {
         Content ul = new HtmlTree(HtmlTag.UL);
         // Generate the class links and add it to the tdFont tree.
         addAllClasses(ul, wantFrames);
-        Content div = HtmlTree.DIV(HtmlStyle.indexContainer, ul);
-        body.addContent(div);
+        HtmlTree htmlTree = (configuration.allowTag(HtmlTag.MAIN))
+                ? HtmlTree.MAIN(HtmlStyle.indexContainer, ul)
+                : HtmlTree.DIV(HtmlStyle.indexContainer, ul);
+        body.addContent(htmlTree);
         printHtmlDocument(null, false, body);
     }
 
diff --git a/langtools/src/jdk.javadoc/share/classes/com/sun/tools/doclets/formats/html/AnnotationTypeFieldWriterImpl.java b/langtools/src/jdk.javadoc/share/classes/com/sun/tools/doclets/formats/html/AnnotationTypeFieldWriterImpl.java
index 55dcd84fc64..87cf3a079dc 100644
--- a/langtools/src/jdk.javadoc/share/classes/com/sun/tools/doclets/formats/html/AnnotationTypeFieldWriterImpl.java
+++ b/langtools/src/jdk.javadoc/share/classes/com/sun/tools/doclets/formats/html/AnnotationTypeFieldWriterImpl.java
@@ -1,5 +1,5 @@
 /*
- * Copyright (c) 2013, Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 2013, 2015 Oracle and/or its affiliates. All rights reserved.
  * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
  *
  * This code is free software; you can redistribute it and/or modify it
@@ -74,6 +74,13 @@ public class AnnotationTypeFieldWriterImpl extends AbstractMemberWriter
         return writer.getMemberTreeHeader();
     }
 
+    /**
+     * {@inheritDoc}
+     */
+    public void addMemberTree(Content memberSummaryTree, Content memberTree) {
+        writer.addMemberTree(memberSummaryTree, memberTree);
+    }
+
     /**
      * {@inheritDoc}
      */
@@ -156,6 +163,10 @@ public class AnnotationTypeFieldWriterImpl extends AbstractMemberWriter
      * {@inheritDoc}
      */
     public Content getAnnotationDetails(Content annotationDetailsTree) {
+        if (configuration.allowTag(HtmlTag.SECTION)) {
+            HtmlTree htmlTree = HtmlTree.SECTION(getMemberTree(annotationDetailsTree));
+            return htmlTree;
+        }
         return getMemberTree(annotationDetailsTree);
     }
 
diff --git a/langtools/src/jdk.javadoc/share/classes/com/sun/tools/doclets/formats/html/AnnotationTypeOptionalMemberWriterImpl.java b/langtools/src/jdk.javadoc/share/classes/com/sun/tools/doclets/formats/html/AnnotationTypeOptionalMemberWriterImpl.java
index 9a586a017f3..66f60f986d0 100644
--- a/langtools/src/jdk.javadoc/share/classes/com/sun/tools/doclets/formats/html/AnnotationTypeOptionalMemberWriterImpl.java
+++ b/langtools/src/jdk.javadoc/share/classes/com/sun/tools/doclets/formats/html/AnnotationTypeOptionalMemberWriterImpl.java
@@ -1,5 +1,5 @@
 /*
- * Copyright (c) 2003, 2013, Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 2003, 2015, Oracle and/or its affiliates. All rights reserved.
  * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
  *
  * This code is free software; you can redistribute it and/or modify it
@@ -69,6 +69,13 @@ public class AnnotationTypeOptionalMemberWriterImpl extends
         return memberTree;
     }
 
+    /**
+     * {@inheritDoc}
+     */
+    public void addMemberTree(Content memberSummaryTree, Content memberTree) {
+        writer.addMemberTree(memberSummaryTree, memberTree);
+    }
+
     /**
      * {@inheritDoc}
      */
diff --git a/langtools/src/jdk.javadoc/share/classes/com/sun/tools/doclets/formats/html/AnnotationTypeRequiredMemberWriterImpl.java b/langtools/src/jdk.javadoc/share/classes/com/sun/tools/doclets/formats/html/AnnotationTypeRequiredMemberWriterImpl.java
index a3392011ae2..63ed9459a17 100644
--- a/langtools/src/jdk.javadoc/share/classes/com/sun/tools/doclets/formats/html/AnnotationTypeRequiredMemberWriterImpl.java
+++ b/langtools/src/jdk.javadoc/share/classes/com/sun/tools/doclets/formats/html/AnnotationTypeRequiredMemberWriterImpl.java
@@ -1,5 +1,5 @@
 /*
- * Copyright (c) 2003, 2013, Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 2003, 2015, Oracle and/or its affiliates. All rights reserved.
  * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
  *
  * This code is free software; you can redistribute it and/or modify it
@@ -75,6 +75,13 @@ public class AnnotationTypeRequiredMemberWriterImpl extends AbstractMemberWriter
         return writer.getMemberTreeHeader();
     }
 
+    /**
+     * {@inheritDoc}
+     */
+    public void addMemberTree(Content memberSummaryTree, Content memberTree) {
+        writer.addMemberTree(memberSummaryTree, memberTree);
+    }
+
     /**
      * {@inheritDoc}
      */
@@ -158,6 +165,10 @@ public class AnnotationTypeRequiredMemberWriterImpl extends AbstractMemberWriter
      * {@inheritDoc}
      */
     public Content getAnnotationDetails(Content annotationDetailsTree) {
+        if (configuration.allowTag(HtmlTag.SECTION)) {
+            HtmlTree htmlTree = HtmlTree.SECTION(getMemberTree(annotationDetailsTree));
+            return htmlTree;
+        }
         return getMemberTree(annotationDetailsTree);
     }
 
diff --git a/langtools/src/jdk.javadoc/share/classes/com/sun/tools/doclets/formats/html/AnnotationTypeWriterImpl.java b/langtools/src/jdk.javadoc/share/classes/com/sun/tools/doclets/formats/html/AnnotationTypeWriterImpl.java
index 1bbc147e75a..447b93bdbf1 100644
--- a/langtools/src/jdk.javadoc/share/classes/com/sun/tools/doclets/formats/html/AnnotationTypeWriterImpl.java
+++ b/langtools/src/jdk.javadoc/share/classes/com/sun/tools/doclets/formats/html/AnnotationTypeWriterImpl.java
@@ -1,5 +1,5 @@
 /*
- * Copyright (c) 2003, 2014, Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 2003, 2015, Oracle and/or its affiliates. All rights reserved.
  * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
  *
  * This code is free software; you can redistribute it and/or modify it
@@ -151,9 +151,15 @@ public class AnnotationTypeWriterImpl extends SubWriterHolderWriter
         String pkgname = (annotationType.containingPackage() != null)?
             annotationType.containingPackage().name(): "";
         String clname = annotationType.name();
-        Content bodyTree = getBody(true, getWindowTitle(clname));
-        addTop(bodyTree);
-        addNavLinks(true, bodyTree);
+        HtmlTree bodyTree = getBody(true, getWindowTitle(clname));
+        HtmlTree htmlTree = (configuration.allowTag(HtmlTag.HEADER))
+                ? HtmlTree.HEADER()
+                : bodyTree;
+        addTop(htmlTree);
+        addNavLinks(true, htmlTree);
+        if (configuration.allowTag(HtmlTag.HEADER)) {
+            bodyTree.addContent(htmlTree);
+        }
         bodyTree.addContent(HtmlConstants.START_OF_CLASS_DATA);
         HtmlTree div = new HtmlTree(HtmlTag.DIV);
         div.addStyle(HtmlStyle.header);
@@ -169,7 +175,11 @@ public class AnnotationTypeWriterImpl extends SubWriterHolderWriter
                 HtmlStyle.title, headerContent);
         heading.addContent(getTypeParameterLinks(linkInfo));
         div.addContent(heading);
-        bodyTree.addContent(div);
+        if (configuration.allowTag(HtmlTag.MAIN)) {
+            mainTree.addContent(div);
+        } else {
+            bodyTree.addContent(div);
+        }
         return bodyTree;
     }
 
@@ -185,8 +195,14 @@ public class AnnotationTypeWriterImpl extends SubWriterHolderWriter
      */
     public void addFooter(Content contentTree) {
         contentTree.addContent(HtmlConstants.END_OF_CLASS_DATA);
-        addNavLinks(false, contentTree);
-        addBottom(contentTree);
+        Content htmlTree = (configuration.allowTag(HtmlTag.FOOTER))
+                ? HtmlTree.FOOTER()
+                : contentTree;
+        addNavLinks(false, htmlTree);
+        addBottom(htmlTree);
+        if (configuration.allowTag(HtmlTag.FOOTER)) {
+            contentTree.addContent(htmlTree);
+        }
     }
 
     /**
diff --git a/langtools/src/jdk.javadoc/share/classes/com/sun/tools/doclets/formats/html/ClassUseWriter.java b/langtools/src/jdk.javadoc/share/classes/com/sun/tools/doclets/formats/html/ClassUseWriter.java
index f805cc01c80..883e65795ae 100644
--- a/langtools/src/jdk.javadoc/share/classes/com/sun/tools/doclets/formats/html/ClassUseWriter.java
+++ b/langtools/src/jdk.javadoc/share/classes/com/sun/tools/doclets/formats/html/ClassUseWriter.java
@@ -1,5 +1,5 @@
 /*
- * Copyright (c) 1998, 2014, Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 1998, 2015, Oracle and/or its affiliates. All rights reserved.
  * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
  *
  * This code is free software; you can redistribute it and/or modify it
@@ -90,6 +90,11 @@ public class ClassUseWriter extends SubWriterHolderWriter {
     final String methodUseTableSummary;
     final String constructorUseTableSummary;
 
+    /**
+     * The HTML tree for main tag.
+     */
+    protected HtmlTree mainTree = HtmlTree.MAIN();
+
     /**
      * Constructor.
      *
@@ -222,7 +227,7 @@ public class ClassUseWriter extends SubWriterHolderWriter {
      * Generate the class use list.
      */
     protected void generateClassUseFile() throws IOException {
-        Content body = getClassUseHeader();
+        HtmlTree body = getClassUseHeader();
         HtmlTree div = new HtmlTree(HtmlTag.DIV);
         div.addStyle(HtmlStyle.classUseContainer);
         if (pkgSet.size() > 0) {
@@ -231,9 +236,20 @@ public class ClassUseWriter extends SubWriterHolderWriter {
             div.addContent(getResource("doclet.ClassUse_No.usage.of.0",
                     classdoc.qualifiedName()));
         }
-        body.addContent(div);
-        addNavLinks(false, body);
-        addBottom(body);
+        if (configuration.allowTag(HtmlTag.MAIN)) {
+            mainTree.addContent(div);
+            body.addContent(mainTree);
+        } else {
+            body.addContent(div);
+        }
+        HtmlTree htmlTree = (configuration.allowTag(HtmlTag.FOOTER))
+                ? HtmlTree.FOOTER()
+                : body;
+        addNavLinks(false, htmlTree);
+        addBottom(htmlTree);
+        if (configuration.allowTag(HtmlTag.FOOTER)) {
+            body.addContent(htmlTree);
+        }
         printHtmlDocument(null, true, body);
     }
 
@@ -259,11 +275,12 @@ public class ClassUseWriter extends SubWriterHolderWriter {
      * @param contentTree the content tree to which the packages list will be added
      */
     protected void addPackageList(Content contentTree) throws IOException {
-        Content table = HtmlTree.TABLE(HtmlStyle.useSummary, 0, 3, 0, useTableSummary,
-                getTableCaption(configuration.getResource(
+        Content caption = getTableCaption(configuration.getResource(
                 "doclet.ClassUse_Packages.that.use.0",
-                getLink(new LinkInfoImpl(configuration, LinkInfoImpl.Kind.CLASS_USE_HEADER, classdoc
-                )))));
+                getLink(new LinkInfoImpl(configuration, LinkInfoImpl.Kind.CLASS_USE_HEADER, classdoc))));
+        Content table = (configuration.isOutputHtml5())
+                ? HtmlTree.TABLE(HtmlStyle.useSummary, caption)
+                : HtmlTree.TABLE(HtmlStyle.useSummary, useTableSummary, caption);
         table.addContent(getSummaryTableHeader(packageTableHeader, "col"));
         Content tbody = new HtmlTree(HtmlTag.TBODY);
         Iterator it = pkgSet.iterator();
@@ -294,11 +311,13 @@ public class ClassUseWriter extends SubWriterHolderWriter {
                 pkgToPackageAnnotations.isEmpty()) {
             return;
         }
-        Content table = HtmlTree.TABLE(HtmlStyle.useSummary, 0, 3, 0, useTableSummary,
-                getTableCaption(configuration.getResource(
+        Content caption = getTableCaption(configuration.getResource(
                 "doclet.ClassUse_PackageAnnotation",
                 getLink(new LinkInfoImpl(configuration,
-                        LinkInfoImpl.Kind.CLASS_USE_HEADER, classdoc)))));
+                                LinkInfoImpl.Kind.CLASS_USE_HEADER, classdoc))));
+        Content table = (configuration.isOutputHtml5())
+                ? HtmlTree.TABLE(HtmlStyle.useSummary, caption)
+                : HtmlTree.TABLE(HtmlStyle.useSummary, useTableSummary, caption);
         table.addContent(getSummaryTableHeader(packageTableHeader, "col"));
         Content tbody = new HtmlTree(HtmlTag.TBODY);
         Iterator it = pkgToPackageAnnotations.iterator();
@@ -333,15 +352,22 @@ public class ClassUseWriter extends SubWriterHolderWriter {
         HtmlTree ul = new HtmlTree(HtmlTag.UL);
         ul.addStyle(HtmlStyle.blockList);
         for (PackageDoc pkg : pkgSet) {
-            Content li = HtmlTree.LI(HtmlStyle.blockList, getMarkerAnchor(getPackageAnchorName(pkg)));
+            Content markerAnchor = getMarkerAnchor(getPackageAnchorName(pkg));
+            HtmlTree htmlTree = (configuration.allowTag(HtmlTag.SECTION))
+                    ? HtmlTree.SECTION(markerAnchor)
+                    : HtmlTree.LI(HtmlStyle.blockList, markerAnchor);
             Content link = getResource("doclet.ClassUse_Uses.of.0.in.1",
                                        getLink(new LinkInfoImpl(configuration, LinkInfoImpl.Kind.CLASS_USE_HEADER,
                                                                 classdoc)),
                                        getPackageLink(pkg, utils.getPackageName(pkg)));
             Content heading = HtmlTree.HEADING(HtmlConstants.SUMMARY_HEADING, link);
-            li.addContent(heading);
-            addClassUse(pkg, li);
-            ul.addContent(li);
+            htmlTree.addContent(heading);
+            addClassUse(pkg, htmlTree);
+            if (configuration.allowTag(HtmlTag.SECTION)) {
+                ul.addContent(HtmlTree.LI(HtmlStyle.blockList, htmlTree));
+            } else {
+                ul.addContent(htmlTree);
+            }
         }
         Content li = HtmlTree.LI(HtmlStyle.blockList, ul);
         contentTree.addContent(li);
@@ -443,15 +469,21 @@ public class ClassUseWriter extends SubWriterHolderWriter {
      *
      * @return a content tree representing the class use header
      */
-    protected Content getClassUseHeader() {
+    protected HtmlTree getClassUseHeader() {
         String cltype = configuration.getText(classdoc.isInterface()?
             "doclet.Interface":"doclet.Class");
         String clname = classdoc.qualifiedName();
         String title = configuration.getText("doclet.Window_ClassUse_Header",
                 cltype, clname);
-        Content bodyTree = getBody(true, getWindowTitle(title));
-        addTop(bodyTree);
-        addNavLinks(true, bodyTree);
+        HtmlTree bodyTree = getBody(true, getWindowTitle(title));
+        HtmlTree htmlTree = (configuration.allowTag(HtmlTag.HEADER))
+                ? HtmlTree.HEADER()
+                : bodyTree;
+        addTop(htmlTree);
+        addNavLinks(true, htmlTree);
+        if (configuration.allowTag(HtmlTag.HEADER)) {
+            bodyTree.addContent(htmlTree);
+        }
         ContentBuilder headContent = new ContentBuilder();
         headContent.addContent(getResource("doclet.ClassUse_Title", cltype));
         headContent.addContent(new HtmlTree(HtmlTag.BR));
@@ -459,7 +491,11 @@ public class ClassUseWriter extends SubWriterHolderWriter {
         Content heading = HtmlTree.HEADING(HtmlConstants.CLASS_PAGE_HEADING,
                 true, HtmlStyle.title, headContent);
         Content div = HtmlTree.DIV(HtmlStyle.header, heading);
-        bodyTree.addContent(div);
+        if (configuration.allowTag(HtmlTag.MAIN)) {
+            mainTree.addContent(div);
+        } else {
+            bodyTree.addContent(div);
+        }
         return bodyTree;
     }
 
diff --git a/langtools/src/jdk.javadoc/share/classes/com/sun/tools/doclets/formats/html/ClassWriterImpl.java b/langtools/src/jdk.javadoc/share/classes/com/sun/tools/doclets/formats/html/ClassWriterImpl.java
index c364bd16e34..d9dafe97c23 100644
--- a/langtools/src/jdk.javadoc/share/classes/com/sun/tools/doclets/formats/html/ClassWriterImpl.java
+++ b/langtools/src/jdk.javadoc/share/classes/com/sun/tools/doclets/formats/html/ClassWriterImpl.java
@@ -1,5 +1,5 @@
 /*
- * Copyright (c) 1997, 2014, Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 1997, 2015, Oracle and/or its affiliates. All rights reserved.
  * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
  *
  * This code is free software; you can redistribute it and/or modify it
@@ -35,6 +35,7 @@ import com.sun.tools.doclets.internal.toolkit.*;
 import com.sun.tools.doclets.internal.toolkit.builders.*;
 import com.sun.tools.doclets.internal.toolkit.taglets.*;
 import com.sun.tools.doclets.internal.toolkit.util.*;
+
 import java.io.IOException;
 
 /**
@@ -160,9 +161,15 @@ public class ClassWriterImpl extends SubWriterHolderWriter
         String pkgname = (classDoc.containingPackage() != null)?
             classDoc.containingPackage().name(): "";
         String clname = classDoc.name();
-        Content bodyTree = getBody(true, getWindowTitle(clname));
-        addTop(bodyTree);
-        addNavLinks(true, bodyTree);
+        HtmlTree bodyTree = getBody(true, getWindowTitle(clname));
+        HtmlTree htmlTree = (configuration.allowTag(HtmlTag.HEADER))
+                ? HtmlTree.HEADER()
+                : bodyTree;
+        addTop(htmlTree);
+        addNavLinks(true, htmlTree);
+        if (configuration.allowTag(HtmlTag.HEADER)) {
+            bodyTree.addContent(htmlTree);
+        }
         bodyTree.addContent(HtmlConstants.START_OF_CLASS_DATA);
         HtmlTree div = new HtmlTree(HtmlTag.DIV);
         div.addStyle(HtmlStyle.header);
@@ -194,7 +201,11 @@ public class ClassWriterImpl extends SubWriterHolderWriter
                 HtmlStyle.title, headerContent);
         heading.addContent(getTypeParameterLinks(linkInfo));
         div.addContent(heading);
-        bodyTree.addContent(div);
+        if (configuration.allowTag(HtmlTag.MAIN)) {
+            mainTree.addContent(div);
+        } else {
+            bodyTree.addContent(div);
+        }
         return bodyTree;
     }
 
@@ -210,8 +221,14 @@ public class ClassWriterImpl extends SubWriterHolderWriter
      */
     public void addFooter(Content contentTree) {
         contentTree.addContent(HtmlConstants.END_OF_CLASS_DATA);
-        addNavLinks(false, contentTree);
-        addBottom(contentTree);
+        Content htmlTree = (configuration.allowTag(HtmlTag.FOOTER))
+                ? HtmlTree.FOOTER()
+                : contentTree;
+        addNavLinks(false, htmlTree);
+        addBottom(htmlTree);
+        if (configuration.allowTag(HtmlTag.FOOTER)) {
+            contentTree.addContent(htmlTree);
+        }
     }
 
     /**
diff --git a/langtools/src/jdk.javadoc/share/classes/com/sun/tools/doclets/formats/html/ConfigurationImpl.java b/langtools/src/jdk.javadoc/share/classes/com/sun/tools/doclets/formats/html/ConfigurationImpl.java
index 902a2709ac1..7c7882615b2 100644
--- a/langtools/src/jdk.javadoc/share/classes/com/sun/tools/doclets/formats/html/ConfigurationImpl.java
+++ b/langtools/src/jdk.javadoc/share/classes/com/sun/tools/doclets/formats/html/ConfigurationImpl.java
@@ -1,5 +1,5 @@
 /*
- * Copyright (c) 1998, 2014, Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 1998, 2015, Oracle and/or its affiliates. All rights reserved.
  * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
  *
  * This code is free software; you can redistribute it and/or modify it
@@ -31,7 +31,7 @@ import java.util.*;
 import javax.tools.JavaFileManager;
 
 import com.sun.javadoc.*;
-import com.sun.tools.doclets.formats.html.markup.ContentBuilder;
+import com.sun.tools.doclets.formats.html.markup.*;
 import com.sun.tools.doclets.internal.toolkit.*;
 import com.sun.tools.doclets.internal.toolkit.util.*;
 import com.sun.tools.doclint.DocLint;
@@ -175,6 +175,11 @@ public class ConfigurationImpl extends Configuration {
      */
     public boolean createoverview = false;
 
+    /**
+     * This is the HTML version of the generated pages. HTML 4.01 is the default output version.
+     */
+    public HtmlVersion htmlVersion = HtmlVersion.HTML4;
+
     /**
      * Collected set of doclint options
      */
@@ -279,6 +284,10 @@ public class ConfigurationImpl extends Configuration {
                 nooverview = true;
             } else if (opt.equals("-overview")) {
                 overview = true;
+            } else if (opt.equals("-html4")) {
+                htmlVersion = HtmlVersion.HTML4;
+            } else if (opt.equals("-html5")) {
+                htmlVersion = HtmlVersion.HTML5;
             } else if (opt.equals("-xdoclint")) {
                 doclintOpts.add(null);
             } else if (opt.startsWith("-xdoclint:")) {
@@ -300,7 +309,8 @@ public class ConfigurationImpl extends Configuration {
         setTopFile(root);
 
         if (root instanceof RootDocImpl) {
-            ((RootDocImpl) root).initDocLint(doclintOpts, tagletManager.getCustomTagNames());
+            ((RootDocImpl) root).initDocLint(doclintOpts, tagletManager.getCustomTagNames(),
+                    StringUtils.toLowerCase(htmlVersion.name()));
         }
     }
 
@@ -336,6 +346,8 @@ public class ConfigurationImpl extends Configuration {
             option.equals("-use") ||
             option.equals("-nonavbar") ||
             option.equals("-nooverview") ||
+            option.equals("-html4") ||
+            option.equals("-html5") ||
             option.equals("-xdoclint") ||
             option.startsWith("-xdoclint:")) {
             return 1;
@@ -470,6 +482,20 @@ public class ConfigurationImpl extends Configuration {
         return true;
     }
 
+    /**
+     * Return true if the generated output is HTML5.
+     */
+    public boolean isOutputHtml5() {
+        return htmlVersion == HtmlVersion.HTML5;
+    }
+
+    /**
+     * Return true if the tag is allowed for this specific version of HTML.
+     */
+    public boolean allowTag(HtmlTag htmlTag) {
+        return htmlTag.allowTag(this.htmlVersion);
+    }
+
     /**
      * {@inheritDoc}
      */
diff --git a/langtools/src/jdk.javadoc/share/classes/com/sun/tools/doclets/formats/html/ConstantsSummaryWriterImpl.java b/langtools/src/jdk.javadoc/share/classes/com/sun/tools/doclets/formats/html/ConstantsSummaryWriterImpl.java
index 21f0c215038..10abd4b6cfd 100644
--- a/langtools/src/jdk.javadoc/share/classes/com/sun/tools/doclets/formats/html/ConstantsSummaryWriterImpl.java
+++ b/langtools/src/jdk.javadoc/share/classes/com/sun/tools/doclets/formats/html/ConstantsSummaryWriterImpl.java
@@ -1,5 +1,5 @@
 /*
- * Copyright (c) 2001, 2013, Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 2001, 2015, Oracle and/or its affiliates. All rights reserved.
  * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
  *
  * This code is free software; you can redistribute it and/or modify it
@@ -62,6 +62,16 @@ public class ConstantsSummaryWriterImpl extends HtmlDocletWriter
 
     private final String[] constantsTableHeader;
 
+    /**
+     * The HTML tree for main tag.
+     */
+    private HtmlTree mainTree = HtmlTree.MAIN();
+
+    /**
+     * The HTML tree for constant values summary.
+     */
+    private HtmlTree summaryTree;
+
     /**
      * Construct a ConstantsSummaryWriter.
      * @param configuration the configuration used in this run
@@ -85,9 +95,15 @@ public class ConstantsSummaryWriterImpl extends HtmlDocletWriter
      */
     public Content getHeader() {
         String label = configuration.getText("doclet.Constants_Summary");
-        Content bodyTree = getBody(true, getWindowTitle(label));
-        addTop(bodyTree);
-        addNavLinks(true, bodyTree);
+        HtmlTree bodyTree = getBody(true, getWindowTitle(label));
+        HtmlTree htmlTree = (configuration.allowTag(HtmlTag.HEADER))
+                ? HtmlTree.HEADER()
+                : bodyTree;
+        addTop(htmlTree);
+        addNavLinks(true, htmlTree);
+        if (configuration.allowTag(HtmlTag.HEADER)) {
+            bodyTree.addContent(htmlTree);
+        }
         return bodyTree;
     }
 
@@ -123,7 +139,7 @@ public class ConstantsSummaryWriterImpl extends HtmlDocletWriter
     /**
      * {@inheritDoc}
      */
-    public Content getContentsList(Content contentListTree) {
+    public void addContentsList(Content contentTree, Content contentListTree) {
         Content titleContent = getResource(
                 "doclet.Constants_Summary");
         Content pHeading = HtmlTree.HEADING(HtmlConstants.TITLE_HEADING, true,
@@ -131,10 +147,18 @@ public class ConstantsSummaryWriterImpl extends HtmlDocletWriter
         Content div = HtmlTree.DIV(HtmlStyle.header, pHeading);
         Content headingContent = getResource(
                 "doclet.Contents");
-        div.addContent(HtmlTree.HEADING(HtmlConstants.CONTENT_HEADING, true,
-                headingContent));
-        div.addContent(contentListTree);
-        return div;
+        Content heading = HtmlTree.HEADING(HtmlConstants.CONTENT_HEADING, true,
+                headingContent);
+        if (configuration.allowTag(HtmlTag.SECTION)) {
+            HtmlTree section = HtmlTree.SECTION(heading);
+            section.addContent(contentListTree);
+            div.addContent(section);
+            mainTree.addContent(div);
+        } else {
+            div.addContent(heading);
+            div.addContent(contentListTree);
+            contentTree.addContent(div);
+        }
     }
 
     /**
@@ -149,9 +173,11 @@ public class ConstantsSummaryWriterImpl extends HtmlDocletWriter
     /**
      * {@inheritDoc}
      */
-    public void addPackageName(PackageDoc pkg, String parsedPackageName,
-            Content summariesTree) {
+    public void addPackageName(String parsedPackageName, Content summariesTree, boolean first) {
         Content pkgNameContent;
+        if (!first && configuration.allowTag(HtmlTag.SECTION)) {
+            summariesTree.addContent(summaryTree);
+        }
         if (parsedPackageName.length() == 0) {
             summariesTree.addContent(getMarkerAnchor(
                     SectionName.UNNAMED_PACKAGE_ANCHOR));
@@ -165,7 +191,11 @@ public class ConstantsSummaryWriterImpl extends HtmlDocletWriter
         Content heading = HtmlTree.HEADING(HtmlConstants.PACKAGE_HEADING, true,
                 pkgNameContent);
         heading.addContent(headingContent);
-        summariesTree.addContent(heading);
+        if (configuration.allowTag(HtmlTag.SECTION)) {
+            summaryTree = HtmlTree.SECTION(heading);
+        } else {
+            summariesTree.addContent(heading);
+        }
     }
 
     /**
@@ -177,6 +207,17 @@ public class ConstantsSummaryWriterImpl extends HtmlDocletWriter
         return ul;
     }
 
+    /**
+     * {@inheritDoc}
+     */
+    public void addClassConstant(Content summariesTree, Content classConstantTree) {
+        if (configuration.allowTag(HtmlTag.SECTION)) {
+            summaryTree.addContent(classConstantTree);
+        } else {
+            summariesTree.addContent(classConstantTree);
+        }
+    }
+
     /**
      * Get the table caption and header for the constant summary table
      *
@@ -208,8 +249,10 @@ public class ConstantsSummaryWriterImpl extends HtmlDocletWriter
      * @return the table caption and header
      */
     protected Content getClassName(Content classStr) {
-        Content table = HtmlTree.TABLE(HtmlStyle.constantsSummary, 0, 3, 0, constantsTableSummary,
-                getTableCaption(classStr));
+        Content caption = getTableCaption(classStr);
+        Content table = (configuration.isOutputHtml5())
+                ? HtmlTree.TABLE(HtmlStyle.constantsSummary, caption)
+                : HtmlTree.TABLE(HtmlStyle.constantsSummary, constantsTableSummary, caption);
         table.addContent(getSummaryTableHeader(constantsTableHeader, "col"));
         return table;
     }
@@ -297,12 +340,33 @@ public class ConstantsSummaryWriterImpl extends HtmlDocletWriter
         return HtmlTree.TD(HtmlStyle.colLast, code);
     }
 
+    /**
+     * {@inheritDoc}
+     */
+    public void addConstantSummaries(Content contentTree, Content summariesTree) {
+        if (configuration.allowTag(HtmlTag.SECTION) && summaryTree != null) {
+            summariesTree.addContent(summaryTree);
+        }
+        if (configuration.allowTag(HtmlTag.MAIN)) {
+            mainTree.addContent(summariesTree);
+            contentTree.addContent(mainTree);
+        } else {
+            contentTree.addContent(summariesTree);
+        }
+    }
+
     /**
      * {@inheritDoc}
      */
     public void addFooter(Content contentTree) {
-        addNavLinks(false, contentTree);
-        addBottom(contentTree);
+        Content htmlTree = (configuration.allowTag(HtmlTag.FOOTER))
+                ? HtmlTree.FOOTER()
+                : contentTree;
+        addNavLinks(false, htmlTree);
+        addBottom(htmlTree);
+        if (configuration.allowTag(HtmlTag.FOOTER)) {
+            contentTree.addContent(htmlTree);
+        }
     }
 
     /**
diff --git a/langtools/src/jdk.javadoc/share/classes/com/sun/tools/doclets/formats/html/ConstructorWriterImpl.java b/langtools/src/jdk.javadoc/share/classes/com/sun/tools/doclets/formats/html/ConstructorWriterImpl.java
index 989aaf95e44..d8d07632cd6 100644
--- a/langtools/src/jdk.javadoc/share/classes/com/sun/tools/doclets/formats/html/ConstructorWriterImpl.java
+++ b/langtools/src/jdk.javadoc/share/classes/com/sun/tools/doclets/formats/html/ConstructorWriterImpl.java
@@ -1,5 +1,5 @@
 /*
- * Copyright (c) 1997, 2013, Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 1997, 2015, Oracle and/or its affiliates. All rights reserved.
  * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
  *
  * This code is free software; you can redistribute it and/or modify it
@@ -89,6 +89,13 @@ public class ConstructorWriterImpl extends AbstractExecutableMemberWriter
         return memberTree;
     }
 
+    /**
+     * {@inheritDoc}
+     */
+    public void addMemberTree(Content memberSummaryTree, Content memberTree) {
+        writer.addMemberTree(memberSummaryTree, memberTree);
+    }
+
     /**
      * {@inheritDoc}
      */
@@ -177,6 +184,10 @@ public class ConstructorWriterImpl extends AbstractExecutableMemberWriter
      * {@inheritDoc}
      */
     public Content getConstructorDetails(Content constructorDetailsTree) {
+        if (configuration.allowTag(HtmlTag.SECTION)) {
+            HtmlTree htmlTree = HtmlTree.SECTION(getMemberTree(constructorDetailsTree));
+            return htmlTree;
+        }
         return getMemberTree(constructorDetailsTree);
     }
 
diff --git a/langtools/src/jdk.javadoc/share/classes/com/sun/tools/doclets/formats/html/DeprecatedListWriter.java b/langtools/src/jdk.javadoc/share/classes/com/sun/tools/doclets/formats/html/DeprecatedListWriter.java
index 63c81438956..85c6dc8ec59 100644
--- a/langtools/src/jdk.javadoc/share/classes/com/sun/tools/doclets/formats/html/DeprecatedListWriter.java
+++ b/langtools/src/jdk.javadoc/share/classes/com/sun/tools/doclets/formats/html/DeprecatedListWriter.java
@@ -1,5 +1,5 @@
 /*
- * Copyright (c) 1997, 2013, Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 1997, 2015, Oracle and/or its affiliates. All rights reserved.
  * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
  *
  * This code is free software; you can redistribute it and/or modify it
@@ -138,8 +138,11 @@ public class DeprecatedListWriter extends SubWriterHolderWriter {
      */
     protected void generateDeprecatedListFile(DeprecatedAPIListBuilder deprapi)
             throws IOException {
-        Content body = getHeader();
-        body.addContent(getContentsList(deprapi));
+        HtmlTree body = getHeader();
+        HtmlTree htmlTree = (configuration.allowTag(HtmlTag.MAIN))
+                ? HtmlTree.MAIN()
+                : body;
+        htmlTree.addContent(getContentsList(deprapi));
         String memberTableSummary;
         String[] memberTableHeader = new String[1];
         HtmlTree div = new HtmlTree(HtmlTag.DIV);
@@ -164,9 +167,20 @@ public class DeprecatedListWriter extends SubWriterHolderWriter {
                             HEADING_KEYS[i], memberTableSummary, memberTableHeader, div);
             }
         }
-        body.addContent(div);
-        addNavLinks(false, body);
-        addBottom(body);
+        if (configuration.allowTag(HtmlTag.MAIN)) {
+            htmlTree.addContent(div);
+            body.addContent(htmlTree);
+        } else {
+            body.addContent(div);
+        }
+        htmlTree = (configuration.allowTag(HtmlTag.FOOTER))
+                ? HtmlTree.FOOTER()
+                : body;
+        addNavLinks(false, htmlTree);
+        addBottom(htmlTree);
+        if (configuration.allowTag(HtmlTag.FOOTER)) {
+            body.addContent(htmlTree);
+        }
         printHtmlDocument(null, true, body);
     }
 
@@ -226,11 +240,17 @@ public class DeprecatedListWriter extends SubWriterHolderWriter {
      *
      * @return a content tree for the header
      */
-    public Content getHeader() {
+    public HtmlTree getHeader() {
         String title = configuration.getText("doclet.Window_Deprecated_List");
-        Content bodyTree = getBody(true, getWindowTitle(title));
-        addTop(bodyTree);
-        addNavLinks(true, bodyTree);
+        HtmlTree bodyTree = getBody(true, getWindowTitle(title));
+        HtmlTree htmlTree = (configuration.allowTag(HtmlTag.HEADER))
+                ? HtmlTree.HEADER()
+                : bodyTree;
+        addTop(htmlTree);
+        addNavLinks(true, htmlTree);
+        if (configuration.allowTag(HtmlTag.HEADER)) {
+            bodyTree.addContent(htmlTree);
+        }
         return bodyTree;
     }
 
diff --git a/langtools/src/jdk.javadoc/share/classes/com/sun/tools/doclets/formats/html/EnumConstantWriterImpl.java b/langtools/src/jdk.javadoc/share/classes/com/sun/tools/doclets/formats/html/EnumConstantWriterImpl.java
index 34a3a5027aa..82ac9748ba1 100644
--- a/langtools/src/jdk.javadoc/share/classes/com/sun/tools/doclets/formats/html/EnumConstantWriterImpl.java
+++ b/langtools/src/jdk.javadoc/share/classes/com/sun/tools/doclets/formats/html/EnumConstantWriterImpl.java
@@ -1,5 +1,5 @@
 /*
- * Copyright (c) 2003, 2013, Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 2003, 2015, Oracle and/or its affiliates. All rights reserved.
  * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
  *
  * This code is free software; you can redistribute it and/or modify it
@@ -66,6 +66,13 @@ public class EnumConstantWriterImpl extends AbstractMemberWriter
         return memberTree;
     }
 
+    /**
+     * {@inheritDoc}
+     */
+    public void addMemberTree(Content memberSummaryTree, Content memberTree) {
+        writer.addMemberTree(memberSummaryTree, memberTree);
+    }
+
     /**
      * {@inheritDoc}
      */
@@ -140,6 +147,10 @@ public class EnumConstantWriterImpl extends AbstractMemberWriter
      * {@inheritDoc}
      */
     public Content getEnumConstantsDetails(Content enumConstantsDetailsTree) {
+        if (configuration.allowTag(HtmlTag.SECTION)) {
+            HtmlTree htmlTree = HtmlTree.SECTION(getMemberTree(enumConstantsDetailsTree));
+            return htmlTree;
+        }
         return getMemberTree(enumConstantsDetailsTree);
     }
 
diff --git a/langtools/src/jdk.javadoc/share/classes/com/sun/tools/doclets/formats/html/FieldWriterImpl.java b/langtools/src/jdk.javadoc/share/classes/com/sun/tools/doclets/formats/html/FieldWriterImpl.java
index 9ae2501efb9..7d1455bfad0 100644
--- a/langtools/src/jdk.javadoc/share/classes/com/sun/tools/doclets/formats/html/FieldWriterImpl.java
+++ b/langtools/src/jdk.javadoc/share/classes/com/sun/tools/doclets/formats/html/FieldWriterImpl.java
@@ -1,5 +1,5 @@
 /*
- * Copyright (c) 1997, 2014, Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 1997, 2015, Oracle and/or its affiliates. All rights reserved.
  * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
  *
  * This code is free software; you can redistribute it and/or modify it
@@ -67,6 +67,13 @@ public class FieldWriterImpl extends AbstractMemberWriter
         return memberTree;
     }
 
+    /**
+     * {@inheritDoc}
+     */
+    public void addMemberTree(Content memberSummaryTree, Content memberTree) {
+        writer.addMemberTree(memberSummaryTree, memberTree);
+    }
+
     /**
      * {@inheritDoc}
      */
@@ -161,6 +168,10 @@ public class FieldWriterImpl extends AbstractMemberWriter
      * {@inheritDoc}
      */
     public Content getFieldDetails(Content fieldDetailsTree) {
+        if (configuration.allowTag(HtmlTag.SECTION)) {
+            HtmlTree htmlTree = HtmlTree.SECTION(getMemberTree(fieldDetailsTree));
+            return htmlTree;
+        }
         return getMemberTree(fieldDetailsTree);
     }
 
diff --git a/langtools/src/jdk.javadoc/share/classes/com/sun/tools/doclets/formats/html/FrameOutputWriter.java b/langtools/src/jdk.javadoc/share/classes/com/sun/tools/doclets/formats/html/FrameOutputWriter.java
index 706f0d7b6c7..037d7fa77eb 100644
--- a/langtools/src/jdk.javadoc/share/classes/com/sun/tools/doclets/formats/html/FrameOutputWriter.java
+++ b/langtools/src/jdk.javadoc/share/classes/com/sun/tools/doclets/formats/html/FrameOutputWriter.java
@@ -96,7 +96,12 @@ public class FrameOutputWriter extends HtmlDocletWriter {
     protected void generateFrameFile() throws IOException {
         Content frame = getFrameDetails();
         HtmlTree body = new HtmlTree(HtmlTag.BODY);
-        body.addContent(frame);
+        if (configuration.allowTag(HtmlTag.MAIN)) {
+            HtmlTree main = HtmlTree.MAIN(frame);
+            body.addContent(main);
+        } else {
+            body.addContent(frame);
+        }
         if (configuration.windowtitle.length() > 0) {
             printFramesDocument(configuration.windowtitle, configuration,
                     body);
diff --git a/langtools/src/jdk.javadoc/share/classes/com/sun/tools/doclets/formats/html/HelpWriter.java b/langtools/src/jdk.javadoc/share/classes/com/sun/tools/doclets/formats/html/HelpWriter.java
index e1111faf9e9..d5b7c0f1b13 100644
--- a/langtools/src/jdk.javadoc/share/classes/com/sun/tools/doclets/formats/html/HelpWriter.java
+++ b/langtools/src/jdk.javadoc/share/classes/com/sun/tools/doclets/formats/html/HelpWriter.java
@@ -1,5 +1,5 @@
 /*
- * Copyright (c) 1998, 2013, Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 1998, 2015, Oracle and/or its affiliates. All rights reserved.
  * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
  *
  * This code is free software; you can redistribute it and/or modify it
@@ -44,6 +44,8 @@ import com.sun.tools.doclets.internal.toolkit.util.*;
  */
 public class HelpWriter extends HtmlDocletWriter {
 
+    HtmlTree mainTree = HtmlTree.MAIN();
+
     /**
      * Constructor to construct HelpWriter object.
      * @param filename File to be generated.
@@ -81,12 +83,24 @@ public class HelpWriter extends HtmlDocletWriter {
      */
     protected void generateHelpFile() throws IOException {
         String title = configuration.getText("doclet.Window_Help_title");
-        Content body = getBody(true, getWindowTitle(title));
-        addTop(body);
-        addNavLinks(true, body);
+        HtmlTree body = getBody(true, getWindowTitle(title));
+        HtmlTree htmlTree = (configuration.allowTag(HtmlTag.HEADER))
+                ? HtmlTree.HEADER()
+                : body;
+        addTop(htmlTree);
+        addNavLinks(true, htmlTree);
+        if (configuration.allowTag(HtmlTag.HEADER)) {
+            body.addContent(htmlTree);
+        }
         addHelpFileContents(body);
-        addNavLinks(false, body);
-        addBottom(body);
+        if (configuration.allowTag(HtmlTag.FOOTER)) {
+            htmlTree = HtmlTree.FOOTER();
+        }
+        addNavLinks(false, htmlTree);
+        addBottom(htmlTree);
+        if (configuration.allowTag(HtmlTag.FOOTER)) {
+            body.addContent(htmlTree);
+        }
         printHtmlDocument(null, true, body);
     }
 
@@ -105,26 +119,39 @@ public class HelpWriter extends HtmlDocletWriter {
         Content line2 = HtmlTree.DIV(HtmlStyle.subTitle,
                 getResource("doclet.Help_line_2"));
         div.addContent(line2);
-        contentTree.addContent(div);
+        if (configuration.allowTag(HtmlTag.MAIN)) {
+            mainTree.addContent(div);
+        } else {
+            contentTree.addContent(div);
+        }
+        HtmlTree htmlTree;
         HtmlTree ul = new HtmlTree(HtmlTag.UL);
         ul.addStyle(HtmlStyle.blockList);
         if (configuration.createoverview) {
             Content overviewHeading = HtmlTree.HEADING(HtmlConstants.CONTENT_HEADING,
                 getResource("doclet.Overview"));
-            Content liOverview = HtmlTree.LI(HtmlStyle.blockList, overviewHeading);
+            htmlTree = (configuration.allowTag(HtmlTag.SECTION))
+                    ? HtmlTree.SECTION(overviewHeading)
+                    : HtmlTree.LI(HtmlStyle.blockList, overviewHeading);
             Content line3 = getResource("doclet.Help_line_3",
                     getHyperLink(DocPaths.OVERVIEW_SUMMARY,
                     configuration.getText("doclet.Overview")));
             Content overviewPara = HtmlTree.P(line3);
-            liOverview.addContent(overviewPara);
-            ul.addContent(liOverview);
+            htmlTree.addContent(overviewPara);
+            if (configuration.allowTag(HtmlTag.SECTION)) {
+                ul.addContent(HtmlTree.LI(HtmlStyle.blockList, htmlTree));
+            } else {
+                ul.addContent(htmlTree);
+            }
         }
         Content packageHead = HtmlTree.HEADING(HtmlConstants.CONTENT_HEADING,
                 getResource("doclet.Package"));
-        Content liPackage = HtmlTree.LI(HtmlStyle.blockList, packageHead);
+        htmlTree = (configuration.allowTag(HtmlTag.SECTION))
+                ? HtmlTree.SECTION(packageHead)
+                : HtmlTree.LI(HtmlStyle.blockList, packageHead);
         Content line4 = getResource("doclet.Help_line_4");
         Content packagePara = HtmlTree.P(line4);
-        liPackage.addContent(packagePara);
+        htmlTree.addContent(packagePara);
         HtmlTree ulPackage = new HtmlTree(HtmlTag.UL);
         ulPackage.addContent(HtmlTree.LI(
                 getResource("doclet.Interfaces_Italic")));
@@ -138,14 +165,20 @@ public class HelpWriter extends HtmlDocletWriter {
                 getResource("doclet.Errors")));
         ulPackage.addContent(HtmlTree.LI(
                 getResource("doclet.AnnotationTypes")));
-        liPackage.addContent(ulPackage);
-        ul.addContent(liPackage);
+        htmlTree.addContent(ulPackage);
+        if (configuration.allowTag(HtmlTag.SECTION)) {
+            ul.addContent(HtmlTree.LI(HtmlStyle.blockList, htmlTree));
+        } else {
+            ul.addContent(htmlTree);
+        }
         Content classHead = HtmlTree.HEADING(HtmlConstants.CONTENT_HEADING,
                 getResource("doclet.Help_line_5"));
-        Content liClass = HtmlTree.LI(HtmlStyle.blockList, classHead);
+        htmlTree = (configuration.allowTag(HtmlTag.SECTION))
+                ? HtmlTree.SECTION(classHead)
+                : HtmlTree.LI(HtmlStyle.blockList, classHead);
         Content line6 = getResource("doclet.Help_line_6");
         Content classPara = HtmlTree.P(line6);
-        liClass.addContent(classPara);
+        htmlTree.addContent(classPara);
         HtmlTree ul1 = new HtmlTree(HtmlTag.UL);
         ul1.addContent(HtmlTree.LI(
                 getResource("doclet.Help_line_7")));
@@ -159,7 +192,7 @@ public class HelpWriter extends HtmlDocletWriter {
                 getResource("doclet.Help_line_11")));
         ul1.addContent(HtmlTree.LI(
                 getResource("doclet.Help_line_12")));
-        liClass.addContent(ul1);
+        htmlTree.addContent(ul1);
         HtmlTree ul2 = new HtmlTree(HtmlTag.UL);
         ul2.addContent(HtmlTree.LI(
                 getResource("doclet.Nested_Class_Summary")));
@@ -169,7 +202,7 @@ public class HelpWriter extends HtmlDocletWriter {
                 getResource("doclet.Constructor_Summary")));
         ul2.addContent(HtmlTree.LI(
                 getResource("doclet.Method_Summary")));
-        liClass.addContent(ul2);
+        htmlTree.addContent(ul2);
         HtmlTree ul3 = new HtmlTree(HtmlTag.UL);
         ul3.addContent(HtmlTree.LI(
                 getResource("doclet.Field_Detail")));
@@ -177,18 +210,24 @@ public class HelpWriter extends HtmlDocletWriter {
                 getResource("doclet.Constructor_Detail")));
         ul3.addContent(HtmlTree.LI(
                 getResource("doclet.Method_Detail")));
-        liClass.addContent(ul3);
+        htmlTree.addContent(ul3);
         Content line13 = getResource("doclet.Help_line_13");
         Content para = HtmlTree.P(line13);
-        liClass.addContent(para);
-        ul.addContent(liClass);
+        htmlTree.addContent(para);
+        if (configuration.allowTag(HtmlTag.SECTION)) {
+            ul.addContent(HtmlTree.LI(HtmlStyle.blockList, htmlTree));
+        } else {
+            ul.addContent(htmlTree);
+        }
         //Annotation Types
         Content aHead = HtmlTree.HEADING(HtmlConstants.CONTENT_HEADING,
                 getResource("doclet.AnnotationType"));
-        Content liAnnotation = HtmlTree.LI(HtmlStyle.blockList, aHead);
+        htmlTree = (configuration.allowTag(HtmlTag.SECTION))
+                ? HtmlTree.SECTION(aHead)
+                : HtmlTree.LI(HtmlStyle.blockList, aHead);
         Content aline1 = getResource("doclet.Help_annotation_type_line_1");
         Content aPara = HtmlTree.P(aline1);
-        liAnnotation.addContent(aPara);
+        htmlTree.addContent(aPara);
         HtmlTree aul = new HtmlTree(HtmlTag.UL);
         aul.addContent(HtmlTree.LI(
                 getResource("doclet.Help_annotation_type_line_2")));
@@ -200,15 +239,21 @@ public class HelpWriter extends HtmlDocletWriter {
                 getResource("doclet.Annotation_Type_Optional_Member_Summary")));
         aul.addContent(HtmlTree.LI(
                 getResource("doclet.Annotation_Type_Member_Detail")));
-        liAnnotation.addContent(aul);
-        ul.addContent(liAnnotation);
+        htmlTree.addContent(aul);
+        if (configuration.allowTag(HtmlTag.SECTION)) {
+            ul.addContent(HtmlTree.LI(HtmlStyle.blockList, htmlTree));
+        } else {
+            ul.addContent(htmlTree);
+        }
         //Enums
         Content enumHead = HtmlTree.HEADING(HtmlConstants.CONTENT_HEADING,
                 getResource("doclet.Enum"));
-        Content liEnum = HtmlTree.LI(HtmlStyle.blockList, enumHead);
+        htmlTree = (configuration.allowTag(HtmlTag.SECTION))
+                ? HtmlTree.SECTION(enumHead)
+                : HtmlTree.LI(HtmlStyle.blockList, enumHead);
         Content eline1 = getResource("doclet.Help_enum_line_1");
         Content enumPara = HtmlTree.P(eline1);
-        liEnum.addContent(enumPara);
+        htmlTree.addContent(enumPara);
         HtmlTree eul = new HtmlTree(HtmlTag.UL);
         eul.addContent(HtmlTree.LI(
                 getResource("doclet.Help_enum_line_2")));
@@ -218,46 +263,68 @@ public class HelpWriter extends HtmlDocletWriter {
                 getResource("doclet.Enum_Constant_Summary")));
         eul.addContent(HtmlTree.LI(
                 getResource("doclet.Enum_Constant_Detail")));
-        liEnum.addContent(eul);
-        ul.addContent(liEnum);
+        htmlTree.addContent(eul);
+        if (configuration.allowTag(HtmlTag.SECTION)) {
+            ul.addContent(HtmlTree.LI(HtmlStyle.blockList, htmlTree));
+        } else {
+            ul.addContent(htmlTree);
+        }
         if (configuration.classuse) {
             Content useHead = HtmlTree.HEADING(HtmlConstants.CONTENT_HEADING,
                     getResource("doclet.Help_line_14"));
-            Content liUse = HtmlTree.LI(HtmlStyle.blockList, useHead);
+            htmlTree = (configuration.allowTag(HtmlTag.SECTION))
+                    ? HtmlTree.SECTION(useHead)
+                    : HtmlTree.LI(HtmlStyle.blockList, useHead);
             Content line15 = getResource("doclet.Help_line_15");
             Content usePara = HtmlTree.P(line15);
-            liUse.addContent(usePara);
-            ul.addContent(liUse);
+            htmlTree.addContent(usePara);
+            if (configuration.allowTag(HtmlTag.SECTION)) {
+                ul.addContent(HtmlTree.LI(HtmlStyle.blockList, htmlTree));
+            } else {
+                ul.addContent(htmlTree);
+            }
         }
         if (configuration.createtree) {
             Content treeHead = HtmlTree.HEADING(HtmlConstants.CONTENT_HEADING,
                     getResource("doclet.Help_line_16"));
-            Content liTree = HtmlTree.LI(HtmlStyle.blockList, treeHead);
+            htmlTree = (configuration.allowTag(HtmlTag.SECTION))
+                    ? HtmlTree.SECTION(treeHead)
+                    : HtmlTree.LI(HtmlStyle.blockList, treeHead);
             Content line17 = getResource("doclet.Help_line_17_with_tree_link",
                     getHyperLink(DocPaths.OVERVIEW_TREE,
                     configuration.getText("doclet.Class_Hierarchy")),
                     HtmlTree.CODE(new StringContent("java.lang.Object")));
             Content treePara = HtmlTree.P(line17);
-            liTree.addContent(treePara);
+            htmlTree.addContent(treePara);
             HtmlTree tul = new HtmlTree(HtmlTag.UL);
             tul.addContent(HtmlTree.LI(
                     getResource("doclet.Help_line_18")));
             tul.addContent(HtmlTree.LI(
                     getResource("doclet.Help_line_19")));
-            liTree.addContent(tul);
-            ul.addContent(liTree);
+            htmlTree.addContent(tul);
+            if (configuration.allowTag(HtmlTag.SECTION)) {
+                ul.addContent(HtmlTree.LI(HtmlStyle.blockList, htmlTree));
+            } else {
+                ul.addContent(htmlTree);
+            }
         }
         if (!(configuration.nodeprecatedlist ||
                   configuration.nodeprecated)) {
             Content dHead = HtmlTree.HEADING(HtmlConstants.CONTENT_HEADING,
                     getResource("doclet.Deprecated_API"));
-            Content liDeprecated = HtmlTree.LI(HtmlStyle.blockList, dHead);
+            htmlTree = (configuration.allowTag(HtmlTag.SECTION))
+                    ? HtmlTree.SECTION(dHead)
+                    : HtmlTree.LI(HtmlStyle.blockList, dHead);
             Content line20 = getResource("doclet.Help_line_20_with_deprecated_api_link",
                     getHyperLink(DocPaths.DEPRECATED_LIST,
                     configuration.getText("doclet.Deprecated_API")));
             Content dPara = HtmlTree.P(line20);
-            liDeprecated.addContent(dPara);
-            ul.addContent(liDeprecated);
+            htmlTree.addContent(dPara);
+            if (configuration.allowTag(HtmlTag.SECTION)) {
+                ul.addContent(HtmlTree.LI(HtmlStyle.blockList, htmlTree));
+            } else {
+                ul.addContent(htmlTree);
+            }
         }
         if (configuration.createindex) {
             Content indexlink;
@@ -270,55 +337,96 @@ public class HelpWriter extends HtmlDocletWriter {
             }
             Content indexHead = HtmlTree.HEADING(HtmlConstants.CONTENT_HEADING,
                     getResource("doclet.Help_line_21"));
-            Content liIndex = HtmlTree.LI(HtmlStyle.blockList, indexHead);
+            htmlTree = (configuration.allowTag(HtmlTag.SECTION))
+                    ? HtmlTree.SECTION(indexHead)
+                    : HtmlTree.LI(HtmlStyle.blockList, indexHead);
             Content line22 = getResource("doclet.Help_line_22", indexlink);
             Content indexPara = HtmlTree.P(line22);
-            liIndex.addContent(indexPara);
-            ul.addContent(liIndex);
+            htmlTree.addContent(indexPara);
+            if (configuration.allowTag(HtmlTag.SECTION)) {
+                ul.addContent(HtmlTree.LI(HtmlStyle.blockList, htmlTree));
+            } else {
+                ul.addContent(htmlTree);
+            }
         }
         Content prevHead = HtmlTree.HEADING(HtmlConstants.CONTENT_HEADING,
                 getResource("doclet.Help_line_23"));
-        Content liPrev = HtmlTree.LI(HtmlStyle.blockList, prevHead);
+        htmlTree = (configuration.allowTag(HtmlTag.SECTION))
+                ? HtmlTree.SECTION(prevHead)
+                : HtmlTree.LI(HtmlStyle.blockList, prevHead);
         Content line24 = getResource("doclet.Help_line_24");
         Content prevPara = HtmlTree.P(line24);
-        liPrev.addContent(prevPara);
-        ul.addContent(liPrev);
+        htmlTree.addContent(prevPara);
+        if (configuration.allowTag(HtmlTag.SECTION)) {
+            ul.addContent(HtmlTree.LI(HtmlStyle.blockList, htmlTree));
+        } else {
+            ul.addContent(htmlTree);
+        }
         Content frameHead = HtmlTree.HEADING(HtmlConstants.CONTENT_HEADING,
                 getResource("doclet.Help_line_25"));
-        Content liFrame = HtmlTree.LI(HtmlStyle.blockList, frameHead);
+        htmlTree = (configuration.allowTag(HtmlTag.SECTION))
+                ? HtmlTree.SECTION(frameHead)
+                : HtmlTree.LI(HtmlStyle.blockList, frameHead);
         Content line26 = getResource("doclet.Help_line_26");
         Content framePara = HtmlTree.P(line26);
-        liFrame.addContent(framePara);
-        ul.addContent(liFrame);
+        htmlTree.addContent(framePara);
+        if (configuration.allowTag(HtmlTag.SECTION)) {
+            ul.addContent(HtmlTree.LI(HtmlStyle.blockList, htmlTree));
+        } else {
+            ul.addContent(htmlTree);
+        }
         Content allclassesHead = HtmlTree.HEADING(HtmlConstants.CONTENT_HEADING,
                 getResource("doclet.All_Classes"));
-        Content liAllClasses = HtmlTree.LI(HtmlStyle.blockList, allclassesHead);
+        htmlTree = (configuration.allowTag(HtmlTag.SECTION))
+                ? HtmlTree.SECTION(allclassesHead)
+                : HtmlTree.LI(HtmlStyle.blockList, allclassesHead);
         Content line27 = getResource("doclet.Help_line_27",
                 getHyperLink(DocPaths.ALLCLASSES_NOFRAME,
                 configuration.getText("doclet.All_Classes")));
         Content allclassesPara = HtmlTree.P(line27);
-        liAllClasses.addContent(allclassesPara);
-        ul.addContent(liAllClasses);
+        htmlTree.addContent(allclassesPara);
+        if (configuration.allowTag(HtmlTag.SECTION)) {
+            ul.addContent(HtmlTree.LI(HtmlStyle.blockList, htmlTree));
+        } else {
+            ul.addContent(htmlTree);
+        }
         Content sHead = HtmlTree.HEADING(HtmlConstants.CONTENT_HEADING,
                 getResource("doclet.Serialized_Form"));
-        Content liSerial = HtmlTree.LI(HtmlStyle.blockList, sHead);
+        htmlTree = (configuration.allowTag(HtmlTag.SECTION))
+                ? HtmlTree.SECTION(sHead)
+                : HtmlTree.LI(HtmlStyle.blockList, sHead);
         Content line28 = getResource("doclet.Help_line_28");
         Content serialPara = HtmlTree.P(line28);
-        liSerial.addContent(serialPara);
-        ul.addContent(liSerial);
+        htmlTree.addContent(serialPara);
+        if (configuration.allowTag(HtmlTag.SECTION)) {
+            ul.addContent(HtmlTree.LI(HtmlStyle.blockList, htmlTree));
+        } else {
+            ul.addContent(htmlTree);
+        }
         Content constHead = HtmlTree.HEADING(HtmlConstants.CONTENT_HEADING,
                 getResource("doclet.Constants_Summary"));
-        Content liConst = HtmlTree.LI(HtmlStyle.blockList, constHead);
+        htmlTree = (configuration.allowTag(HtmlTag.SECTION))
+                ? HtmlTree.SECTION(constHead)
+                : HtmlTree.LI(HtmlStyle.blockList, constHead);
         Content line29 = getResource("doclet.Help_line_29",
                 getHyperLink(DocPaths.CONSTANT_VALUES,
                 configuration.getText("doclet.Constants_Summary")));
         Content constPara = HtmlTree.P(line29);
-        liConst.addContent(constPara);
-        ul.addContent(liConst);
+        htmlTree.addContent(constPara);
+        if (configuration.allowTag(HtmlTag.SECTION)) {
+            ul.addContent(HtmlTree.LI(HtmlStyle.blockList, htmlTree));
+        } else {
+            ul.addContent(htmlTree);
+        }
         Content divContent = HtmlTree.DIV(HtmlStyle.contentContainer, ul);
         Content line30 = HtmlTree.SPAN(HtmlStyle.emphasizedPhrase, getResource("doclet.Help_line_30"));
         divContent.addContent(line30);
-        contentTree.addContent(divContent);
+        if (configuration.allowTag(HtmlTag.MAIN)) {
+            mainTree.addContent(divContent);
+            contentTree.addContent(mainTree);
+        } else {
+            contentTree.addContent(divContent);
+        }
     }
 
     /**
diff --git a/langtools/src/jdk.javadoc/share/classes/com/sun/tools/doclets/formats/html/HtmlDocletWriter.java b/langtools/src/jdk.javadoc/share/classes/com/sun/tools/doclets/formats/html/HtmlDocletWriter.java
index 0d8300b8a7b..9f1a0d5defa 100644
--- a/langtools/src/jdk.javadoc/share/classes/com/sun/tools/doclets/formats/html/HtmlDocletWriter.java
+++ b/langtools/src/jdk.javadoc/share/classes/com/sun/tools/doclets/formats/html/HtmlDocletWriter.java
@@ -1,5 +1,5 @@
 /*
- * Copyright (c) 1998, 2014, Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 1998, 2015, Oracle and/or its affiliates. All rights reserved.
  * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
  *
  * This code is free software; you can redistribute it and/or modify it
@@ -183,8 +183,7 @@ public class HtmlDocletWriter extends HtmlDocWriter {
      * @return a content tree for the script
      */
     public Content getAllClassesLinkScript(String id) {
-        HtmlTree script = new HtmlTree(HtmlTag.SCRIPT);
-        script.addAttr(HtmlAttr.TYPE, "text/javascript");
+        HtmlTree script = HtmlTree.SCRIPT();
         String scriptCode = "\n"
                 + "",
                 // Bottom navbar 
                 "Skip navigation links",
-                // Bottom navbar 
-                "\n"
+                // Bottom navbar 
+                "\n"
                 + "\n"
                 + "");
 
diff --git a/langtools/test/com/sun/javadoc/testAnchorNames/TestAnchorNames.java b/langtools/test/com/sun/javadoc/testAnchorNames/TestAnchorNames.java
index f0c4a138e34..fcd5196e998 100644
--- a/langtools/test/com/sun/javadoc/testAnchorNames/TestAnchorNames.java
+++ b/langtools/test/com/sun/javadoc/testAnchorNames/TestAnchorNames.java
@@ -1,5 +1,5 @@
 /*
- * Copyright (c) 2013, 2014, Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 2013, 2015, Oracle and/or its affiliates. All rights reserved.
  * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
  *
  * This code is free software; you can redistribute it and/or modify it
@@ -53,15 +53,15 @@ public class TestAnchorNames extends JavadocTester {
 
         // Test some section markers and links to these markers
         checkOutput("pkg1/RegClass.html", true,
-                "",
+                "",
                 "",
-                "",
+                "",
                 "",
-                "",
+                "",
                 "",
-                "",
+                "",
                 "",
-                "",
+                "",
                 "");
 
         // Test some members and link to these members
@@ -72,59 +72,59 @@ public class TestAnchorNames extends JavadocTester {
 
         // Test some fields
         checkOutput("pkg1/RegClass.html", true,
-                "",
+                "",
                 "",
-                "",
+                "",
                 "",
-                "",
+                "",
                 "",
-                "",
+                "",
                 "",
-                "",
+                "",
                 "",
-                "",
+                "",
                 "",
-                "",
+                "",
                 "");
 
         checkOutput("pkg1/DeprMemClass.html", true,
-                "",
+                "",
                 "");
 
         // Test constructor
         checkOutput("pkg1/RegClass.html", true,
-                "",
+                "",
                 "");
 
         // Test some methods
         checkOutput("pkg1/RegClass.html", true,
-                "",
+                "",
                 "",
-                "",
+                "",
                 "",
-                "",
+                "",
                 "",
-                "",
+                "",
                 "",
-                "",
+                "",
                 "",
-                "",
+                "",
                 "",
-                "",
+                "",
                 "");
 
         checkOutput("pkg1/DeprMemClass.html", true,
-                "",
+                "",
                 "");
 
         // Test enum
         checkOutput("pkg1/RegClass.Te$t_Enum.html", true,
-                "",
+                "",
                 "");
 
         // Test nested class
         checkOutput("pkg1/RegClass._NestedClas$.html", true,
-                "",
+                "",
                 "");
 
         // Test class use page
@@ -143,11 +143,11 @@ public class TestAnchorNames extends JavadocTester {
         // Test serialized form page
         checkOutput("serialized-form.html", true,
                 //This is the marker for the link that appears in the pkg1.RegClass.html page
-                "");
+                "");
 
         // Test member name index page
         checkOutput("index-all.html", true,
-                "",
+                "",
                 "$",
                 "_");
 
diff --git a/langtools/test/com/sun/javadoc/testAnnotationOptional/TestAnnotationOptional.java b/langtools/test/com/sun/javadoc/testAnnotationOptional/TestAnnotationOptional.java
index 18e8c93d0a5..6b723d0d9a4 100644
--- a/langtools/test/com/sun/javadoc/testAnnotationOptional/TestAnnotationOptional.java
+++ b/langtools/test/com/sun/javadoc/testAnnotationOptional/TestAnnotationOptional.java
@@ -1,5 +1,5 @@
 /*
- * Copyright (c) 2009, 2014, Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 2009, 2015, Oracle and/or its affiliates. All rights reserved.
  * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
  *
  * This code is free software; you can redistribute it and/or modify it
@@ -47,6 +47,6 @@ public class TestAnnotationOptional extends JavadocTester {
         checkExit(Exit.OK);
 
         checkOutput("pkg/AnnotationOptional.html", true,
-            "");
+            "");
     }
 }
diff --git a/langtools/test/com/sun/javadoc/testClassTree/TestClassTree.java b/langtools/test/com/sun/javadoc/testClassTree/TestClassTree.java
index 22070488d77..90d6b405aea 100644
--- a/langtools/test/com/sun/javadoc/testClassTree/TestClassTree.java
+++ b/langtools/test/com/sun/javadoc/testClassTree/TestClassTree.java
@@ -1,5 +1,5 @@
 /*
- * Copyright (c) 2004, 2014, Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 2004, 2015, Oracle and/or its affiliates. All rights reserved.
  * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
  *
  * This code is free software; you can redistribute it and/or modify it
@@ -50,22 +50,22 @@ public class TestClassTree extends JavadocTester {
 
         checkOutput("pkg/package-tree.html", true,
                 "
    \n" - + "
  • pkg.pkg.ParentClass", "

    Annotation Type Hierarchy

    \n" + "", "

    Enum Hierarchy

    \n" + "
      \n" - + "
    • java.lang.Object\n" + + "
    • java.lang.Object\n" + "
        \n" - + "
      • java.lang.Enum<E> (implements java.lang." + + "
      • java.lang.Enum<E> (implements java.lang." + "Comparable<T>, java.io.Serializable)\n" + "\n" + "
      • \n" @@ -74,7 +74,7 @@ public class TestClassTree extends JavadocTester { + "
      "); checkOutput("pkg/package-tree.html", false, - "
    • class pkg.class pkg.ParentClass
    • "); } } diff --git a/langtools/test/com/sun/javadoc/testConstructors/TestConstructors.java b/langtools/test/com/sun/javadoc/testConstructors/TestConstructors.java index c98501eda98..9fef963ee7f 100644 --- a/langtools/test/com/sun/javadoc/testConstructors/TestConstructors.java +++ b/langtools/test/com/sun/javadoc/testConstructors/TestConstructors.java @@ -1,5 +1,5 @@ /* - * Copyright (c) 2013, 2014, Oracle and/or its affiliates. All rights reserved. + * Copyright (c) 2013, 2015, Oracle and/or its affiliates. All rights reserved. * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. * * This code is free software; you can redistribute it and/or modify it @@ -58,21 +58,21 @@ public class TestConstructors extends JavadocTester { + "" + "NestedInner(int)", "Outer()", - "", + "", "Outer(int i)", - ""); + ""); checkOutput("pkg1/Outer.Inner.html", true, "Inner()", - "", + "", "Inner(int i)", - ""); + ""); checkOutput("pkg1/Outer.Inner.NestedInner.html", true, "NestedInner()", - "", + "", "NestedInner(int i)", - ""); + ""); checkOutput("pkg1/Outer.Inner.html", false, "Outer.Inner--", diff --git a/langtools/test/com/sun/javadoc/testHref/TestHref.java b/langtools/test/com/sun/javadoc/testHref/TestHref.java index f5311674695..0bd8cac4feb 100644 --- a/langtools/test/com/sun/javadoc/testHref/TestHref.java +++ b/langtools/test/com/sun/javadoc/testHref/TestHref.java @@ -1,5 +1,5 @@ /* - * Copyright (c) 2003, 2014, Oracle and/or its affiliates. All rights reserved. + * Copyright (c) 2003, 2015, Oracle and/or its affiliates. All rights reserved. * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. * * This code is free software; you can redistribute it and/or modify it @@ -53,11 +53,11 @@ public class TestHref extends JavadocTester { //Member summary table link. "href=\"../pkg/C1.html#method-int-int-java.util.ArrayList-\"", //Anchor test. - "\n" + "\n" + "\n" + "", //Backward compatibility anchor test."pkg/C1.html", - "\n" + "\n" + "\n" + ""); diff --git a/langtools/test/com/sun/javadoc/testHtmlDocument/TestHtmlDocument.java b/langtools/test/com/sun/javadoc/testHtmlDocument/TestHtmlDocument.java index 32da20dfded..fa1cc7a7221 100644 --- a/langtools/test/com/sun/javadoc/testHtmlDocument/TestHtmlDocument.java +++ b/langtools/test/com/sun/javadoc/testHtmlDocument/TestHtmlDocument.java @@ -1,5 +1,5 @@ /* - * Copyright (c) 2010, 2014, Oracle and/or its affiliates. All rights reserved. + * Copyright (c) 2010, 2015, Oracle and/or its affiliates. All rights reserved. * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. * * This code is free software; you can redistribute it and/or modify it @@ -113,7 +113,7 @@ public class TestHtmlDocument extends JavadocTester { // Test another version of A tag. HtmlTree anchor = new HtmlTree(HtmlTag.A); anchor.addAttr(HtmlAttr.HREF, "testLink.html"); - anchor.addAttr(HtmlAttr.NAME, "Another version of a tag"); + anchor.addAttr(HtmlAttr.ID, "Another version of a tag"); p1.addContent(anchor); body.addContent(p1); // Test for empty tags. diff --git a/langtools/test/com/sun/javadoc/testHtmlDocument/testMarkup.html b/langtools/test/com/sun/javadoc/testHtmlDocument/testMarkup.html index 4dc92027917..63b228fc2d7 100644 --- a/langtools/test/com/sun/javadoc/testHtmlDocument/testMarkup.html +++ b/langtools/test/com/sun/javadoc/testHtmlDocument/testMarkup.html @@ -9,7 +9,7 @@

      This document is generated from sample source code and HTML files with examples of a wide variety of Java language constructs: packages, subclasses, subinterfaces, nested classes, nested interfaces,inheriting from other packages, constructors, fields,methods, and so forth. Click Here to <test> out a link.

      -

      +

      Test DD
      diff --git a/langtools/test/com/sun/javadoc/testHtmlTableStyles/TestHtmlTableStyles.java b/langtools/test/com/sun/javadoc/testHtmlTableStyles/TestHtmlTableStyles.java index de6f152d5a2..79d1e1cfb73 100644 --- a/langtools/test/com/sun/javadoc/testHtmlTableStyles/TestHtmlTableStyles.java +++ b/langtools/test/com/sun/javadoc/testHtmlTableStyles/TestHtmlTableStyles.java @@ -1,5 +1,5 @@ /* - * Copyright (c) 2013, 2014, Oracle and/or its affiliates. All rights reserved. + * Copyright (c) 2013, 2015, Oracle and/or its affiliates. All rights reserved. * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. * * This code is free software; you can redistribute it and/or modify it @@ -48,37 +48,30 @@ public class TestHtmlTableStyles extends JavadocTester { checkOutput("pkg1/TestTable.html", true, "", - "
      ", - "
      ", - "
      "); checkOutput("pkg1/package-summary.html", true, - "
      "); checkOutput("pkg1/class-use/TestTable.html", true, - "
      "); + "
      "); checkOutput("overview-summary.html", true, - "
      "); + "
      "); checkOutput("deprecated-list.html", true, - "
      "); checkOutput("constant-values.html", true, - "
      "); } } diff --git a/langtools/test/com/sun/javadoc/testHtmlTableTags/TestHtmlTableTags.java b/langtools/test/com/sun/javadoc/testHtmlTableTags/TestHtmlTableTags.java index 13c9214e4d4..bd0ad241056 100644 --- a/langtools/test/com/sun/javadoc/testHtmlTableTags/TestHtmlTableTags.java +++ b/langtools/test/com/sun/javadoc/testHtmlTableTags/TestHtmlTableTags.java @@ -1,5 +1,5 @@ /* - * Copyright (c) 2009, 2014, Oracle and/or its affiliates. All rights reserved. + * Copyright (c) 2009, 2015, Oracle and/or its affiliates. All rights reserved. * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. * * This code is free software; you can redistribute it and/or modify it @@ -63,111 +63,85 @@ public class TestHtmlTableTags extends JavadocTester { void checkHtmlTableSummaries() { //Package summary checkOutput("pkg1/package-summary.html", true, - "
      ", - "
      "); checkOutput("pkg2/package-summary.html", true, - "
      ", - "
      "); // Class documentation checkOutput("pkg1/C1.html", true, - "
      ", - "
      "); checkOutput("pkg2/C2.html", true, - "
      ", - "
      "); checkOutput("pkg2/C2.ModalExclusionType.html", true, - "
      "); checkOutput("pkg2/C3.html", true, - "
      "); checkOutput("pkg2/C4.html", true, - "
      "); // Class use documentation checkOutput("pkg1/class-use/I1.html", true, - "
      "); + "
      "); checkOutput("pkg1/class-use/C1.html", true, - "
      ", - "
      "); + "
      ", + "
      "); checkOutput("pkg2/class-use/C2.html", true, - "
      ", - "
      "); + "
      ", + "
      "); checkOutput("pkg2/class-use/C2.ModalExclusionType.html", true, - "
      "); + "
      "); checkOutput("pkg2/class-use/C2.ModalExclusionType.html", true, - "
      "); + "
      "); // Package use documentation checkOutput("pkg1/package-use.html", true, - "
      ", - "
      "); + "
      ", + "
      "); checkOutput("pkg2/package-use.html", true, - "
      ", - "
      "); + "
      ", + "
      "); // Deprecated checkOutput("deprecated-list.html", true, - "
      ", - "
      "); // Constant values checkOutput("constant-values.html", true, - "
      "); // Overview Summary checkOutput("overview-summary.html", true, - "
      "); + "
      "); } /* diff --git a/langtools/test/com/sun/javadoc/testHtmlVersion/TestHtmlVersion.java b/langtools/test/com/sun/javadoc/testHtmlVersion/TestHtmlVersion.java new file mode 100644 index 00000000000..970ac00bd31 --- /dev/null +++ b/langtools/test/com/sun/javadoc/testHtmlVersion/TestHtmlVersion.java @@ -0,0 +1,2158 @@ +/* + * Copyright (c) 2015, Oracle and/or its affiliates. All rights reserved. + * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. + * + * This code is free software; you can redistribute it and/or modify it + * under the terms of the GNU General Public License version 2 only, as + * published by the Free Software Foundation. + * + * 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. + */ + +/* + * @test + * @bug 8072945 + * @summary Test the version of HTML generated by the javadoc tool. + * @author bpatel + * @library ../lib + * @build JavadocTester + * @run main TestHtmlVersion + */ + +public class TestHtmlVersion extends JavadocTester { + + public static void main(String... args) throws Exception { + TestHtmlVersion tester = new TestHtmlVersion(); + tester.runTests(); + } + + @Test + void test1() { + javadoc("-d", "out-1", "-private", "-linksource", "-html5", + "-Xprofilespath", testSrc("profile-rtjar-includes.txt"), + "-sourcepath", testSrc, + "-use", + "pkg", "pkg1", "pkg2", "pkg3"); + checkExit(Exit.OK); + + html5Output(); + html5NegatedOutput(); + } + + @Test + void test2() { + javadoc("-d", "out-2", "-private", "-linksource", "-html4", + "-Xprofilespath", testSrc("profile-rtjar-includes.txt"), + "-sourcepath", testSrc, + "-use", + "pkg", "pkg1", "pkg2", "pkg3"); + checkExit(Exit.OK); + + html4Output(); + html4NegatedOutput(); + } + + @Test + void test3() { + javadoc("-d", "out-3", "-private", "-linksource", + "-Xprofilespath", testSrc("profile-rtjar-includes.txt"), + "-sourcepath", testSrc, + "-use", + "pkg", "pkg1", "pkg2", "pkg3"); + checkExit(Exit.OK); + + html4Output(); + html4NegatedOutput(); + } + + @Test + void test4() { + javadoc("-d", "out-4", "-private", "-linksource", "-html5", + "-sourcepath", testSrc, + "-use", + "pkg3"); + checkExit(Exit.OK); + } + + void html5Output() { + // Test for overview-frame page + checkOutput("overview-frame.html", true, + "", + "\n" + + "
        \n" + + "
      • All Classes
      • ", + "
        \n" + + "

        Packages

        "); + + // Test for allclasses-frame page + checkOutput("allclasses-frame.html", true, + "", + "\n" + + "
          \n" + + "
        • "); + + // Test for allclasses-noframe page + checkOutput("allclasses-noframe.html", true, + "", + "\n" + + "
            \n" + + "
          • "); + + // Test for profile-overview-frame page + checkOutput("profile-overview-frame.html", true, + "", + "\n" + + "
              \n" + + "
            • All Classes
            • ", + "
              \n" + + "

              Profiles

              "); + + // Test for -frame page + checkOutput("compact1-frame.html", true, + "", + "\n" + + "
                \n" + + "
              • All Classes
              • ", + "
                \n" + + "

                compact1 Packages

                "); + + // Test for overview-summary page + checkOutput("overview-summary.html", true, + "", + "\n" + + "\n" + + "", + "
      \n" + + "
      ", + "
      \n" + + "