diff -r 1fbc1cc6e260 -r 5240b1120530 src/share/classes/com/sun/tools/doclets/formats/html/HtmlDocletWriter.java --- a/src/share/classes/com/sun/tools/doclets/formats/html/HtmlDocletWriter.java Tue Feb 24 17:48:53 2009 -0800 +++ b/src/share/classes/com/sun/tools/doclets/formats/html/HtmlDocletWriter.java Fri Feb 27 18:57:17 2009 -0800 @@ -24,17 +24,16 @@ */ package com.sun.tools.doclets.formats.html; -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.doclets.internal.toolkit.taglets.*; - -import com.sun.javadoc.*; import java.io.*; import java.text.SimpleDateFormat; import java.util.*; +import com.sun.javadoc.*; +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.doclets.internal.toolkit.taglets.*; /** * Class for the Html Format Code Generation specific to JavaDoc. @@ -44,6 +43,7 @@ * @since 1.2 * @author Atul M Dambalkar * @author Robert Field + * @author Bhavesh Patel (Modified) */ public class HtmlDocletWriter extends HtmlDocWriter { @@ -205,7 +205,13 @@ private void printMethodInfo(MethodDoc method) { ClassDoc[] intfacs = method.containingClass().interfaces(); MethodDoc overriddenMethod = method.overriddenMethod(); - if (intfacs.length > 0 || overriddenMethod != null) { + // Check whether there is any implementation or overridden info to be + // printed. If no overridden or implementation info needs to be + // printed, do not print this section. + if ((intfacs.length > 0 && + new ImplementedMethods(method, this.configuration).build().length > 0) || + overriddenMethod != null) { + printMemberDetailsListStartTag(); dd(); printTagsInfoHeader(); MethodWriterImpl.printImplementsInfo(this, method); @@ -216,7 +222,6 @@ printTagsInfoFooter(); ddEnd(); } - dd(); } protected void printTags(Doc doc) { @@ -230,41 +235,35 @@ TagletWriter.genTagOuput(configuration.tagletManager, doc, configuration.tagletManager.getCustomTags(doc), getTagletWriterInstance(false), output); - if (output.toString().trim().length() > 0) { + String outputString = output.toString().trim(); + // For RootDoc and ClassDoc, this section is not the definition description + // but the start of definition list. + if (!outputString.isEmpty()) { + if (!(doc instanceof RootDoc || doc instanceof ClassDoc)) { + printMemberDetailsListStartTag(); + dd(); + } printTagsInfoHeader(); - print(output.toString()); + print(outputString); printTagsInfoFooter(); - } else if (! (doc instanceof ConstructorDoc || - doc instanceof RootDoc || doc instanceof ClassDoc)) { - //To be consistent with 1.4.2 output. - //I hate to do this but we have to pass the diff test to prove - //nothing has broken. - printTagsInfoHeader(); - printTagsInfoFooter(); + if (!(doc instanceof RootDoc || doc instanceof ClassDoc)) + ddEnd(); } } /** - * Check whether there are any tags to be printed. + * Check whether there are any tags for Serialization Overview + * section to be printed. * - * @param doc the Doc object to check for tags. + * @param field the FieldDoc object to check for tags. * @return true if there are tags to be printed else return false. */ - protected boolean hasTagsToPrint(Doc doc) { - if (doc instanceof MethodDoc) { - ClassDoc[] intfacs = ((MethodDoc)doc).containingClass().interfaces(); - MethodDoc overriddenMethod = ((MethodDoc)doc).overriddenMethod(); - if ((intfacs.length > 0 && - new ImplementedMethods((MethodDoc)doc, this.configuration).build().length > 0) || - overriddenMethod != null) { - return true; - } - } + protected boolean hasSerializationOverviewTags(FieldDoc field) { TagletOutputImpl output = new TagletOutputImpl(""); - TagletWriter.genTagOuput(configuration.tagletManager, doc, - configuration.tagletManager.getCustomTags(doc), + TagletWriter.genTagOuput(configuration.tagletManager, field, + configuration.tagletManager.getCustomTags(field), getTagletWriterInstance(false), output); - return (output.toString().trim().isEmpty()); + return (!output.toString().trim().isEmpty()); } /**