This commit is contained in:
Lana Steuck 2012-11-20 11:50:37 -08:00
commit c8adadc51c
733 changed files with 38909 additions and 2319 deletions

View File

@ -1,6 +1,6 @@
<?xml version="1.0" encoding="UTF-8"?> <?xml version="1.0" encoding="UTF-8"?>
<!-- <!--
Copyright (c) 2007, 2011, Oracle and/or its affiliates. All rights reserved. Copyright (c) 2007, 2012, Oracle and/or its affiliates. All rights reserved.
DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
This code is free software; you can redistribute it and/or modify it This code is free software; you can redistribute it and/or modify it
@ -368,7 +368,7 @@
executable="${dist.bin.dir}/javac" executable="${dist.bin.dir}/javac"
srcdir="test/tools/javac/diags" srcdir="test/tools/javac/diags"
destdir="${build.dir}/diag-examples/classes" destdir="${build.dir}/diag-examples/classes"
includes="ArgTypeCompilerFactory.java,Example.java,FileManager.java,HTMLWriter.java,RunExamples.java" includes="ArgTypeCompilerFactory.java,Example.java,FileManager.java,HTMLWriter.java,RunExamples.java,DocCommentProcessor.java"
sourcepath="" sourcepath=""
classpath="${dist.lib.dir}/javac.jar" classpath="${dist.lib.dir}/javac.jar"
includeAntRuntime="no" includeAntRuntime="no"
@ -381,6 +381,7 @@
dir="test/tools/javac/diags" dir="test/tools/javac/diags"
classpath="${build.dir}/diag-examples/classes;${dist.lib.dir}/javac.jar" classpath="${build.dir}/diag-examples/classes;${dist.lib.dir}/javac.jar"
classname="RunExamples"> classname="RunExamples">
<jvmarg value="-Dtest.classes=${build.dir}/diag-examples/classes"/>
<arg value="-examples"/> <arg value="-examples"/>
<arg value="examples"/> <arg value="examples"/>
<arg value="-o"/> <arg value="-o"/>

View File

@ -0,0 +1,42 @@
/*
* Copyright (c) 2011, 2012, 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.source.doctree;
import java.util.List;
import javax.lang.model.element.Name;
/**
* A tree node for an attribute in an HTML element.
*
* @since 1.8
*/
public interface AttributeTree extends DocTree {
enum ValueKind { EMPTY, UNQUOTED, SINGLE, DOUBLE };
Name getName();
ValueKind getValueKind();
List<? extends DocTree> getValue();
}

View File

@ -0,0 +1,40 @@
/*
* Copyright (c) 2011, 2012, 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.source.doctree;
import java.util.List;
/**
* A tree node for an @author block tag.
*
* <p>
* &#064;author name-text.
*
* @since 1.8
*/
public interface AuthorTree extends BlockTagTree {
List<? extends DocTree> getName();
}

View File

@ -0,0 +1,36 @@
/*
* Copyright (c) 2011, 2012, 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.source.doctree;
/**
* A tree node used as the base class for the different types of
* block tags.
*
* @since 1.8
*/
public interface BlockTagTree extends DocTree {
String getTagName();
}

View File

@ -0,0 +1,39 @@
/*
* Copyright (c) 2011, 2012, 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.source.doctree;
/**
* An embedded HTML comment.
*
* <p>
* {@literal <!-- text --> }
*
* @since 1.8
*/
public interface CommentTree extends DocTree {
String getBody();
}

View File

@ -0,0 +1,40 @@
/*
* Copyright (c) 2011, 2012, 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.source.doctree;
import java.util.List;
/**
* A tree node for an @deprecated block tag.
*
* <p>
* &#064;deprecated deprecated text.
*
* @since 1.8
*/
public interface DeprecatedTree extends BlockTagTree {
List<? extends DocTree> getBody();
}

View File

@ -0,0 +1,42 @@
/*
* Copyright (c) 2011, 2012, 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.source.doctree;
import java.util.List;
/**
* The top level representation of a documentation comment.
*
* <p>
* first-sentence body block-tags
*
* @since 1.8
*/
public interface DocCommentTree extends DocTree {
List<? extends DocTree> getFirstSentence();
List<? extends DocTree> getBody();
List<? extends DocTree> getBlockTags();
}

View File

@ -0,0 +1,36 @@
/*
* Copyright (c) 2011, 2012, 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.source.doctree;
/**
* A tree node for an @docroot inline tag.
*
* <p>
* {&#064;docroot}
*
* @since 1.8
*/
public interface DocRootTree extends InlineTagTree { }

View File

@ -0,0 +1,254 @@
/*
* Copyright (c) 2011, 2012, 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.source.doctree;
/**
* Common interface for all nodes in a documentation syntax tree.
*
* @since 1.8
*/
public interface DocTree {
enum Kind {
/**
* Used for instances of {@link AttributeTree}
* representing an HTML attribute.
*/
ATTRIBUTE,
/**
* Used for instances of {@link AuthorTree}
* representing an @author tag.
*/
AUTHOR("author"),
/**
* Used for instances of {@link LiteralTree}
* representing an @code tag.
*/
CODE("code"),
/**
* Used for instances of {@link CommentTree}
* representing an HTML comment.
*/
COMMENT,
/**
* Used for instances of {@link DeprecatedTree}
* representing an @deprecated tag.
*/
DEPRECATED("deprecated"),
/**
* Used for instances of {@link DocCommentTree}
* representing a complete doc comment.
*/
DOC_COMMENT,
/**
* Used for instances of {@link DocRootTree}
* representing an @docRoot tag.
*/
DOC_ROOT("docRoot"),
/**
* Used for instances of {@link EndElementTree}
* representing the end of an HTML element.
*/
END_ELEMENT,
/**
* Used for instances of {@link EntityTree}
* representing an HTML entity.
*/
ENTITY,
/**
* Used for instances of {@link ErroneousTree}
* representing some invalid text.
*/
ERRONEOUS,
/**
* Used for instances of {@link ThrowsTree}
* representing an @exception tag.
*/
EXCEPTION("exception"),
/**
* Used for instances of {@link IdentifierTree}
* representing an identifier.
*/
IDENTIFIER,
/**
* Used for instances of {@link InheritDocTree}
* representing an @inheritDoc tag.
*/
INHERIT_DOC("inheritDoc"),
/**
* Used for instances of {@link LinkTree}
* representing an @link tag.
*/
LINK("link"),
/**
* Used for instances of {@link LinkTree}
* representing an @linkplain tag.
*/
LINK_PLAIN("linkplain"),
/**
* Used for instances of {@link LiteralTree}
* representing an @literal tag.
*/
LITERAL("literal"),
/**
* Used for instances of {@link ParamTree}
* representing an @param tag.
*/
PARAM("param"),
/**
* Used for instances of {@link ReferenceTree}
* representing a reference to a element in the
* Java programming language.
*/
REFERENCE,
/**
* Used for instances of {@link ReturnTree}
* representing an @return tag.
*/
RETURN("return"),
/**
* Used for instances of {@link SeeTree}
* representing an @see tag.
*/
SEE("see"),
/**
* Used for instances of {@link SerialTree}
* representing an @serial tag.
*/
SERIAL("serial"),
/**
* Used for instances of {@link SerialDataTree}
* representing an @serialData tag.
*/
SERIAL_DATA("serialData"),
/**
* Used for instances of {@link SerialFieldTree}
* representing an @serialField tag.
*/
SERIAL_FIELD("serialField"),
/**
* Used for instances of {@link SinceTree}
* representing an @since tag.
*/
SINCE("since"),
/**
* Used for instances of {@link EndElementTree}
* representing the start of an HTML element.
*/
START_ELEMENT,
/**
* Used for instances of {@link TextTree}
* representing some documentation text.
*/
TEXT,
/**
* Used for instances of {@link ThrowsTree}
* representing an @throws tag.
*/
THROWS("throws"),
/**
* Used for instances of {@link UnknownBlockTagTree}
* representing an unknown block tag.
*/
UNKNOWN_BLOCK_TAG,
/**
* Used for instances of {@link UnknownInlineTagTree}
* representing an unknown inline tag.
*/
UNKNOWN_INLINE_TAG,
/**
* Used for instances of {@link ValueTree}
* representing an @value tag.
*/
VALUE("value"),
/**
* Used for instances of {@link VersionTree}
* representing an @version tag.
*/
VERSION("version"),
/**
* An implementation-reserved node. This is the not the node
* you are looking for.
*/
OTHER;
public final String tagName;
Kind() {
tagName = null;
}
Kind(String tagName) {
this.tagName = tagName;
}
};
/**
* Gets the kind of this tree.
*
* @return the kind of this tree.
*/
Kind getKind();
/**
* Accept method used to implement the visitor pattern. The
* visitor pattern is used to implement operations on trees.
*
* @param <R> result type of this operation.
* @param <D> type of additional data.
*/
<R, D> R accept(DocTreeVisitor<R,D> visitor, D data);
}

View File

@ -0,0 +1,87 @@
/*
* Copyright (c) 2011, 2012, 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.source.doctree;
/**
* A visitor of trees, in the style of the visitor design pattern.
* Classes implementing this interface are used to operate
* on a tree when the kind of tree is unknown at compile time.
* When a visitor is passed to an tree's {@link DocTree#accept
* accept} method, the <tt>visit<i>XYZ</i></tt> method most applicable
* to that tree is invoked.
*
* <p> Classes implementing this interface may or may not throw a
* {@code NullPointerException} if the additional parameter {@code p}
* is {@code null}; see documentation of the implementing class for
* details.
*
* <p> <b>WARNING:</b> It is possible that methods will be added to
* this interface to accommodate new, currently unknown, doc comment
* structures added to future versions of the Java&trade; programming
* language. Therefore, visitor classes directly implementing this
* interface may be source incompatible with future versions of the
* platform.
*
* @param <R> the return type of this visitor's methods. Use {@link
* Void} for visitors that do not need to return results.
* @param <P> the type of the additional parameter to this visitor's
* methods. Use {@code Void} for visitors that do not need an
* additional parameter.
*
* @since 1.8
*/
public interface DocTreeVisitor<R,P> {
R visitAttribute(AttributeTree node, P p);
R visitAuthor(AuthorTree node, P p);
R visitComment(CommentTree node, P p);
R visitDeprecated(DeprecatedTree node, P p);
R visitDocComment(DocCommentTree node, P p);
R visitDocRoot(DocRootTree node, P p);
R visitEndElement(EndElementTree node, P p);
R visitEntity(EntityTree node, P p);
R visitErroneous(ErroneousTree node, P p);
R visitIdentifier(IdentifierTree node, P p);
R visitInheritDoc(InheritDocTree node, P p);
R visitLink(LinkTree node, P p);
R visitLiteral(LiteralTree node, P p);
R visitParam(ParamTree node, P p);
R visitReference(ReferenceTree node, P p);
R visitReturn(ReturnTree node, P p);
R visitSee(SeeTree node, P p);
R visitSerial(SerialTree node, P p);
R visitSerialData(SerialDataTree node, P p);
R visitSerialField(SerialFieldTree node, P p);
R visitSince(SinceTree node, P p);
R visitStartElement(StartElementTree node, P p);
R visitText(TextTree node, P p);
R visitThrows(ThrowsTree node, P p);
R visitUnknownBlockTag(UnknownBlockTagTree node, P p);
R visitUnknownInlineTag(UnknownInlineTagTree node, P p);
R visitValue(ValueTree node, P p);
R visitVersion(VersionTree node, P p);
R visitOther(DocTree node, P p);
}

View File

@ -0,0 +1,40 @@
/*
* Copyright (c) 2011, 2012, 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.source.doctree;
import javax.lang.model.element.Name;
/**
* A tree node for the end of an HTML element.
*
* <p>
* &lt;/ name &gt;
*
* @since 1.8
*/
public interface EndElementTree extends DocTree {
Name getName();
}

View File

@ -0,0 +1,41 @@
/*
* Copyright (c) 2011, 2012, 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.source.doctree;
import javax.lang.model.element.Name;
/**
* A tree node for an HTML entity.
*
* <p>
* &amp; name ;
*
* @since 1.8
*/
public interface EntityTree extends DocTree {
Name getName();
}

View File

@ -0,0 +1,43 @@
/*
* Copyright (c) 2011, 2012, 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.source.doctree;
import javax.tools.Diagnostic;
import javax.tools.JavaFileObject;
/**
* A tree node to stand in for a malformed text
*
* @since 1.8
*/
public interface ErroneousTree extends TextTree {
/**
* Gets a diagnostic object giving details about
* the reason the body text is in error.
*
* @return a diagnostic
*/
Diagnostic<JavaFileObject> getDiagnostic();
}

View File

@ -0,0 +1,40 @@
/*
* Copyright (c) 2011, 2012, 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.source.doctree;
import javax.lang.model.element.Name;
/**
* An identifier in a documentation comment.
*
* <p>
* name
*
* @since 1.8
*/
public interface IdentifierTree extends DocTree {
Name getName();
}

View File

@ -0,0 +1,37 @@
/*
* Copyright (c) 2011, 2012, 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.source.doctree;
/**
*
* A tree node for an @inheritDoc inline tag.
*
* <p>
* {&#064;inheritDoc}
*
* @since 1.8
*/
public interface InheritDocTree extends InlineTagTree { }

View File

@ -0,0 +1,36 @@
/*
* Copyright (c) 2011, 2012, 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.source.doctree;
/**
* A tree node used as the base class for the different types of
* inline tags.
*
* @since 1.8
*/
public interface InlineTagTree extends DocTree {
String getTagName();
}

View File

@ -0,0 +1,42 @@
/*
* Copyright (c) 2011, 2012, 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.source.doctree;
import java.util.List;
/**
* A tree node for an @link or &#064;linkplain inline tag.
*
* <p>
* {&#064;link reference label} <br>
* {&#064;linkplain reference label }
*
* @since 1.8
*/
public interface LinkTree extends InlineTagTree {
ReferenceTree getReference();
List<? extends DocTree> getLabel();
}

View File

@ -0,0 +1,39 @@
/*
* Copyright (c) 2011, 2012, 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.source.doctree;
/**
*
* A tree node for an @literal or @code inline tag.
*
* <p>
* {&#064;literal text}
*
* @since 1.8
*/
public interface LiteralTree extends InlineTagTree {
TextTree getBody();
}

View File

@ -0,0 +1,42 @@
/*
* Copyright (c) 2011, 2012, 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.source.doctree;
import java.util.List;
/**
* A tree node for an @param block tag.
*
* <p>
* &#064;param parameter-name description
*
* @since 1.8
*/
public interface ParamTree extends BlockTagTree {
boolean isTypeParameter();
IdentifierTree getName();
List<? extends DocTree> getDescription();
}

View File

@ -0,0 +1,38 @@
/*
* Copyright (c) 2011, 2012, 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.source.doctree;
/**
* A tree node to a reference to a Java language element.
*
* <p>
* package.class#field
*
* @since 1.8
*/
public interface ReferenceTree extends DocTree {
String getSignature();
}

View File

@ -0,0 +1,40 @@
/*
* Copyright (c) 2011, 2012, 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.source.doctree;
import java.util.List;
/**
* A tree node for an @return block tag.
*
* <p>
* &#064;return description
*
* @since 1.8
*/
public interface ReturnTree extends BlockTagTree {
List<? extends DocTree> getDescription();
}

View File

@ -0,0 +1,43 @@
/*
* Copyright (c) 2011, 2012, 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.source.doctree;
import java.util.List;
/**
*
* A tree node for an @see block tag.
*
* <p>
* &#064;see "string" <br>
* &#064;see &lt;a href="URL#value"&gt; label &lt;/a&gt; <br>
* &#064;see reference
*
* @since 1.8
*/
public interface SeeTree extends BlockTagTree {
List<? extends DocTree> getReference();
}

View File

@ -0,0 +1,40 @@
/*
* Copyright (c) 2011, 2012, 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.source.doctree;
import java.util.List;
/**
* A tree node for an @serialData block tag.
*
* <p>
* &#064;serialData data-description
*
* @since 1.8
*/
public interface SerialDataTree extends BlockTagTree {
List<? extends DocTree> getDescription();
}

View File

@ -0,0 +1,42 @@
/*
* Copyright (c) 2011, 2012, 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.source.doctree;
import java.util.List;
/**
* A tree node for an @serialData block tag.
*
* <p>
* &#064;serialField field-name field-type field-description
*
* @since 1.8
*/
public interface SerialFieldTree extends BlockTagTree {
IdentifierTree getName();
ReferenceTree getType();
List<? extends DocTree> getDescription();
}

View File

@ -0,0 +1,40 @@
/*
* Copyright (c) 2011, 2012, 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.source.doctree;
import java.util.List;
/**
* A tree node for an @serial block tag.
*
* <p>
* &#064;serial field-description | include | exclude
*
* @since 1.8
*/
public interface SerialTree extends BlockTagTree {
List<? extends DocTree> getDescription();
}

View File

@ -0,0 +1,40 @@
/*
* Copyright (c) 2011, 2012, 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.source.doctree;
import java.util.List;
/**
* A tree node for an @since block tag.
*
* <p>
* &#064;since since-text
*
* @since 1.8
*/
public interface SinceTree extends BlockTagTree {
List<? extends DocTree> getBody();
}

View File

@ -0,0 +1,43 @@
/*
* Copyright (c) 2011, 2012, 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.source.doctree;
import java.util.List;
import javax.lang.model.element.Name;
/**
* A tree node for the start of an HTML element.
*
* <p>
* &lt; name [attributes] [/]&gt;
*
* @since 1.8
*/
public interface StartElementTree extends DocTree {
Name getName();
List<? extends DocTree> getAttributes();
boolean isSelfClosing();
}

View File

@ -0,0 +1,35 @@
/*
* Copyright (c) 2011, 2012, 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.source.doctree;
/**
* A tree node for plain text.
*
* @since 1.8
*/
public interface TextTree extends DocTree {
String getBody();
}

View File

@ -0,0 +1,44 @@
/*
* Copyright (c) 2011, 2012, 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.source.doctree;
import java.util.List;
/**
*
* A tree node for an @exception or &#064;throws block tag.
* &#064;exception is a synonym for &#064;throws.
*
* <p>
* &#064;exception class-name description <br>
* &#064;throws class-name description
*
* @since 1.8
*/
public interface ThrowsTree extends BlockTagTree {
ReferenceTree getExceptionName();
List<? extends DocTree> getDescription();
}

View File

@ -0,0 +1,40 @@
/*
* Copyright (c) 2011, 2012, 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.source.doctree;
import java.util.List;
/**
* A tree node for an unrecognized inline tag.
*
* <p>
* &#064;name content
*
* @since 1.8
*
*/
public interface UnknownBlockTagTree extends BlockTagTree {
List<? extends DocTree> getContent();
}

View File

@ -0,0 +1,40 @@
/*
* Copyright (c) 2011, 2012, 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.source.doctree;
import java.util.List;
/**
* A tree node for an unrecognized inline tag.
*
* <p>
* {&#064;name content}
*
* @since 1.8
*
*/
public interface UnknownInlineTagTree extends InlineTagTree {
List<? extends DocTree> getContent();
}

View File

@ -0,0 +1,38 @@
/*
* Copyright (c) 2011, 2012, 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.source.doctree;
/**
* A tree node for an @value inline tag.
*
* <p>
* { &#064;value reference }
*
* @since 1.8
*/
public interface ValueTree extends InlineTagTree {
ReferenceTree getReference();
}

View File

@ -0,0 +1,41 @@
/*
* Copyright (c) 2011, 2012, 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.source.doctree;
import java.util.List;
/**
*
* A tree node for an @version block tag.
*
* <p>
* &#064;version version-text
*
* @since 1.8
*/
public interface VersionTree extends BlockTagTree {
List<? extends DocTree> getBody();
}

View File

@ -0,0 +1,34 @@
/*
* Copyright (c) 2011, 2012, 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.
*/
/**
* Provides interfaces to represent documentation comments as abstract syntax
* trees (AST).
*
* @author Jonathan Gibbons
* @since 1.8
* @see <a href="http://download.oracle.com/javase/6/docs/technotes/tools/solaris/javadoc.html#javadoctags">http://download.oracle.com/javase/6/docs/technotes/tools/solaris/javadoc.html#javadoctags</a>
*/
package com.sun.source.doctree;

View File

@ -1,5 +1,5 @@
/* /*
* Copyright (c) 2005, 2011, Oracle and/or its affiliates. All rights reserved. * Copyright (c) 2005, 2012, Oracle and/or its affiliates. All rights reserved.
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
* *
* This code is free software; you can redistribute it and/or modify it * This code is free software; you can redistribute it and/or modify it
@ -610,7 +610,7 @@ public interface Tree {
* visitor pattern is used to implement operations on trees. * visitor pattern is used to implement operations on trees.
* *
* @param <R> result type of this operation. * @param <R> result type of this operation.
* @param <D> type of additonal data. * @param <D> type of additional data.
*/ */
<R,D> R accept(TreeVisitor<R,D> visitor, D data); <R,D> R accept(TreeVisitor<R,D> visitor, D data);
} }

View File

@ -0,0 +1,273 @@
/*
* Copyright (c) 2011, 2012, 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.source.util;
import com.sun.source.doctree.*;
/**
* A TreeVisitor that visits all the child tree nodes.
* To visit nodes of a particular type, just override the
* corresponding visitXYZ method.
* Inside your method, call super.visitXYZ to visit descendant
* nodes.
*
* <p>The default implementation of the visitXYZ methods will determine
* a result as follows:
* <ul>
* <li>If the node being visited has no children, the result will be null.
* <li>If the node being visited has one child, the result will be the
* result of calling {@code scan} on that child. The child may be a simple node
* or itself a list of nodes.
* <li> If the node being visited has more than one child, the result will
* be determined by calling {@code scan} each child in turn, and then combining the
* result of each scan after the first with the cumulative result
* so far, as determined by the {@link #reduce} method. Each child may be either
* a simple node of a list of nodes. The default behavior of the {@code reduce}
* method is such that the result of the visitXYZ method will be the result of
* the last child scanned.
* </ul>
*
* <p>Here is an example to count the number of erroneous nodes in a tree:
* <pre>
* class CountErrors extends DocTreeScanner<Integer,Void> {
* {@literal @}Override
* public Integer visitErroneous(ErroneousTree node, Void p) {
* return 1;
* }
* {@literal @}Override
* public Integer reduce(Integer r1, Integer r2) {
* return (r1 == null ? 0 : r1) + (r2 == null ? 0 : r2);
* }
* }
* </pre>
*
* @since 1.8
*/
public class DocTreeScanner<R,P> implements DocTreeVisitor<R,P> {
/**
* Scan a single node.
*/
public R scan(DocTree node, P p) {
return (node == null) ? null : node.accept(this, p);
}
private R scanAndReduce(DocTree node, P p, R r) {
return reduce(scan(node, p), r);
}
/**
* Scan a list of nodes.
*/
public R scan(Iterable<? extends DocTree> nodes, P p) {
R r = null;
if (nodes != null) {
boolean first = true;
for (DocTree node : nodes) {
r = (first ? scan(node, p) : scanAndReduce(node, p, r));
first = false;
}
}
return r;
}
private R scanAndReduce(Iterable<? extends DocTree> nodes, P p, R r) {
return reduce(scan(nodes, p), r);
}
/**
* Reduces two results into a combined result.
* The default implementation is to return the first parameter.
* The general contract of the method is that it may take any action whatsoever.
*/
public R reduce(R r1, R r2) {
return r1;
}
/* ***************************************************************************
* Visitor methods
****************************************************************************/
@Override
public R visitAttribute(AttributeTree node, P p) {
return null;
}
@Override
public R visitAuthor(AuthorTree node, P p) {
return scan(node.getName(), p);
}
@Override
public R visitComment(CommentTree node, P p) {
return null;
}
@Override
public R visitDeprecated(DeprecatedTree node, P p) {
return scan(node.getBody(), p);
}
@Override
public R visitDocComment(DocCommentTree node, P p) {
R r = scan(node.getFirstSentence(), p);
r = scanAndReduce(node.getBody(), p, r);
r = scanAndReduce(node.getBlockTags(), p, r);
return r;
}
@Override
public R visitDocRoot(DocRootTree node, P p) {
return null;
}
@Override
public R visitEndElement(EndElementTree node, P p) {
return null;
}
@Override
public R visitEntity(EntityTree node, P p) {
return null;
}
@Override
public R visitErroneous(ErroneousTree node, P p) {
return null;
}
@Override
public R visitIdentifier(IdentifierTree node, P p) {
return null;
}
@Override
public R visitInheritDoc(InheritDocTree node, P p) {
return null;
}
@Override
public R visitLink(LinkTree node, P p) {
R r = scan(node.getReference(), p);
r = scanAndReduce(node.getLabel(), p, r);
return r;
}
@Override
public R visitLiteral(LiteralTree node, P p) {
return null;
}
@Override
public R visitParam(ParamTree node, P p) {
R r = scan(node.getName(), p);
r = scanAndReduce(node.getDescription(), p, r);
return r;
}
@Override
public R visitReference(ReferenceTree node, P p) {
return null;
}
@Override
public R visitReturn(ReturnTree node, P p) {
return scan(node.getDescription(), p);
}
@Override
public R visitSee(SeeTree node, P p) {
return scan(node.getReference(), p);
}
@Override
public R visitSerial(SerialTree node, P p) {
return scan(node.getDescription(), p);
}
@Override
public R visitSerialData(SerialDataTree node, P p) {
return scan(node.getDescription(), p);
}
@Override
public R visitSerialField(SerialFieldTree node, P p) {
R r = scan(node.getName(), p);
r = scanAndReduce(node.getType(), p, r);
r = scanAndReduce(node.getDescription(), p, r);
return r;
}
@Override
public R visitSince(SinceTree node, P p) {
return scan(node.getBody(), p);
}
@Override
public R visitStartElement(StartElementTree node, P p) {
return scan(node.getAttributes(), p);
}
@Override
public R visitText(TextTree node, P p) {
return null;
}
@Override
public R visitThrows(ThrowsTree node, P p) {
R r = scan(node.getExceptionName(), p);
r = scanAndReduce(node.getDescription(), p, r);
return r;
}
@Override
public R visitUnknownBlockTag(UnknownBlockTagTree node, P p) {
return scan(node.getContent(), p);
}
@Override
public R visitUnknownInlineTag(UnknownInlineTagTree node, P p) {
return scan(node.getContent(), p);
}
@Override
public R visitValue(ValueTree node, P p) {
return scan(node.getReference(), p);
}
@Override
public R visitVersion(VersionTree node, P p) {
return scan(node.getBody(), p);
}
@Override
public R visitOther(DocTree node, P p) {
return null;
}
}

View File

@ -0,0 +1,89 @@
/*
* Copyright (c) 2011, 2012, 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.source.util;
import javax.annotation.processing.ProcessingEnvironment;
import javax.lang.model.element.Element;
import javax.tools.JavaCompiler.CompilationTask;
import com.sun.source.doctree.DocCommentTree;
import com.sun.source.doctree.ReferenceTree;
import javax.tools.Diagnostic;
/**
* Provides access to syntax trees for doc comments.
*
* @since 1.8
*/
public abstract class DocTrees extends Trees {
/**
* Gets a DocTrees object for a given CompilationTask.
* @param task the compilation task for which to get the Trees object
* @throws IllegalArgumentException if the task does not support the Trees API.
*/
public static DocTrees instance(CompilationTask task) {
if (!task.getClass().getName().equals("com.sun.tools.javac.api.JavacTaskImpl"))
throw new IllegalArgumentException();
return (DocTrees) getJavacTrees(CompilationTask.class, task);
}
/**
* Gets a DocTrees object for a given ProcessingEnvironment.
* @param env the processing environment for which to get the Trees object
* @throws IllegalArgumentException if the env does not support the Trees API.
*/
public static DocTrees instance(ProcessingEnvironment env) {
if (!env.getClass().getName().equals("com.sun.tools.javac.processing.JavacProcessingEnvironment"))
throw new IllegalArgumentException();
return (DocTrees) getJavacTrees(ProcessingEnvironment.class, env);
}
/**
* Gets the doc comment tree, if any, for the Tree node identified by a given TreePath.
* Returns null if no doc comment was found.
*/
public abstract DocCommentTree getDocCommentTree(TreePath path);
/**
* Gets the language model element referred to by a ReferenceTree that
* appears on the declaration identified by the given path.
*/
public abstract Element getElement(TreePath path, ReferenceTree reference);
/**
* Prints a message of the specified kind at the location of the
* tree within the provided compilation unit
*
* @param kind the kind of message
* @param msg the message, or an empty string if none
* @param t the tree to use as a position hint
* @param root the compilation unit that contains tree
*/
public abstract void printMessage(Diagnostic.Kind kind, CharSequence msg,
com.sun.source.doctree.DocTree t,
com.sun.source.doctree.DocCommentTree c,
com.sun.source.tree.CompilationUnitTree root);
}

View File

@ -0,0 +1,64 @@
/*
* Copyright (c) 2005, 2012, 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.source.util;
import java.util.ServiceLoader;
import javax.tools.StandardLocation;
/**
* The interface for a javac plug-in.
*
* <p>The javac plug-in mechanism allows a user to specify one or more plug-ins
* on the javac command line, to be started soon after the compilation
* has begun. Plug-ins are identified by a user-friendly name. Each plug-in that
* is started will be passed an array of strings, which may be used to
* provide the plug-in with values for any desired options or other arguments.
*
* <p>Plug-ins are located via a {@link ServiceLoader},
* using the same class path as annotation processors (i.e.
* {@link StandardLocation#PROCESSOR_PATH PROCESSOR_PATH} or
* {@code -processorpath}).
*
* <p>It is expected that a typical plug-in will simply register a
* {@link TaskListener} to be informed of events during the execution
* of the compilation, and that the rest of the work will be done
* by the task listener.
*
* @since 1.8
*/
public interface Plugin {
/**
* Get the user-friendly name of this plug-in.
* @return the user-friendly name of the plug-in
*/
String getName();
/**
* Invoke the plug-in for a given compilation task.
* @param task The compilation task that has just been started
* @param args Arguments, if any, for the plug-in
*/
void call(JavacTask task, String... args);
}

View File

@ -0,0 +1,179 @@
/*
* Copyright (c) 2005, 2012, 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.source.util;
import com.sun.source.doctree.*;
/**
* A simple visitor for tree nodes.
*
* @since 1.8
*/
public class SimpleDocTreeVisitor<R,P> implements DocTreeVisitor<R, P> {
protected final R DEFAULT_VALUE;
protected SimpleDocTreeVisitor() {
DEFAULT_VALUE = null;
}
protected SimpleDocTreeVisitor(R defaultValue) {
DEFAULT_VALUE = defaultValue;
}
protected R defaultAction(DocTree node, P p) {
return DEFAULT_VALUE;
}
public final R visit(DocTree node, P p) {
return (node == null) ? null : node.accept(this, p);
}
public final R visit(Iterable<? extends DocTree> nodes, P p) {
R r = null;
if (nodes != null) {
for (DocTree node : nodes)
r = visit(node, p);
}
return r;
}
public R visitAttribute(AttributeTree node, P p) {
return defaultAction(node, p);
}
public R visitAuthor(AuthorTree node, P p) {
return defaultAction(node, p);
}
public R visitComment(CommentTree node, P p) {
return defaultAction(node, p);
}
public R visitDeprecated(DeprecatedTree node, P p) {
return defaultAction(node, p);
}
public R visitDocComment(DocCommentTree node, P p) {
return defaultAction(node, p);
}
public R visitDocRoot(DocRootTree node, P p) {
return defaultAction(node, p);
}
public R visitEndElement(EndElementTree node, P p) {
return defaultAction(node, p);
}
public R visitEntity(EntityTree node, P p) {
return defaultAction(node, p);
}
public R visitErroneous(ErroneousTree node, P p) {
return defaultAction(node, p);
}
public R visitIdentifier(IdentifierTree node, P p) {
return defaultAction(node, p);
}
public R visitInheritDoc(InheritDocTree node, P p) {
return defaultAction(node, p);
}
public R visitLink(LinkTree node, P p) {
return defaultAction(node, p);
}
public R visitLiteral(LiteralTree node, P p) {
return defaultAction(node, p);
}
public R visitParam(ParamTree node, P p) {
return defaultAction(node, p);
}
public R visitReference(ReferenceTree node, P p) {
return defaultAction(node, p);
}
public R visitReturn(ReturnTree node, P p) {
return defaultAction(node, p);
}
public R visitSee(SeeTree node, P p) {
return defaultAction(node, p);
}
public R visitSerial(SerialTree node, P p) {
return defaultAction(node, p);
}
public R visitSerialData(SerialDataTree node, P p) {
return defaultAction(node, p);
}
public R visitSerialField(SerialFieldTree node, P p) {
return defaultAction(node, p);
}
public R visitSince(SinceTree node, P p) {
return defaultAction(node, p);
}
public R visitStartElement(StartElementTree node, P p) {
return defaultAction(node, p);
}
public R visitText(TextTree node, P p) {
return defaultAction(node, p);
}
public R visitThrows(ThrowsTree node, P p) {
return defaultAction(node, p);
}
public R visitUnknownBlockTag(UnknownBlockTagTree node, P p) {
return defaultAction(node, p);
}
public R visitUnknownInlineTag(UnknownInlineTagTree node, P p) {
return defaultAction(node, p);
}
public R visitValue(ValueTree node, P p) {
return defaultAction(node, p);
}
public R visitVersion(VersionTree node, P p) {
return defaultAction(node, p);
}
public R visitOther(DocTree node, P p) {
return defaultAction(node, p);
}
}

View File

@ -1,5 +1,5 @@
/* /*
* Copyright (c) 2005, 2011, Oracle and/or its affiliates. All rights reserved. * Copyright (c) 2005, 2012, Oracle and/or its affiliates. All rights reserved.
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
* *
* This code is free software; you can redistribute it and/or modify it * This code is free software; you can redistribute it and/or modify it
@ -26,6 +26,7 @@
package com.sun.source.util; package com.sun.source.util;
import java.lang.reflect.Method; import java.lang.reflect.Method;
import javax.annotation.processing.ProcessingEnvironment; import javax.annotation.processing.ProcessingEnvironment;
import javax.lang.model.element.AnnotationMirror; import javax.lang.model.element.AnnotationMirror;
import javax.lang.model.element.AnnotationValue; import javax.lang.model.element.AnnotationValue;
@ -57,7 +58,9 @@ public abstract class Trees {
* @throws IllegalArgumentException if the task does not support the Trees API. * @throws IllegalArgumentException if the task does not support the Trees API.
*/ */
public static Trees instance(CompilationTask task) { public static Trees instance(CompilationTask task) {
if (!task.getClass().getName().equals("com.sun.tools.javac.api.JavacTaskImpl")) String taskClassName = task.getClass().getName();
if (!taskClassName.equals("com.sun.tools.javac.api.JavacTaskImpl")
&& !taskClassName.equals("com.sun.tools.javac.api.BasicJavacTask"))
throw new IllegalArgumentException(); throw new IllegalArgumentException();
return getJavacTrees(CompilationTask.class, task); return getJavacTrees(CompilationTask.class, task);
} }
@ -73,7 +76,7 @@ public abstract class Trees {
return getJavacTrees(ProcessingEnvironment.class, env); return getJavacTrees(ProcessingEnvironment.class, env);
} }
private static Trees getJavacTrees(Class<?> argType, Object arg) { static Trees getJavacTrees(Class<?> argType, Object arg) {
try { try {
ClassLoader cl = arg.getClass().getClassLoader(); ClassLoader cl = arg.getClass().getClassLoader();
Class<?> c = Class.forName("com.sun.tools.javac.api.JavacTrees", false, cl); Class<?> c = Class.forName("com.sun.tools.javac.api.JavacTrees", false, cl);
@ -168,6 +171,7 @@ public abstract class Trees {
/** /**
* Gets the doc comment, if any, for the Tree node identified by a given TreePath. * Gets the doc comment, if any, for the Tree node identified by a given TreePath.
* Returns null if no doc comment was found. * Returns null if no doc comment was found.
* @see DocTrees#getDocCommentTree(TreePath)
*/ */
public abstract String getDocComment(TreePath path); public abstract String getDocComment(TreePath path);

View File

@ -45,7 +45,7 @@ import com.sun.tools.doclets.internal.toolkit.util.*;
public abstract class AbstractExecutableMemberWriter extends AbstractMemberWriter { public abstract class AbstractExecutableMemberWriter extends AbstractMemberWriter {
public AbstractExecutableMemberWriter(SubWriterHolderWriter writer, public AbstractExecutableMemberWriter(SubWriterHolderWriter writer,
ClassDoc classdoc) { ClassDoc classdoc) {
super(writer, classdoc); super(writer, classdoc);
} }
@ -61,7 +61,7 @@ public abstract class AbstractExecutableMemberWriter extends AbstractMemberWrite
* @return the display length required to write this information. * @return the display length required to write this information.
*/ */
protected int addTypeParameters(ExecutableMemberDoc member, Content htmltree) { protected int addTypeParameters(ExecutableMemberDoc member, Content htmltree) {
LinkInfoImpl linkInfo = new LinkInfoImpl( LinkInfoImpl linkInfo = new LinkInfoImpl(configuration,
LinkInfoImpl.CONTEXT_MEMBER_TYPE_PARAMS, member, false); LinkInfoImpl.CONTEXT_MEMBER_TYPE_PARAMS, member, false);
String typeParameters = writer.getTypeParameterLinks(linkInfo); String typeParameters = writer.getTypeParameterLinks(linkInfo);
if (linkInfo.displayLength > 0) { if (linkInfo.displayLength > 0) {
@ -129,8 +129,8 @@ public abstract class AbstractExecutableMemberWriter extends AbstractMemberWrite
boolean isVarArg, Content tree) { boolean isVarArg, Content tree) {
if (param.type() != null) { if (param.type() != null) {
Content link = new RawHtml(writer.getLink(new LinkInfoImpl( Content link = new RawHtml(writer.getLink(new LinkInfoImpl(
LinkInfoImpl.CONTEXT_EXECUTABLE_MEMBER_PARAM, param.type(), configuration, LinkInfoImpl.CONTEXT_EXECUTABLE_MEMBER_PARAM,
isVarArg))); param.type(), isVarArg)));
tree.addContent(link); tree.addContent(link);
} }
if(param.name().length() > 0) { if(param.name().length() > 0) {
@ -161,7 +161,7 @@ public abstract class AbstractExecutableMemberWriter extends AbstractMemberWrite
htmltree.addContent("("); htmltree.addContent("(");
Parameter[] params = member.parameters(); Parameter[] params = member.parameters();
String indent = makeSpace(writer.displayLength); String indent = makeSpace(writer.displayLength);
if (configuration().linksource) { if (configuration.linksource) {
//add spaces to offset indentation changes caused by link. //add spaces to offset indentation changes caused by link.
indent+= makeSpace(member.name().length()); indent+= makeSpace(member.name().length());
} }
@ -212,7 +212,7 @@ public abstract class AbstractExecutableMemberWriter extends AbstractMemberWrite
protected void addExceptions(ExecutableMemberDoc member, Content htmltree) { protected void addExceptions(ExecutableMemberDoc member, Content htmltree) {
Type[] exceptions = member.thrownExceptionTypes(); Type[] exceptions = member.thrownExceptionTypes();
if(exceptions.length > 0) { if(exceptions.length > 0) {
LinkInfoImpl memberTypeParam = new LinkInfoImpl( LinkInfoImpl memberTypeParam = new LinkInfoImpl(configuration,
LinkInfoImpl.CONTEXT_MEMBER, member, false); LinkInfoImpl.CONTEXT_MEMBER, member, false);
int retlen = getReturnTypeLength(member); int retlen = getReturnTypeLength(member);
writer.getTypeParameterLinks(memberTypeParam); writer.getTypeParameterLinks(memberTypeParam);
@ -224,7 +224,7 @@ public abstract class AbstractExecutableMemberWriter extends AbstractMemberWrite
htmltree.addContent(indent); htmltree.addContent(indent);
htmltree.addContent("throws "); htmltree.addContent("throws ");
indent += " "; indent += " ";
Content link = new RawHtml(writer.getLink(new LinkInfoImpl( Content link = new RawHtml(writer.getLink(new LinkInfoImpl(configuration,
LinkInfoImpl.CONTEXT_MEMBER, exceptions[0]))); LinkInfoImpl.CONTEXT_MEMBER, exceptions[0])));
htmltree.addContent(link); htmltree.addContent(link);
for(int i = 1; i < exceptions.length; i++) { for(int i = 1; i < exceptions.length; i++) {
@ -232,7 +232,7 @@ public abstract class AbstractExecutableMemberWriter extends AbstractMemberWrite
htmltree.addContent(DocletConstants.NL); htmltree.addContent(DocletConstants.NL);
htmltree.addContent(indent); htmltree.addContent(indent);
Content exceptionLink = new RawHtml(writer.getLink(new LinkInfoImpl( Content exceptionLink = new RawHtml(writer.getLink(new LinkInfoImpl(
LinkInfoImpl.CONTEXT_MEMBER, exceptions[i]))); configuration, LinkInfoImpl.CONTEXT_MEMBER, exceptions[i])));
htmltree.addContent(exceptionLink); htmltree.addContent(exceptionLink);
} }
} }
@ -246,7 +246,7 @@ public abstract class AbstractExecutableMemberWriter extends AbstractMemberWrite
return rettype.typeName().length() + return rettype.typeName().length() +
rettype.dimension().length(); rettype.dimension().length();
} else { } else {
LinkInfoImpl linkInfo = new LinkInfoImpl( LinkInfoImpl linkInfo = new LinkInfoImpl(configuration,
LinkInfoImpl.CONTEXT_MEMBER, rettype); LinkInfoImpl.CONTEXT_MEMBER, rettype);
writer.getLink(linkInfo); writer.getLink(linkInfo);
return linkInfo.displayLength; return linkInfo.displayLength;

View File

@ -140,7 +140,8 @@ public class AbstractIndexWriter extends HtmlDocletWriter {
*/ */
protected void addDescription(ClassDoc cd, Content dlTree) { protected void addDescription(ClassDoc cd, Content dlTree) {
Content link = new RawHtml( Content link = new RawHtml(
getLink(new LinkInfoImpl(LinkInfoImpl.CONTEXT_INDEX, cd, true))); getLink(new LinkInfoImpl(configuration,
LinkInfoImpl.CONTEXT_INDEX, cd, true)));
Content dt = HtmlTree.DT(link); Content dt = HtmlTree.DT(link);
dt.addContent(" - "); dt.addContent(" - ");
addClassInfo(cd, dt); addClassInfo(cd, dt);

View File

@ -49,15 +49,20 @@ import com.sun.tools.doclets.internal.toolkit.util.*;
*/ */
public abstract class AbstractMemberWriter { public abstract class AbstractMemberWriter {
protected boolean printedSummaryHeader = false; protected final ConfigurationImpl configuration;
protected final SubWriterHolderWriter writer; protected final SubWriterHolderWriter writer;
protected final ClassDoc classdoc; protected final ClassDoc classdoc;
protected Map<String,Integer> typeMap = new LinkedHashMap<String,Integer>();
protected Set<MethodTypes> methodTypes = EnumSet.noneOf(MethodTypes.class);
private int methodTypesOr = 0;
public final boolean nodepr; public final boolean nodepr;
public AbstractMemberWriter(SubWriterHolderWriter writer, protected boolean printedSummaryHeader = false;
ClassDoc classdoc) {
public AbstractMemberWriter(SubWriterHolderWriter writer, ClassDoc classdoc) {
this.configuration = writer.configuration;
this.writer = writer; this.writer = writer;
this.nodepr = configuration().nodeprecated; this.nodepr = configuration.nodeprecated;
this.classdoc = classdoc; this.classdoc = classdoc;
} }
@ -281,11 +286,11 @@ public abstract class AbstractMemberWriter {
code.addContent(new HtmlTree(HtmlTag.BR)); code.addContent(new HtmlTree(HtmlTag.BR));
} }
code.addContent(new RawHtml( code.addContent(new RawHtml(
writer.getLink(new LinkInfoImpl( writer.getLink(new LinkInfoImpl(configuration,
LinkInfoImpl.CONTEXT_SUMMARY_RETURN_TYPE, type)))); LinkInfoImpl.CONTEXT_SUMMARY_RETURN_TYPE, type))));
} else { } else {
code.addContent(new RawHtml( code.addContent(new RawHtml(
writer.getLink(new LinkInfoImpl( writer.getLink(new LinkInfoImpl(configuration,
LinkInfoImpl.CONTEXT_SUMMARY_RETURN_TYPE, type)))); LinkInfoImpl.CONTEXT_SUMMARY_RETURN_TYPE, type))));
} }
@ -305,7 +310,7 @@ public abstract class AbstractMemberWriter {
} else if (member.isPrivate()) { } else if (member.isPrivate()) {
code.addContent("private "); code.addContent("private ");
} else if (!member.isPublic()) { // Package private } else if (!member.isPublic()) { // Package private
code.addContent(configuration().getText("doclet.Package_private")); code.addContent(configuration.getText("doclet.Package_private"));
code.addContent(" "); code.addContent(" ");
} }
if (member.isMethod() && ((MethodDoc)member).isAbstract()) { if (member.isMethod() && ((MethodDoc)member).isAbstract()) {
@ -389,7 +394,7 @@ public abstract class AbstractMemberWriter {
String tableSummary, String[] tableHeader, Content contentTree) { String tableSummary, String[] tableHeader, Content contentTree) {
if (deprmembers.size() > 0) { if (deprmembers.size() > 0) {
Content table = HtmlTree.TABLE(0, 3, 0, tableSummary, Content table = HtmlTree.TABLE(0, 3, 0, tableSummary,
writer.getTableCaption(configuration().getText(headingKey))); writer.getTableCaption(configuration.getText(headingKey)));
table.addContent(writer.getSummaryTableHeader(tableHeader, "col")); table.addContent(writer.getSummaryTableHeader(tableHeader, "col"));
Content tbody = new HtmlTree(HtmlTag.TBODY); Content tbody = new HtmlTree(HtmlTag.TBODY);
for (int i = 0; i < deprmembers.size(); i++) { for (int i = 0; i < deprmembers.size(); i++) {
@ -507,8 +512,8 @@ public abstract class AbstractMemberWriter {
} }
protected void serialWarning(SourcePosition pos, String key, String a1, String a2) { protected void serialWarning(SourcePosition pos, String key, String a1, String a2) {
if (configuration().serialwarn) { if (configuration.serialwarn) {
ConfigurationImpl.getInstance().getDocletSpecificMsg().warning(pos, key, a1, a2); configuration.getDocletSpecificMsg().warning(pos, key, a1, a2);
} }
} }
@ -516,21 +521,17 @@ public abstract class AbstractMemberWriter {
return nodepr? Util.excludeDeprecatedMembers(members): members; return nodepr? Util.excludeDeprecatedMembers(members): members;
} }
public ConfigurationImpl configuration() {
return writer.configuration;
}
/** /**
* Add the member summary for the given class. * Add the member summary for the given class.
* *
* @param classDoc the class that is being documented * @param classDoc the class that is being documented
* @param member the member being documented * @param member the member being documented
* @param firstSentenceTags the first sentence tags to be added to the summary * @param firstSentenceTags the first sentence tags to be added to the summary
* @param tableTree the content tree to which the documentation will be added * @param tableContents the list of contents to which the documentation will be added
* @param counter the counter for determing style for the table row * @param counter the counter for determining id and style for the table row
*/ */
public void addMemberSummary(ClassDoc classDoc, ProgramElementDoc member, public void addMemberSummary(ClassDoc classDoc, ProgramElementDoc member,
Tag[] firstSentenceTags, Content tableTree, int counter) { Tag[] firstSentenceTags, List<Content> tableContents, int counter) {
HtmlTree tdSummaryType = new HtmlTree(HtmlTag.TD); HtmlTree tdSummaryType = new HtmlTree(HtmlTag.TD);
tdSummaryType.addStyle(HtmlStyle.colFirst); tdSummaryType.addStyle(HtmlStyle.colFirst);
writer.addSummaryType(this, member, tdSummaryType); writer.addSummaryType(this, member, tdSummaryType);
@ -540,11 +541,46 @@ public abstract class AbstractMemberWriter {
writer.addSummaryLinkComment(this, member, firstSentenceTags, tdSummary); writer.addSummaryLinkComment(this, member, firstSentenceTags, tdSummary);
HtmlTree tr = HtmlTree.TR(tdSummaryType); HtmlTree tr = HtmlTree.TR(tdSummaryType);
tr.addContent(tdSummary); tr.addContent(tdSummary);
if (member instanceof MethodDoc && !member.isAnnotationTypeElement()) {
int methodType = (member.isStatic()) ? MethodTypes.STATIC.value() :
MethodTypes.INSTANCE.value();
methodType = (classdoc.isInterface() || ((MethodDoc)member).isAbstract()) ?
methodType | MethodTypes.ABSTRACT.value() :
methodType | MethodTypes.CONCRETE.value();
if (Util.isDeprecated(member) || Util.isDeprecated(classdoc)) {
methodType = methodType | MethodTypes.DEPRECATED.value();
}
methodTypesOr = methodTypesOr | methodType;
String tableId = "i" + counter;
typeMap.put(tableId, methodType);
tr.addAttr(HtmlAttr.ID, tableId);
}
if (counter%2 == 0) if (counter%2 == 0)
tr.addStyle(HtmlStyle.altColor); tr.addStyle(HtmlStyle.altColor);
else else
tr.addStyle(HtmlStyle.rowColor); tr.addStyle(HtmlStyle.rowColor);
tableTree.addContent(tr); tableContents.add(tr);
}
/**
* Generate the method types set and return true if the method summary table
* needs to show tabs.
*
* @return true if the table should show tabs
*/
public boolean showTabs() {
int value;
for (MethodTypes type : EnumSet.allOf(MethodTypes.class)) {
value = type.value();
if ((value & methodTypesOr) == value) {
methodTypes.add(type);
}
}
boolean showTabs = methodTypes.size() > 1;
if (showTabs) {
methodTypes.add(MethodTypes.ALL);
}
return showTabs;
} }
/** /**
@ -597,10 +633,11 @@ public abstract class AbstractMemberWriter {
* Get the summary table tree for the given class. * Get the summary table tree for the given class.
* *
* @param classDoc the class for which the summary table is generated * @param classDoc the class for which the summary table is generated
* @param tableContents list of contents to be displayed in the summary table
* @return a content tree for the summary table * @return a content tree for the summary table
*/ */
public Content getSummaryTableTree(ClassDoc classDoc) { public Content getSummaryTableTree(ClassDoc classDoc, List<Content> tableContents) {
return writer.getSummaryTableTree(this, classDoc); return writer.getSummaryTableTree(this, classDoc, tableContents, showTabs());
} }
/** /**

View File

@ -138,7 +138,7 @@ public abstract class AbstractTreeWriter extends HtmlDocletWriter {
for (int i = 0; i < interfaces.length; i++) { for (int i = 0; i < interfaces.length; i++) {
if (parent != interfaces[i]) { if (parent != interfaces[i]) {
if (! (interfaces[i].isPublic() || if (! (interfaces[i].isPublic() ||
Util.isLinkable(interfaces[i], configuration()))) { Util.isLinkable(interfaces[i], configuration))) {
continue; continue;
} }
if (counter == 0) { if (counter == 0) {

View File

@ -159,10 +159,11 @@ public class AllClassesFrameWriter extends HtmlDocletWriter {
String label = italicsClassName(cd, false); String label = italicsClassName(cd, false);
Content linkContent; Content linkContent;
if(wantFrames){ if(wantFrames){
linkContent = new RawHtml(getLink(new LinkInfoImpl( linkContent = new RawHtml(getLink(new LinkInfoImpl(configuration,
LinkInfoImpl.ALL_CLASSES_FRAME, cd, label, "classFrame"))); LinkInfoImpl.ALL_CLASSES_FRAME, cd, label, "classFrame")));
} else { } else {
linkContent = new RawHtml(getLink(new LinkInfoImpl(cd, label))); linkContent = new RawHtml(getLink(new LinkInfoImpl(
configuration, cd, label)));
} }
Content li = HtmlTree.LI(linkContent); Content li = HtmlTree.LI(linkContent);
content.addContent(li); content.addContent(li);

View File

@ -103,16 +103,16 @@ public class AnnotationTypeOptionalMemberWriterImpl extends
* {@inheritDoc} * {@inheritDoc}
*/ */
public String getTableSummary() { public String getTableSummary() {
return configuration().getText("doclet.Member_Table_Summary", return configuration.getText("doclet.Member_Table_Summary",
configuration().getText("doclet.Annotation_Type_Optional_Member_Summary"), configuration.getText("doclet.Annotation_Type_Optional_Member_Summary"),
configuration().getText("doclet.annotation_type_optional_members")); configuration.getText("doclet.annotation_type_optional_members"));
} }
/** /**
* {@inheritDoc} * {@inheritDoc}
*/ */
public String getCaption() { public String getCaption() {
return configuration().getText("doclet.Annotation_Type_Optional_Members"); return configuration.getText("doclet.Annotation_Type_Optional_Members");
} }
/** /**
@ -121,9 +121,9 @@ public class AnnotationTypeOptionalMemberWriterImpl extends
public String[] getSummaryTableHeader(ProgramElementDoc member) { public String[] getSummaryTableHeader(ProgramElementDoc member) {
String[] header = new String[] { String[] header = new String[] {
writer.getModifierTypeHeader(), writer.getModifierTypeHeader(),
configuration().getText("doclet.0_and_1", configuration.getText("doclet.0_and_1",
configuration().getText("doclet.Annotation_Type_Optional_Member"), configuration.getText("doclet.Annotation_Type_Optional_Member"),
configuration().getText("doclet.Description")) configuration.getText("doclet.Description"))
}; };
return header; return header;
} }

View File

@ -52,7 +52,7 @@ public class AnnotationTypeRequiredMemberWriterImpl extends AbstractMemberWriter
* @param annotationType the AnnotationType that holds this member. * @param annotationType the AnnotationType that holds this member.
*/ */
public AnnotationTypeRequiredMemberWriterImpl(SubWriterHolderWriter writer, public AnnotationTypeRequiredMemberWriterImpl(SubWriterHolderWriter writer,
AnnotationTypeDoc annotationType) { AnnotationTypeDoc annotationType) {
super(writer, annotationType); super(writer, annotationType);
} }
@ -106,11 +106,11 @@ public class AnnotationTypeRequiredMemberWriterImpl extends AbstractMemberWriter
writer.addAnnotationInfo(member, pre); writer.addAnnotationInfo(member, pre);
addModifiers(member, pre); addModifiers(member, pre);
Content link = new RawHtml( Content link = new RawHtml(
writer.getLink(new LinkInfoImpl(LinkInfoImpl.CONTEXT_MEMBER, writer.getLink(new LinkInfoImpl(configuration,
getType(member)))); LinkInfoImpl.CONTEXT_MEMBER, getType(member))));
pre.addContent(link); pre.addContent(link);
pre.addContent(writer.getSpace()); pre.addContent(writer.getSpace());
if (configuration().linksource) { if (configuration.linksource) {
Content memberName = new StringContent(member.name()); Content memberName = new StringContent(member.name());
writer.addSrcLink(member, memberName, pre); writer.addSrcLink(member, memberName, pre);
} else { } else {
@ -175,16 +175,16 @@ public class AnnotationTypeRequiredMemberWriterImpl extends AbstractMemberWriter
* {@inheritDoc} * {@inheritDoc}
*/ */
public String getTableSummary() { public String getTableSummary() {
return configuration().getText("doclet.Member_Table_Summary", return configuration.getText("doclet.Member_Table_Summary",
configuration().getText("doclet.Annotation_Type_Required_Member_Summary"), configuration.getText("doclet.Annotation_Type_Required_Member_Summary"),
configuration().getText("doclet.annotation_type_required_members")); configuration.getText("doclet.annotation_type_required_members"));
} }
/** /**
* {@inheritDoc} * {@inheritDoc}
*/ */
public String getCaption() { public String getCaption() {
return configuration().getText("doclet.Annotation_Type_Required_Members"); return configuration.getText("doclet.Annotation_Type_Required_Members");
} }
/** /**
@ -193,9 +193,9 @@ public class AnnotationTypeRequiredMemberWriterImpl extends AbstractMemberWriter
public String[] getSummaryTableHeader(ProgramElementDoc member) { public String[] getSummaryTableHeader(ProgramElementDoc member) {
String[] header = new String[] { String[] header = new String[] {
writer.getModifierTypeHeader(), writer.getModifierTypeHeader(),
configuration().getText("doclet.0_and_1", configuration.getText("doclet.0_and_1",
configuration().getText("doclet.Annotation_Type_Required_Member"), configuration.getText("doclet.Annotation_Type_Required_Member"),
configuration().getText("doclet.Description")) configuration.getText("doclet.Description"))
}; };
return header; return header;
} }

View File

@ -65,10 +65,10 @@ public class AnnotationTypeWriterImpl extends SubWriterHolderWriter
* @param prevType the previous class that was documented. * @param prevType the previous class that was documented.
* @param nextType the next class being documented. * @param nextType the next class being documented.
*/ */
public AnnotationTypeWriterImpl(AnnotationTypeDoc annotationType, public AnnotationTypeWriterImpl(ConfigurationImpl configuration,
Type prevType, Type nextType) AnnotationTypeDoc annotationType, Type prevType, Type nextType)
throws Exception { throws Exception {
super(ConfigurationImpl.getInstance(), DocPath.forClass(annotationType)); super(configuration, DocPath.forClass(annotationType));
this.annotationType = annotationType; this.annotationType = annotationType;
configuration.currentcd = annotationType.asClassDoc(); configuration.currentcd = annotationType.asClassDoc();
this.prev = prevType; this.prev = prevType;
@ -116,7 +116,7 @@ public class AnnotationTypeWriterImpl extends SubWriterHolderWriter
public Content getNavLinkPrevious() { public Content getNavLinkPrevious() {
Content li; Content li;
if (prev != null) { if (prev != null) {
Content prevLink = new RawHtml(getLink(new LinkInfoImpl( Content prevLink = new RawHtml(getLink(new LinkInfoImpl(configuration,
LinkInfoImpl.CONTEXT_CLASS, prev.asClassDoc(), "", LinkInfoImpl.CONTEXT_CLASS, prev.asClassDoc(), "",
configuration.getText("doclet.Prev_Class"), true))); configuration.getText("doclet.Prev_Class"), true)));
li = HtmlTree.LI(prevLink); li = HtmlTree.LI(prevLink);
@ -134,7 +134,7 @@ public class AnnotationTypeWriterImpl extends SubWriterHolderWriter
public Content getNavLinkNext() { public Content getNavLinkNext() {
Content li; Content li;
if (next != null) { if (next != null) {
Content nextLink = new RawHtml(getLink(new LinkInfoImpl( Content nextLink = new RawHtml(getLink(new LinkInfoImpl(configuration,
LinkInfoImpl.CONTEXT_CLASS, next.asClassDoc(), "", LinkInfoImpl.CONTEXT_CLASS, next.asClassDoc(), "",
configuration.getText("doclet.Next_Class"), true))); configuration.getText("doclet.Next_Class"), true)));
li = HtmlTree.LI(nextLink); li = HtmlTree.LI(nextLink);
@ -162,7 +162,7 @@ public class AnnotationTypeWriterImpl extends SubWriterHolderWriter
Content pkgNameDiv = HtmlTree.DIV(HtmlStyle.subTitle, pkgNameContent); Content pkgNameDiv = HtmlTree.DIV(HtmlStyle.subTitle, pkgNameContent);
div.addContent(pkgNameDiv); div.addContent(pkgNameDiv);
} }
LinkInfoImpl linkInfo = new LinkInfoImpl( LinkInfoImpl linkInfo = new LinkInfoImpl(configuration,
LinkInfoImpl.CONTEXT_CLASS_HEADER, annotationType, false); LinkInfoImpl.CONTEXT_CLASS_HEADER, annotationType, false);
Content headerContent = new StringContent(header); Content headerContent = new StringContent(header);
Content heading = HtmlTree.HEADING(HtmlConstants.CLASS_PAGE_HEADING, true, Content heading = HtmlTree.HEADING(HtmlConstants.CLASS_PAGE_HEADING, true,
@ -219,11 +219,11 @@ public class AnnotationTypeWriterImpl extends SubWriterHolderWriter
Content pre = new HtmlTree(HtmlTag.PRE); Content pre = new HtmlTree(HtmlTag.PRE);
addAnnotationInfo(annotationType, pre); addAnnotationInfo(annotationType, pre);
pre.addContent(modifiers); pre.addContent(modifiers);
LinkInfoImpl linkInfo = new LinkInfoImpl( LinkInfoImpl linkInfo = new LinkInfoImpl(configuration,
LinkInfoImpl.CONTEXT_CLASS_SIGNATURE, annotationType, false); LinkInfoImpl.CONTEXT_CLASS_SIGNATURE, annotationType, false);
Content annotationName = new StringContent(annotationType.name()); Content annotationName = new StringContent(annotationType.name());
Content parameterLinks = new RawHtml(getTypeParameterLinks(linkInfo)); Content parameterLinks = new RawHtml(getTypeParameterLinks(linkInfo));
if (configuration().linksource) { if (configuration.linksource) {
addSrcLink(annotationType, annotationName, pre); addSrcLink(annotationType, annotationName, pre);
pre.addContent(parameterLinks); pre.addContent(parameterLinks);
} else { } else {

View File

@ -256,9 +256,9 @@ public class ClassUseWriter extends SubWriterHolderWriter {
*/ */
protected void addPackageList(Content contentTree) throws IOException { protected void addPackageList(Content contentTree) throws IOException {
Content table = HtmlTree.TABLE(0, 3, 0, useTableSummary, Content table = HtmlTree.TABLE(0, 3, 0, useTableSummary,
getTableCaption(configuration().getText( getTableCaption(configuration.getText(
"doclet.ClassUse_Packages.that.use.0", "doclet.ClassUse_Packages.that.use.0",
getLink(new LinkInfoImpl(LinkInfoImpl.CONTEXT_CLASS_USE_HEADER, classdoc, getLink(new LinkInfoImpl(configuration, LinkInfoImpl.CONTEXT_CLASS_USE_HEADER, classdoc,
false))))); false)))));
table.addContent(getSummaryTableHeader(packageTableHeader, "col")); table.addContent(getSummaryTableHeader(packageTableHeader, "col"));
Content tbody = new HtmlTree(HtmlTag.TBODY); Content tbody = new HtmlTree(HtmlTag.TBODY);
@ -287,14 +287,14 @@ public class ClassUseWriter extends SubWriterHolderWriter {
protected void addPackageAnnotationList(Content contentTree) throws IOException { protected void addPackageAnnotationList(Content contentTree) throws IOException {
if ((!classdoc.isAnnotationType()) || if ((!classdoc.isAnnotationType()) ||
pkgToPackageAnnotations == null || pkgToPackageAnnotations == null ||
pkgToPackageAnnotations.size() == 0) { pkgToPackageAnnotations.isEmpty()) {
return; return;
} }
Content table = HtmlTree.TABLE(0, 3, 0, useTableSummary, Content table = HtmlTree.TABLE(0, 3, 0, useTableSummary,
getTableCaption(configuration().getText( getTableCaption(configuration.getText(
"doclet.ClassUse_PackageAnnotation", "doclet.ClassUse_PackageAnnotation",
getLink(new LinkInfoImpl(LinkInfoImpl.CONTEXT_CLASS_USE_HEADER, classdoc, getLink(new LinkInfoImpl(configuration,
false))))); LinkInfoImpl.CONTEXT_CLASS_USE_HEADER, classdoc, false)))));
table.addContent(getSummaryTableHeader(packageTableHeader, "col")); table.addContent(getSummaryTableHeader(packageTableHeader, "col"));
Content tbody = new HtmlTree(HtmlTag.TBODY); Content tbody = new HtmlTree(HtmlTag.TBODY);
Iterator<PackageDoc> it = pkgToPackageAnnotations.iterator(); Iterator<PackageDoc> it = pkgToPackageAnnotations.iterator();
@ -333,7 +333,7 @@ public class ClassUseWriter extends SubWriterHolderWriter {
Content li = HtmlTree.LI(HtmlStyle.blockList, getMarkerAnchor(pkg.name())); Content li = HtmlTree.LI(HtmlStyle.blockList, getMarkerAnchor(pkg.name()));
Content link = new RawHtml( Content link = new RawHtml(
configuration.getText("doclet.ClassUse_Uses.of.0.in.1", configuration.getText("doclet.ClassUse_Uses.of.0.in.1",
getLink(new LinkInfoImpl(LinkInfoImpl.CONTEXT_CLASS_USE_HEADER, getLink(new LinkInfoImpl(configuration, LinkInfoImpl.CONTEXT_CLASS_USE_HEADER,
classdoc, false)), classdoc, false)),
getPackageLinkString(pkg, Util.getPackageName(pkg), false))); getPackageLinkString(pkg, Util.getPackageName(pkg), false)));
Content heading = HtmlTree.HEADING(HtmlConstants.SUMMARY_HEADING, link); Content heading = HtmlTree.HEADING(HtmlConstants.SUMMARY_HEADING, link);
@ -368,7 +368,7 @@ public class ClassUseWriter extends SubWriterHolderWriter {
* @param contentTree the content tree to which the class use information will be added * @param contentTree the content tree to which the class use information will be added
*/ */
protected void addClassUse(PackageDoc pkg, Content contentTree) throws IOException { protected void addClassUse(PackageDoc pkg, Content contentTree) throws IOException {
String classLink = getLink(new LinkInfoImpl( String classLink = getLink(new LinkInfoImpl(configuration,
LinkInfoImpl.CONTEXT_CLASS_USE_HEADER, classdoc, false)); LinkInfoImpl.CONTEXT_CLASS_USE_HEADER, classdoc, false));
String pkgLink = getPackageLinkString(pkg, Util.getPackageName(pkg), false); String pkgLink = getPackageLinkString(pkg, Util.getPackageName(pkg), false);
classSubWriter.addUseInfo(pkgToClassAnnotations.get(pkg.name()), classSubWriter.addUseInfo(pkgToClassAnnotations.get(pkg.name()),
@ -477,8 +477,8 @@ public class ClassUseWriter extends SubWriterHolderWriter {
*/ */
protected Content getNavLinkClass() { protected Content getNavLinkClass() {
Content linkContent = new RawHtml(getLink(new LinkInfoImpl( Content linkContent = new RawHtml(getLink(new LinkInfoImpl(
LinkInfoImpl.CONTEXT_CLASS_USE_HEADER, classdoc, "", configuration, LinkInfoImpl.CONTEXT_CLASS_USE_HEADER, classdoc,
configuration.getText("doclet.Class"), false))); "", configuration.getText("doclet.Class"), false)));
Content li = HtmlTree.LI(linkContent); Content li = HtmlTree.LI(linkContent);
return li; return li;
} }

View File

@ -34,6 +34,7 @@ import com.sun.tools.doclets.internal.toolkit.*;
import com.sun.tools.doclets.internal.toolkit.builders.*; import com.sun.tools.doclets.internal.toolkit.builders.*;
import com.sun.tools.doclets.internal.toolkit.taglets.*; import com.sun.tools.doclets.internal.toolkit.taglets.*;
import com.sun.tools.doclets.internal.toolkit.util.*; import com.sun.tools.doclets.internal.toolkit.util.*;
import java.io.IOException;
/** /**
* Generate the Class Information Page. * Generate the Class Information Page.
@ -56,24 +57,25 @@ import com.sun.tools.doclets.internal.toolkit.util.*;
public class ClassWriterImpl extends SubWriterHolderWriter public class ClassWriterImpl extends SubWriterHolderWriter
implements ClassWriter { implements ClassWriter {
protected ClassDoc classDoc; protected final ClassDoc classDoc;
protected ClassTree classtree; protected final ClassTree classtree;
protected ClassDoc prev; protected final ClassDoc prev;
protected ClassDoc next; protected final ClassDoc next;
/** /**
* @param configuration the configuration data for the doclet
* @param classDoc the class being documented. * @param classDoc the class being documented.
* @param prevClass the previous class that was documented. * @param prevClass the previous class that was documented.
* @param nextClass the next class being documented. * @param nextClass the next class being documented.
* @param classTree the class tree for the given class. * @param classTree the class tree for the given class.
*/ */
public ClassWriterImpl (ClassDoc classDoc, public ClassWriterImpl (ConfigurationImpl configuration, ClassDoc classDoc,
ClassDoc prevClass, ClassDoc nextClass, ClassTree classTree) ClassDoc prevClass, ClassDoc nextClass, ClassTree classTree)
throws Exception { throws IOException {
super(ConfigurationImpl.getInstance(), DocPath.forClass(classDoc)); super(configuration, DocPath.forClass(classDoc));
this.classDoc = classDoc; this.classDoc = classDoc;
configuration.currentcd = classDoc; configuration.currentcd = classDoc;
this.classtree = classTree; this.classtree = classTree;
@ -122,7 +124,7 @@ public class ClassWriterImpl extends SubWriterHolderWriter
public Content getNavLinkPrevious() { public Content getNavLinkPrevious() {
Content li; Content li;
if (prev != null) { if (prev != null) {
Content prevLink = new RawHtml(getLink(new LinkInfoImpl( Content prevLink = new RawHtml(getLink(new LinkInfoImpl(configuration,
LinkInfoImpl.CONTEXT_CLASS, prev, "", LinkInfoImpl.CONTEXT_CLASS, prev, "",
configuration.getText("doclet.Prev_Class"), true))); configuration.getText("doclet.Prev_Class"), true)));
li = HtmlTree.LI(prevLink); li = HtmlTree.LI(prevLink);
@ -140,7 +142,7 @@ public class ClassWriterImpl extends SubWriterHolderWriter
public Content getNavLinkNext() { public Content getNavLinkNext() {
Content li; Content li;
if (next != null) { if (next != null) {
Content nextLink = new RawHtml(getLink(new LinkInfoImpl( Content nextLink = new RawHtml(getLink(new LinkInfoImpl(configuration,
LinkInfoImpl.CONTEXT_CLASS, next, "", LinkInfoImpl.CONTEXT_CLASS, next, "",
configuration.getText("doclet.Next_Class"), true))); configuration.getText("doclet.Next_Class"), true)));
li = HtmlTree.LI(nextLink); li = HtmlTree.LI(nextLink);
@ -168,8 +170,8 @@ public class ClassWriterImpl extends SubWriterHolderWriter
Content pkgNameDiv = HtmlTree.DIV(HtmlStyle.subTitle, pkgNameContent); Content pkgNameDiv = HtmlTree.DIV(HtmlStyle.subTitle, pkgNameContent);
div.addContent(pkgNameDiv); div.addContent(pkgNameDiv);
} }
LinkInfoImpl linkInfo = new LinkInfoImpl( LinkInfoImpl.CONTEXT_CLASS_HEADER, LinkInfoImpl linkInfo = new LinkInfoImpl(configuration,
classDoc, false); LinkInfoImpl.CONTEXT_CLASS_HEADER, classDoc, false);
//Let's not link to ourselves in the header. //Let's not link to ourselves in the header.
linkInfo.linkToSelf = false; linkInfo.linkToSelf = false;
Content headerContent = new StringContent(header); Content headerContent = new StringContent(header);
@ -228,13 +230,13 @@ public class ClassWriterImpl extends SubWriterHolderWriter
Content pre = new HtmlTree(HtmlTag.PRE); Content pre = new HtmlTree(HtmlTag.PRE);
addAnnotationInfo(classDoc, pre); addAnnotationInfo(classDoc, pre);
pre.addContent(modifiers); pre.addContent(modifiers);
LinkInfoImpl linkInfo = new LinkInfoImpl( LinkInfoImpl linkInfo = new LinkInfoImpl(configuration,
LinkInfoImpl.CONTEXT_CLASS_SIGNATURE, classDoc, false); LinkInfoImpl.CONTEXT_CLASS_SIGNATURE, classDoc, false);
//Let's not link to ourselves in the signature. //Let's not link to ourselves in the signature.
linkInfo.linkToSelf = false; linkInfo.linkToSelf = false;
Content className = new StringContent(classDoc.name()); Content className = new StringContent(classDoc.name());
Content parameterLinks = new RawHtml(getTypeParameterLinks(linkInfo)); Content parameterLinks = new RawHtml(getTypeParameterLinks(linkInfo));
if (configuration().linksource) { if (configuration.linksource) {
addSrcLink(classDoc, className, pre); addSrcLink(classDoc, className, pre);
pre.addContent(parameterLinks); pre.addContent(parameterLinks);
} else { } else {
@ -244,11 +246,11 @@ public class ClassWriterImpl extends SubWriterHolderWriter
} }
if (!isInterface) { if (!isInterface) {
Type superclass = Util.getFirstVisibleSuperClass(classDoc, Type superclass = Util.getFirstVisibleSuperClass(classDoc,
configuration()); configuration);
if (superclass != null) { if (superclass != null) {
pre.addContent(DocletConstants.NL); pre.addContent(DocletConstants.NL);
pre.addContent("extends "); pre.addContent("extends ");
Content link = new RawHtml(getLink(new LinkInfoImpl( Content link = new RawHtml(getLink(new LinkInfoImpl(configuration,
LinkInfoImpl.CONTEXT_CLASS_SIGNATURE_PARENT_NAME, LinkInfoImpl.CONTEXT_CLASS_SIGNATURE_PARENT_NAME,
superclass))); superclass)));
pre.addContent(link); pre.addContent(link);
@ -260,7 +262,7 @@ public class ClassWriterImpl extends SubWriterHolderWriter
for (int i = 0; i < implIntfacs.length; i++) { for (int i = 0; i < implIntfacs.length; i++) {
ClassDoc classDoc = implIntfacs[i].asClassDoc(); ClassDoc classDoc = implIntfacs[i].asClassDoc();
if (! (classDoc.isPublic() || if (! (classDoc.isPublic() ||
Util.isLinkable(classDoc, configuration()))) { Util.isLinkable(classDoc, configuration))) {
continue; continue;
} }
if (counter == 0) { if (counter == 0) {
@ -269,7 +271,7 @@ public class ClassWriterImpl extends SubWriterHolderWriter
} else { } else {
pre.addContent(", "); pre.addContent(", ");
} }
Content link = new RawHtml(getLink(new LinkInfoImpl( Content link = new RawHtml(getLink(new LinkInfoImpl(configuration,
LinkInfoImpl.CONTEXT_CLASS_SIGNATURE_PARENT_NAME, LinkInfoImpl.CONTEXT_CLASS_SIGNATURE_PARENT_NAME,
implIntfacs[i]))); implIntfacs[i])));
pre.addContent(link); pre.addContent(link);
@ -315,7 +317,7 @@ public class ClassWriterImpl extends SubWriterHolderWriter
do { do {
sup = Util.getFirstVisibleSuperClass( sup = Util.getFirstVisibleSuperClass(
type instanceof ClassDoc ? (ClassDoc) type : type.asClassDoc(), type instanceof ClassDoc ? (ClassDoc) type : type.asClassDoc(),
configuration()); configuration);
if (sup != null) { if (sup != null) {
HtmlTree ul = new HtmlTree(HtmlTag.UL); HtmlTree ul = new HtmlTree(HtmlTag.UL);
ul.addStyle(HtmlStyle.inheritance); ul.addStyle(HtmlStyle.inheritance);
@ -345,7 +347,7 @@ public class ClassWriterImpl extends SubWriterHolderWriter
Content li = new HtmlTree(HtmlTag.LI); Content li = new HtmlTree(HtmlTag.LI);
if (type.equals(classDoc)) { if (type.equals(classDoc)) {
String typeParameters = getTypeParameterLinks( String typeParameters = getTypeParameterLinks(
new LinkInfoImpl(LinkInfoImpl.CONTEXT_TREE, new LinkInfoImpl(configuration, LinkInfoImpl.CONTEXT_TREE,
classDoc, false)); classDoc, false));
if (configuration.shouldExcludeQualifier( if (configuration.shouldExcludeQualifier(
classDoc.containingPackage().name())) { classDoc.containingPackage().name())) {
@ -356,7 +358,7 @@ public class ClassWriterImpl extends SubWriterHolderWriter
li.addContent(new RawHtml(typeParameters)); li.addContent(new RawHtml(typeParameters));
} }
} else { } else {
Content link = new RawHtml(getLink(new LinkInfoImpl( Content link = new RawHtml(getLink(new LinkInfoImpl(configuration,
LinkInfoImpl.CONTEXT_CLASS_TREE_PARENT, LinkInfoImpl.CONTEXT_CLASS_TREE_PARENT,
type instanceof ClassDoc ? (ClassDoc) type : type, type instanceof ClassDoc ? (ClassDoc) type : type,
configuration.getClassName(type.asClassDoc()), false))); configuration.getClassName(type.asClassDoc()), false)));
@ -504,8 +506,8 @@ public class ClassWriterImpl extends SubWriterHolderWriter
Content dt = HtmlTree.DT(label); Content dt = HtmlTree.DT(label);
Content dl = HtmlTree.DL(dt); Content dl = HtmlTree.DL(dt);
Content dd = new HtmlTree(HtmlTag.DD); Content dd = new HtmlTree(HtmlTag.DD);
dd.addContent(new RawHtml(getLink(new LinkInfoImpl(LinkInfoImpl.CONTEXT_CLASS, outerClass, dd.addContent(new RawHtml(getLink(new LinkInfoImpl(configuration,
false)))); LinkInfoImpl.CONTEXT_CLASS, outerClass, false))));
dl.addContent(dd); dl.addContent(dd);
classInfoTree.addContent(dl); classInfoTree.addContent(dl);
} }
@ -549,11 +551,11 @@ public class ClassWriterImpl extends SubWriterHolderWriter
} }
if (typeList[i] instanceof ClassDoc) { if (typeList[i] instanceof ClassDoc) {
Content link = new RawHtml(getLink( Content link = new RawHtml(getLink(
new LinkInfoImpl(context, (ClassDoc)(typeList[i])))); new LinkInfoImpl(configuration, context, (ClassDoc)(typeList[i]))));
dd.addContent(link); dd.addContent(link);
} else { } else {
Content link = new RawHtml(getLink( Content link = new RawHtml(getLink(
new LinkInfoImpl(context, (Type)(typeList[i])))); new LinkInfoImpl(configuration, context, (Type)(typeList[i]))));
dd.addContent(link); dd.addContent(link);
} }
} }

View File

@ -28,9 +28,13 @@ package com.sun.tools.doclets.formats.html;
import java.net.*; import java.net.*;
import java.util.*; import java.util.*;
import javax.tools.JavaFileManager;
import com.sun.javadoc.*; import com.sun.javadoc.*;
import com.sun.tools.doclets.internal.toolkit.*; import com.sun.tools.doclets.internal.toolkit.*;
import com.sun.tools.doclets.internal.toolkit.util.*; import com.sun.tools.doclets.internal.toolkit.util.*;
import com.sun.tools.javac.file.JavacFileManager;
import com.sun.tools.javac.util.Context;
/** /**
* Configure the output based on the command line options. * Configure the output based on the command line options.
@ -57,8 +61,6 @@ import com.sun.tools.doclets.internal.toolkit.util.*;
*/ */
public class ConfigurationImpl extends Configuration { public class ConfigurationImpl extends Configuration {
private static ConfigurationImpl instance = new ConfigurationImpl();
/** /**
* The build date. Note: For now, we will use * The build date. Note: For now, we will use
* a version number instead of a date. * a version number instead of a date.
@ -183,34 +185,21 @@ public class ConfigurationImpl extends Configuration {
/** /**
* The classdoc for the class file getting generated. * The classdoc for the class file getting generated.
*/ */
public ClassDoc currentcd = null; // Set this classdoc in the public ClassDoc currentcd = null; // Set this classdoc in the ClassWriter.
// ClassWriter.
/** /**
* Constructor. Initializes resource for the * Constructor. Initializes resource for the
* {@link com.sun.tools.doclets.internal.toolkit.util.MessageRetriever MessageRetriever}. * {@link com.sun.tools.doclets.internal.toolkit.util.MessageRetriever MessageRetriever}.
*/ */
private ConfigurationImpl() { public ConfigurationImpl() {
standardmessage = new MessageRetriever(this, standardmessage = new MessageRetriever(this,
"com.sun.tools.doclets.formats.html.resources.standard"); "com.sun.tools.doclets.formats.html.resources.standard");
} }
/**
* Reset to a fresh new ConfigurationImpl, to allow multiple invocations
* of javadoc within a single VM. It would be better not to be using
* static fields at all, but .... (sigh).
*/
public static void reset() {
instance = new ConfigurationImpl();
}
public static ConfigurationImpl getInstance() {
return instance;
}
/** /**
* Return the build date for the doclet. * Return the build date for the doclet.
*/ */
@Override
public String getDocletSpecificBuildDate() { public String getDocletSpecificBuildDate() {
return BUILD_DATE; return BUILD_DATE;
} }
@ -221,6 +210,7 @@ public class ConfigurationImpl extends Configuration {
* *
* @param options The array of option names and values. * @param options The array of option names and values.
*/ */
@Override
public void setSpecificDocletOptions(String[][] options) { public void setSpecificDocletOptions(String[][] options) {
for (int oi = 0; oi < options.length; ++oi) { for (int oi = 0; oi < options.length; ++oi) {
String[] os = options[oi]; String[] os = options[oi];
@ -339,6 +329,7 @@ public class ConfigurationImpl extends Configuration {
/** /**
* {@inheritDoc} * {@inheritDoc}
*/ */
@Override
public boolean validOptions(String options[][], public boolean validOptions(String options[][],
DocErrorReporter reporter) { DocErrorReporter reporter) {
boolean helpfile = false; boolean helpfile = false;
@ -427,6 +418,7 @@ public class ConfigurationImpl extends Configuration {
/** /**
* {@inheritDoc} * {@inheritDoc}
*/ */
@Override
public MessageRetriever getDocletSpecificMsg() { public MessageRetriever getDocletSpecificMsg() {
return standardmessage; return standardmessage;
} }
@ -496,6 +488,7 @@ public class ConfigurationImpl extends Configuration {
/** /**
* {@inheritDoc} * {@inheritDoc}
*/ */
@Override
public WriterFactory getWriterFactory() { public WriterFactory getWriterFactory() {
return new WriterFactoryImpl(this); return new WriterFactoryImpl(this);
} }
@ -503,6 +496,7 @@ public class ConfigurationImpl extends Configuration {
/** /**
* {@inheritDoc} * {@inheritDoc}
*/ */
@Override
public Comparator<ProgramElementDoc> getMemberComparator() { public Comparator<ProgramElementDoc> getMemberComparator() {
return null; return null;
} }
@ -510,10 +504,27 @@ public class ConfigurationImpl extends Configuration {
/** /**
* {@inheritDoc} * {@inheritDoc}
*/ */
@Override
public Locale getLocale() { public Locale getLocale() {
if (root instanceof com.sun.tools.javadoc.RootDocImpl) if (root instanceof com.sun.tools.javadoc.RootDocImpl)
return ((com.sun.tools.javadoc.RootDocImpl)root).getLocale(); return ((com.sun.tools.javadoc.RootDocImpl)root).getLocale();
else else
return Locale.getDefault(); return Locale.getDefault();
} }
/**
* {@inheritDoc}
*/
@Override
public JavaFileManager getFileManager() {
if (fileManager == null) {
if (root instanceof com.sun.tools.javadoc.RootDocImpl)
fileManager = ((com.sun.tools.javadoc.RootDocImpl)root).getFileManager();
else
fileManager = new JavacFileManager(new Context(), false, null);
}
return fileManager;
}
private JavaFileManager fileManager;
} }

View File

@ -184,9 +184,9 @@ public class ConstantsSummaryWriterImpl extends HtmlDocletWriter
*/ */
public Content getConstantMembersHeader(ClassDoc cd) { public Content getConstantMembersHeader(ClassDoc cd) {
//generate links backward only to public classes. //generate links backward only to public classes.
String classlink = (cd.isPublic() || cd.isProtected())? String classlink = (cd.isPublic() || cd.isProtected()) ?
getLink(new LinkInfoImpl(LinkInfoImpl.CONTEXT_CONSTANT_SUMMARY, cd, getLink(new LinkInfoImpl(configuration,
false)) : LinkInfoImpl.CONTEXT_CONSTANT_SUMMARY, cd, false)) :
cd.qualifiedName(); cd.qualifiedName();
String name = cd.containingPackage().name(); String name = cd.containingPackage().name();
if (name.length() > 0) { if (name.length() > 0) {
@ -260,7 +260,7 @@ public class ConstantsSummaryWriterImpl extends HtmlDocletWriter
code.addContent(modifier); code.addContent(modifier);
code.addContent(getSpace()); code.addContent(getSpace());
} }
Content type = new RawHtml(getLink(new LinkInfoImpl( Content type = new RawHtml(getLink(new LinkInfoImpl(configuration,
LinkInfoImpl.CONTEXT_CONSTANT_SUMMARY, member.type()))); LinkInfoImpl.CONTEXT_CONSTANT_SUMMARY, member.type())));
code.addContent(type); code.addContent(type);
tdType.addContent(code); tdType.addContent(code);

View File

@ -60,7 +60,7 @@ public class ConstructorWriterImpl extends AbstractExecutableMemberWriter
ClassDoc classDoc) { ClassDoc classDoc) {
super(writer, classDoc); super(writer, classDoc);
VisibleMemberMap visibleMemberMap = new VisibleMemberMap(classDoc, VisibleMemberMap visibleMemberMap = new VisibleMemberMap(classDoc,
VisibleMemberMap.CONSTRUCTORS, configuration().nodeprecated); VisibleMemberMap.CONSTRUCTORS, configuration.nodeprecated);
List<ProgramElementDoc> constructors = new ArrayList<ProgramElementDoc>(visibleMemberMap.getMembersFor(classDoc)); List<ProgramElementDoc> constructors = new ArrayList<ProgramElementDoc>(visibleMemberMap.getMembersFor(classDoc));
for (int i = 0; i < constructors.size(); i++) { for (int i = 0; i < constructors.size(); i++) {
if ((constructors.get(i)).isProtected() || if ((constructors.get(i)).isProtected() ||
@ -130,7 +130,7 @@ public class ConstructorWriterImpl extends AbstractExecutableMemberWriter
Content pre = new HtmlTree(HtmlTag.PRE); Content pre = new HtmlTree(HtmlTag.PRE);
writer.addAnnotationInfo(constructor, pre); writer.addAnnotationInfo(constructor, pre);
addModifiers(constructor, pre); addModifiers(constructor, pre);
if (configuration().linksource) { if (configuration.linksource) {
Content constructorName = new StringContent(constructor.name()); Content constructorName = new StringContent(constructor.name());
writer.addSrcLink(constructor, constructorName, pre); writer.addSrcLink(constructor, constructorName, pre);
} else { } else {
@ -217,16 +217,16 @@ public class ConstructorWriterImpl extends AbstractExecutableMemberWriter
* {@inheritDoc} * {@inheritDoc}
*/ */
public String getTableSummary() { public String getTableSummary() {
return configuration().getText("doclet.Member_Table_Summary", return configuration.getText("doclet.Member_Table_Summary",
configuration().getText("doclet.Constructor_Summary"), configuration.getText("doclet.Constructor_Summary"),
configuration().getText("doclet.constructors")); configuration.getText("doclet.constructors"));
} }
/** /**
* {@inheritDoc} * {@inheritDoc}
*/ */
public String getCaption() { public String getCaption() {
return configuration().getText("doclet.Constructors"); return configuration.getText("doclet.Constructors");
} }
/** /**
@ -236,17 +236,17 @@ public class ConstructorWriterImpl extends AbstractExecutableMemberWriter
String[] header; String[] header;
if (foundNonPubConstructor) { if (foundNonPubConstructor) {
header = new String[] { header = new String[] {
configuration().getText("doclet.Modifier"), configuration.getText("doclet.Modifier"),
configuration().getText("doclet.0_and_1", configuration.getText("doclet.0_and_1",
configuration().getText("doclet.Constructor"), configuration.getText("doclet.Constructor"),
configuration().getText("doclet.Description")) configuration.getText("doclet.Description"))
}; };
} }
else { else {
header = new String[] { header = new String[] {
configuration().getText("doclet.0_and_1", configuration.getText("doclet.0_and_1",
configuration().getText("doclet.Constructor"), configuration.getText("doclet.Constructor"),
configuration().getText("doclet.Description")) configuration.getText("doclet.Description"))
}; };
} }
return header; return header;
@ -313,7 +313,7 @@ public class ConstructorWriterImpl extends AbstractExecutableMemberWriter
code.addContent(writer.getSpace()); code.addContent(writer.getSpace());
} else { } else {
code.addContent( code.addContent(
configuration().getText("doclet.Package_private")); configuration.getText("doclet.Package_private"));
} }
tdSummaryType.addContent(code); tdSummaryType.addContent(code);
} }

View File

@ -101,11 +101,11 @@ public class EnumConstantWriterImpl extends AbstractMemberWriter
Content pre = new HtmlTree(HtmlTag.PRE); Content pre = new HtmlTree(HtmlTag.PRE);
writer.addAnnotationInfo(enumConstant, pre); writer.addAnnotationInfo(enumConstant, pre);
addModifiers(enumConstant, pre); addModifiers(enumConstant, pre);
Content enumConstantLink = new RawHtml(writer.getLink(new LinkInfoImpl(LinkInfoImpl.CONTEXT_MEMBER, Content enumConstantLink = new RawHtml(writer.getLink(new LinkInfoImpl(
enumConstant.type()))); configuration, LinkInfoImpl.CONTEXT_MEMBER, enumConstant.type())));
pre.addContent(enumConstantLink); pre.addContent(enumConstantLink);
pre.addContent(" "); pre.addContent(" ");
if (configuration().linksource) { if (configuration.linksource) {
Content enumConstantName = new StringContent(enumConstant.name()); Content enumConstantName = new StringContent(enumConstant.name());
writer.addSrcLink(enumConstant, enumConstantName, pre); writer.addSrcLink(enumConstant, enumConstantName, pre);
} else { } else {
@ -174,16 +174,16 @@ public class EnumConstantWriterImpl extends AbstractMemberWriter
* {@inheritDoc} * {@inheritDoc}
*/ */
public String getTableSummary() { public String getTableSummary() {
return configuration().getText("doclet.Member_Table_Summary", return configuration.getText("doclet.Member_Table_Summary",
configuration().getText("doclet.Enum_Constant_Summary"), configuration.getText("doclet.Enum_Constant_Summary"),
configuration().getText("doclet.enum_constants")); configuration.getText("doclet.enum_constants"));
} }
/** /**
* {@inheritDoc} * {@inheritDoc}
*/ */
public String getCaption() { public String getCaption() {
return configuration().getText("doclet.Enum_Constants"); return configuration.getText("doclet.Enum_Constants");
} }
/** /**
@ -191,9 +191,9 @@ public class EnumConstantWriterImpl extends AbstractMemberWriter
*/ */
public String[] getSummaryTableHeader(ProgramElementDoc member) { public String[] getSummaryTableHeader(ProgramElementDoc member) {
String[] header = new String[] { String[] header = new String[] {
configuration().getText("doclet.0_and_1", configuration.getText("doclet.0_and_1",
configuration().getText("doclet.Enum_Constant"), configuration.getText("doclet.Enum_Constant"),
configuration().getText("doclet.Description")) configuration.getText("doclet.Description"))
}; };
return header; return header;
} }
@ -266,7 +266,7 @@ public class EnumConstantWriterImpl extends AbstractMemberWriter
return writer.getHyperLink((cd == null)? return writer.getHyperLink((cd == null)?
"enum_constant_summary": "enum_constant_summary":
"enum_constants_inherited_from_class_" + "enum_constants_inherited_from_class_" +
configuration().getClassName(cd), configuration.getClassName(cd),
writer.getResource("doclet.navEnum")); writer.getResource("doclet.navEnum"));
} else { } else {
return writer.getResource("doclet.navEnum"); return writer.getResource("doclet.navEnum");

View File

@ -102,11 +102,11 @@ public class FieldWriterImpl extends AbstractMemberWriter
Content pre = new HtmlTree(HtmlTag.PRE); Content pre = new HtmlTree(HtmlTag.PRE);
writer.addAnnotationInfo(field, pre); writer.addAnnotationInfo(field, pre);
addModifiers(field, pre); addModifiers(field, pre);
Content fieldlink = new RawHtml(writer.getLink(new LinkInfoImpl(LinkInfoImpl.CONTEXT_MEMBER, Content fieldlink = new RawHtml(writer.getLink(new LinkInfoImpl(
field.type()))); configuration, LinkInfoImpl.CONTEXT_MEMBER, field.type())));
pre.addContent(fieldlink); pre.addContent(fieldlink);
pre.addContent(" "); pre.addContent(" ");
if (configuration().linksource) { if (configuration.linksource) {
Content fieldName = new StringContent(field.name()); Content fieldName = new StringContent(field.name());
writer.addSrcLink(field, fieldName, pre); writer.addSrcLink(field, fieldName, pre);
} else { } else {
@ -129,7 +129,7 @@ public class FieldWriterImpl extends AbstractMemberWriter
ClassDoc holder = field.containingClass(); ClassDoc holder = field.containingClass();
if (field.inlineTags().length > 0) { if (field.inlineTags().length > 0) {
if (holder.equals(classdoc) || if (holder.equals(classdoc) ||
(! (holder.isPublic() || Util.isLinkable(holder, configuration())))) { (! (holder.isPublic() || Util.isLinkable(holder, configuration)))) {
writer.addInlineComment(field, fieldDocTree); writer.addInlineComment(field, fieldDocTree);
} else { } else {
Content link = new RawHtml( Content link = new RawHtml(
@ -195,16 +195,16 @@ public class FieldWriterImpl extends AbstractMemberWriter
* {@inheritDoc} * {@inheritDoc}
*/ */
public String getTableSummary() { public String getTableSummary() {
return configuration().getText("doclet.Member_Table_Summary", return configuration.getText("doclet.Member_Table_Summary",
configuration().getText("doclet.Field_Summary"), configuration.getText("doclet.Field_Summary"),
configuration().getText("doclet.fields")); configuration.getText("doclet.fields"));
} }
/** /**
* {@inheritDoc} * {@inheritDoc}
*/ */
public String getCaption() { public String getCaption() {
return configuration().getText("doclet.Fields"); return configuration.getText("doclet.Fields");
} }
/** /**
@ -213,9 +213,9 @@ public class FieldWriterImpl extends AbstractMemberWriter
public String[] getSummaryTableHeader(ProgramElementDoc member) { public String[] getSummaryTableHeader(ProgramElementDoc member) {
String[] header = new String[] { String[] header = new String[] {
writer.getModifierTypeHeader(), writer.getModifierTypeHeader(),
configuration().getText("doclet.0_and_1", configuration.getText("doclet.0_and_1",
configuration().getText("doclet.Field"), configuration.getText("doclet.Field"),
configuration().getText("doclet.Description")) configuration.getText("doclet.Description"))
}; };
return header; return header;
} }
@ -232,7 +232,7 @@ public class FieldWriterImpl extends AbstractMemberWriter
*/ */
public void addInheritedSummaryAnchor(ClassDoc cd, Content inheritedTree) { public void addInheritedSummaryAnchor(ClassDoc cd, Content inheritedTree) {
inheritedTree.addContent(writer.getMarkerAnchor( inheritedTree.addContent(writer.getMarkerAnchor(
"fields_inherited_from_class_" + configuration().getClassName(cd))); "fields_inherited_from_class_" + configuration.getClassName(cd)));
} }
/** /**
@ -242,8 +242,8 @@ public class FieldWriterImpl extends AbstractMemberWriter
Content classLink = new RawHtml(writer.getPreQualifiedClassLink( Content classLink = new RawHtml(writer.getPreQualifiedClassLink(
LinkInfoImpl.CONTEXT_MEMBER, cd, false)); LinkInfoImpl.CONTEXT_MEMBER, cd, false));
Content label = new StringContent(cd.isClass() ? Content label = new StringContent(cd.isClass() ?
configuration().getText("doclet.Fields_Inherited_From_Class") : configuration.getText("doclet.Fields_Inherited_From_Class") :
configuration().getText("doclet.Fields_Inherited_From_Interface")); configuration.getText("doclet.Fields_Inherited_From_Interface"));
Content labelHeading = HtmlTree.HEADING(HtmlConstants.INHERITED_SUMMARY_HEADING, Content labelHeading = HtmlTree.HEADING(HtmlConstants.INHERITED_SUMMARY_HEADING,
label); label);
labelHeading.addContent(writer.getSpace()); labelHeading.addContent(writer.getSpace());
@ -296,7 +296,7 @@ public class FieldWriterImpl extends AbstractMemberWriter
return writer.getHyperLink((cd == null)? return writer.getHyperLink((cd == null)?
"field_summary": "field_summary":
"fields_inherited_from_class_" + "fields_inherited_from_class_" +
configuration().getClassName(cd), configuration.getClassName(cd),
writer.getResource("doclet.navField")); writer.getResource("doclet.navField"));
} else { } else {
return writer.getResource("doclet.navField"); return writer.getResource("doclet.navField");

View File

@ -46,14 +46,17 @@ import com.sun.tools.doclets.internal.toolkit.util.*;
* *
*/ */
public class HtmlDoclet extends AbstractDoclet { public class HtmlDoclet extends AbstractDoclet {
// An instance will be created by validOptions, and used by start.
private static HtmlDoclet docletToStart = null;
public HtmlDoclet() { public HtmlDoclet() {
configuration = (ConfigurationImpl) configuration(); configuration = new ConfigurationImpl();
} }
/** /**
* The global configuration information for this run. * The global configuration information for this run.
*/ */
public ConfigurationImpl configuration; public final ConfigurationImpl configuration;
/** /**
* The "start" method as required by Javadoc. * The "start" method as required by Javadoc.
@ -63,12 +66,16 @@ public class HtmlDoclet extends AbstractDoclet {
* @return true if the doclet ran without encountering any errors. * @return true if the doclet ran without encountering any errors.
*/ */
public static boolean start(RootDoc root) { public static boolean start(RootDoc root) {
try { // In typical use, options will have been set up by calling validOptions,
HtmlDoclet doclet = new HtmlDoclet(); // which will create an HtmlDoclet for use here.
return doclet.start(doclet, root); HtmlDoclet doclet;
} finally { if (docletToStart != null) {
ConfigurationImpl.reset(); doclet = docletToStart;
docletToStart = null;
} else {
doclet = new HtmlDoclet();
} }
return doclet.start(doclet, root);
} }
/** /**
@ -77,7 +84,7 @@ public class HtmlDoclet extends AbstractDoclet {
* configuration. * configuration.
*/ */
public Configuration configuration() { public Configuration configuration() {
return ConfigurationImpl.getInstance(); return configuration;
} }
/** /**
@ -110,6 +117,8 @@ public class HtmlDoclet extends AbstractDoclet {
copyResourceFile("tab.gif"); copyResourceFile("tab.gif");
copyResourceFile("titlebar.gif"); copyResourceFile("titlebar.gif");
copyResourceFile("titlebar_end.gif"); copyResourceFile("titlebar_end.gif");
copyResourceFile("activetitlebar.gif");
copyResourceFile("activetitlebar_end.gif");
// do early to reduce memory footprint // do early to reduce memory footprint
if (configuration.classuse) { if (configuration.classuse) {
ClassUseWriter.generate(configuration, classtree); ClassUseWriter.generate(configuration, classtree);
@ -145,10 +154,13 @@ public class HtmlDoclet extends AbstractDoclet {
} }
// If a stylesheet file is not specified, copy the default stylesheet // If a stylesheet file is not specified, copy the default stylesheet
// and replace newline with platform-specific newline. // and replace newline with platform-specific newline.
DocFile f;
if (configuration.stylesheetfile.length() == 0) { if (configuration.stylesheetfile.length() == 0) {
DocFile f = DocFile.createFileForOutput(configuration, DocPaths.STYLESHEET); f = DocFile.createFileForOutput(configuration, DocPaths.STYLESHEET);
f.copyResource(DocPaths.RESOURCES.resolve(DocPaths.STYLESHEET), false, true); f.copyResource(DocPaths.RESOURCES.resolve(DocPaths.STYLESHEET), false, true);
} }
f = DocFile.createFileForOutput(configuration, DocPaths.JAVASCRIPT);
f.copyResource(DocPaths.RESOURCES.resolve(DocPaths.JAVASCRIPT), true, true);
} }
/** /**
@ -220,6 +232,9 @@ public class HtmlDoclet extends AbstractDoclet {
} }
} }
public static final ConfigurationImpl sharedInstanceForOptions =
new ConfigurationImpl();
/** /**
* Check for doclet added options here. * Check for doclet added options here.
* *
@ -228,7 +243,7 @@ public class HtmlDoclet extends AbstractDoclet {
*/ */
public static int optionLength(String option) { public static int optionLength(String option) {
// Construct temporary configuration for check // Construct temporary configuration for check
return (ConfigurationImpl.getInstance()).optionLength(option); return sharedInstanceForOptions.optionLength(option);
} }
/** /**
@ -244,8 +259,8 @@ public class HtmlDoclet extends AbstractDoclet {
*/ */
public static boolean validOptions(String options[][], public static boolean validOptions(String options[][],
DocErrorReporter reporter) { DocErrorReporter reporter) {
// Construct temporary configuration for check docletToStart = new HtmlDoclet();
return (ConfigurationImpl.getInstance()).validOptions(options, reporter); return docletToStart.configuration.validOptions(options, reporter);
} }
/** /**

View File

@ -82,7 +82,7 @@ public class HtmlDocletWriter extends HtmlDocWriter {
/** /**
* The global configuration information for this run. * The global configuration information for this run.
*/ */
public ConfigurationImpl configuration; public final ConfigurationImpl configuration;
/** /**
* To check whether annotation heading is printed or not. * To check whether annotation heading is printed or not.
@ -302,7 +302,7 @@ public class HtmlDocletWriter extends HtmlDocWriter {
*/ */
public void printHtmlDocument(String[] metakeywords, boolean includeScript, public void printHtmlDocument(String[] metakeywords, boolean includeScript,
Content body) throws IOException { Content body) throws IOException {
Content htmlDocType = DocType.Transitional(); Content htmlDocType = DocType.TRANSITIONAL;
Content htmlComment = new Comment(configuration.getText("doclet.New_Page")); Content htmlComment = new Comment(configuration.getText("doclet.New_Page"));
Content head = new HtmlTree(HtmlTag.HEAD); Content head = new HtmlTree(HtmlTag.HEAD);
if (!configuration.notimestamp) { if (!configuration.notimestamp) {
@ -327,6 +327,7 @@ public class HtmlDocletWriter extends HtmlDocWriter {
} }
} }
head.addContent(getStyleSheetProperties()); head.addContent(getStyleSheetProperties());
head.addContent(getScriptProperties());
Content htmlTree = HtmlTree.HTML(configuration.getLocale().getLanguage(), Content htmlTree = HtmlTree.HTML(configuration.getLocale().getLanguage(),
head, body); head, body);
Content htmlDocument = new HtmlDocument(htmlDocType, Content htmlDocument = new HtmlDocument(htmlDocType,
@ -835,7 +836,7 @@ public class HtmlDocletWriter extends HtmlDocWriter {
String tableSummary, String[] tableHeader, Content contentTree) { String tableSummary, String[] tableHeader, Content contentTree) {
if (deprPkgs.size() > 0) { if (deprPkgs.size() > 0) {
Content table = HtmlTree.TABLE(0, 3, 0, tableSummary, Content table = HtmlTree.TABLE(0, 3, 0, tableSummary,
getTableCaption(configuration().getText(headingKey))); getTableCaption(configuration.getText(headingKey)));
table.addContent(getSummaryTableHeader(tableHeader, "col")); table.addContent(getSummaryTableHeader(tableHeader, "col"));
Content tbody = new HtmlTree(HtmlTag.TBODY); Content tbody = new HtmlTree(HtmlTag.TBODY);
for (int i = 0; i < deprPkgs.size(); i++) { for (int i = 0; i < deprPkgs.size(); i++) {
@ -1079,7 +1080,7 @@ public class HtmlDocletWriter extends HtmlDocWriter {
* @return a content tree for the link * @return a content tree for the link
*/ */
public Content getQualifiedClassLink(int context, ClassDoc cd) { public Content getQualifiedClassLink(int context, ClassDoc cd) {
return new RawHtml(getLink(new LinkInfoImpl(context, cd, return new RawHtml(getLink(new LinkInfoImpl(configuration, context, cd,
configuration.getClassName(cd), ""))); configuration.getClassName(cd), "")));
} }
@ -1110,7 +1111,8 @@ public class HtmlDocletWriter extends HtmlDocWriter {
if(pd != null && ! configuration.shouldExcludeQualifier(pd.name())) { if(pd != null && ! configuration.shouldExcludeQualifier(pd.name())) {
classlink = getPkgName(cd); classlink = getPkgName(cd);
} }
classlink += getLink(new LinkInfoImpl(context, cd, cd.name(), isStrong)); classlink += getLink(new LinkInfoImpl(configuration,
context, cd, cd.name(), isStrong));
return classlink; return classlink;
} }
@ -1130,7 +1132,7 @@ public class HtmlDocletWriter extends HtmlDocWriter {
if(pd != null && ! configuration.shouldExcludeQualifier(pd.name())) { if(pd != null && ! configuration.shouldExcludeQualifier(pd.name())) {
contentTree.addContent(getPkgName(cd)); contentTree.addContent(getPkgName(cd));
} }
contentTree.addContent(new RawHtml(getLink(new LinkInfoImpl( contentTree.addContent(new RawHtml(getLink(new LinkInfoImpl(configuration,
context, cd, cd.name(), isStrong)))); context, cd, cd.name(), isStrong))));
} }
@ -1187,14 +1189,14 @@ public class HtmlDocletWriter extends HtmlDocWriter {
public String getDocLink(int context, ClassDoc classDoc, MemberDoc doc, public String getDocLink(int context, ClassDoc classDoc, MemberDoc doc,
String label, boolean strong) { String label, boolean strong) {
if (! (doc.isIncluded() || if (! (doc.isIncluded() ||
Util.isLinkable(classDoc, configuration()))) { Util.isLinkable(classDoc, configuration))) {
return label; return label;
} else if (doc instanceof ExecutableMemberDoc) { } else if (doc instanceof ExecutableMemberDoc) {
ExecutableMemberDoc emd = (ExecutableMemberDoc)doc; ExecutableMemberDoc emd = (ExecutableMemberDoc)doc;
return getLink(new LinkInfoImpl(context, classDoc, return getLink(new LinkInfoImpl(configuration, context, classDoc,
getAnchor(emd), label, strong)); getAnchor(emd), label, strong));
} else if (doc instanceof MemberDoc) { } else if (doc instanceof MemberDoc) {
return getLink(new LinkInfoImpl(context, classDoc, return getLink(new LinkInfoImpl(configuration, context, classDoc,
doc.name(), label, strong)); doc.name(), label, strong));
} else { } else {
return label; return label;
@ -1215,14 +1217,14 @@ public class HtmlDocletWriter extends HtmlDocWriter {
public Content getDocLink(int context, ClassDoc classDoc, MemberDoc doc, public Content getDocLink(int context, ClassDoc classDoc, MemberDoc doc,
String label) { String label) {
if (! (doc.isIncluded() || if (! (doc.isIncluded() ||
Util.isLinkable(classDoc, configuration()))) { Util.isLinkable(classDoc, configuration))) {
return new StringContent(label); return new StringContent(label);
} else if (doc instanceof ExecutableMemberDoc) { } else if (doc instanceof ExecutableMemberDoc) {
ExecutableMemberDoc emd = (ExecutableMemberDoc)doc; ExecutableMemberDoc emd = (ExecutableMemberDoc)doc;
return new RawHtml(getLink(new LinkInfoImpl(context, classDoc, return new RawHtml(getLink(new LinkInfoImpl(configuration, context, classDoc,
getAnchor(emd), label, false))); getAnchor(emd), label, false)));
} else if (doc instanceof MemberDoc) { } else if (doc instanceof MemberDoc) {
return new RawHtml(getLink(new LinkInfoImpl(context, classDoc, return new RawHtml(getLink(new LinkInfoImpl(configuration, context, classDoc,
doc.name(), label, false))); doc.name(), label, false)));
} else { } else {
return new StringContent(label); return new StringContent(label);
@ -1302,7 +1304,7 @@ public class HtmlDocletWriter extends HtmlDocWriter {
if (label.isEmpty()) { if (label.isEmpty()) {
label = plainOrCodeText(plain, refClass.name()); label = plainOrCodeText(plain, refClass.name());
} }
return getLink(new LinkInfoImpl(refClass, label)); return getLink(new LinkInfoImpl(configuration, refClass, label));
} else if (refMem == null) { } else if (refMem == null) {
// Must be a member reference since refClass is not null and refMemName is not null. // Must be a member reference since refClass is not null and refMemName is not null.
// However, refMem is null, so this referenced member does not exist. // However, refMem is null, so this referenced member does not exist.
@ -1313,7 +1315,7 @@ public class HtmlDocletWriter extends HtmlDocWriter {
ClassDoc containing = refMem.containingClass(); ClassDoc containing = refMem.containingClass();
if (see.text().trim().startsWith("#") && if (see.text().trim().startsWith("#") &&
! (containing.isPublic() || ! (containing.isPublic() ||
Util.isLinkable(containing, configuration()))) { Util.isLinkable(containing, configuration))) {
// Since the link is relative and the holder is not even being // Since the link is relative and the holder is not even being
// documented, this must be an inherited link. Redirect it. // documented, this must be an inherited link. Redirect it.
// The current class either overrides the referenced member or // The current class either overrides the referenced member or
@ -1502,7 +1504,7 @@ public class HtmlDocletWriter extends HtmlDocWriter {
StringBuilder textBuff = new StringBuilder(); StringBuilder textBuff = new StringBuilder();
while (lines.hasMoreTokens()) { while (lines.hasMoreTokens()) {
StringBuilder line = new StringBuilder(lines.nextToken()); StringBuilder line = new StringBuilder(lines.nextToken());
Util.replaceTabs(configuration.sourcetab, line); Util.replaceTabs(configuration, line);
textBuff.append(line.toString()); textBuff.append(line.toString());
} }
result.append(textBuff); result.append(textBuff);
@ -1686,6 +1688,17 @@ public class HtmlDocletWriter extends HtmlDocWriter {
return link; return link;
} }
/**
* Returns a link to the JavaScript file.
*
* @return an HtmlTree for the Script tag which provides the JavaScript location
*/
public HtmlTree getScriptProperties() {
HtmlTree script = HtmlTree.SCRIPT("text/javascript",
pathToRoot.resolve(DocPaths.JAVASCRIPT).getPath());
return script;
}
/** /**
* According to * According to
* <cite>The Java&trade; Language Specification</cite>, * <cite>The Java&trade; Language Specification</cite>,
@ -1784,7 +1797,7 @@ public class HtmlDocletWriter extends HtmlDocWriter {
continue; continue;
} }
annotation = new StringBuilder(); annotation = new StringBuilder();
LinkInfoImpl linkInfo = new LinkInfoImpl( LinkInfoImpl linkInfo = new LinkInfoImpl(configuration,
LinkInfoImpl.CONTEXT_ANNOTATION, annotationDoc); LinkInfoImpl.CONTEXT_ANNOTATION, annotationDoc);
linkInfo.label = "@" + annotationDoc.name(); linkInfo.label = "@" + annotationDoc.name();
annotation.append(getLink(linkInfo)); annotation.append(getLink(linkInfo));
@ -1835,7 +1848,7 @@ public class HtmlDocletWriter extends HtmlDocWriter {
if (annotationValue.value() instanceof Type) { if (annotationValue.value() instanceof Type) {
Type type = (Type) annotationValue.value(); Type type = (Type) annotationValue.value();
if (type.asClassDoc() != null) { if (type.asClassDoc() != null) {
LinkInfoImpl linkInfo = new LinkInfoImpl( LinkInfoImpl linkInfo = new LinkInfoImpl(configuration,
LinkInfoImpl.CONTEXT_ANNOTATION, type); LinkInfoImpl.CONTEXT_ANNOTATION, type);
linkInfo.label = (type.asClassDoc().isIncluded() ? linkInfo.label = (type.asClassDoc().isIncluded() ?
type.typeName() : type.typeName() :

View File

@ -130,7 +130,7 @@ public class HtmlSerialFieldWriter extends FieldWriterImpl
pre.addContent(fieldTypeStr); pre.addContent(fieldTypeStr);
} else { } else {
Content fieldContent = new RawHtml(writer.getLink(new LinkInfoImpl( Content fieldContent = new RawHtml(writer.getLink(new LinkInfoImpl(
LinkInfoImpl.CONTEXT_SERIAL_MEMBER, fieldType))); configuration, LinkInfoImpl.CONTEXT_SERIAL_MEMBER, fieldType)));
pre.addContent(fieldContent); pre.addContent(fieldContent);
} }
pre.addContent(fieldDimensions + " "); pre.addContent(fieldDimensions + " ");
@ -187,8 +187,8 @@ public class HtmlSerialFieldWriter extends FieldWriterImpl
*/ */
public void addMemberTags(FieldDoc field, Content contentTree) { public void addMemberTags(FieldDoc field, Content contentTree) {
TagletOutputImpl output = new TagletOutputImpl(""); TagletOutputImpl output = new TagletOutputImpl("");
TagletWriter.genTagOuput(configuration().tagletManager, field, TagletWriter.genTagOuput(configuration.tagletManager, field,
configuration().tagletManager.getCustomTags(field), configuration.tagletManager.getCustomTags(field),
writer.getTagletWriterInstance(false), output); writer.getTagletWriterInstance(false), output);
String outputString = output.toString().trim(); String outputString = output.toString().trim();
Content dlTags = new HtmlTree(HtmlTag.DL); Content dlTags = new HtmlTree(HtmlTag.DL);
@ -208,7 +208,7 @@ public class HtmlSerialFieldWriter extends FieldWriterImpl
* @return true if overview details need to be printed * @return true if overview details need to be printed
*/ */
public boolean shouldPrintOverview(FieldDoc field) { public boolean shouldPrintOverview(FieldDoc field) {
if (!configuration().nocomment) { if (!configuration.nocomment) {
if(!field.commentText().isEmpty() || if(!field.commentText().isEmpty() ||
writer.hasSerializationOverviewTags(field)) writer.hasSerializationOverviewTags(field))
return true; return true;

View File

@ -148,7 +148,7 @@ public class HtmlSerialMethodWriter extends MethodWriterImpl implements
public void addMemberTags(MethodDoc member, Content methodsContentTree) { public void addMemberTags(MethodDoc member, Content methodsContentTree) {
TagletOutputImpl output = new TagletOutputImpl(""); TagletOutputImpl output = new TagletOutputImpl("");
TagletManager tagletManager = TagletManager tagletManager =
ConfigurationImpl.getInstance().tagletManager; configuration.tagletManager;
TagletWriter.genTagOuput(tagletManager, member, TagletWriter.genTagOuput(tagletManager, member,
tagletManager.getSerializedFormTags(), tagletManager.getSerializedFormTags(),
writer.getTagletWriterInstance(false), output); writer.getTagletWriterInstance(false), output);

View File

@ -74,7 +74,7 @@ public class LinkFactoryImpl extends LinkFactory {
StringBuilder label = new StringBuilder( StringBuilder label = new StringBuilder(
classLinkInfo.getClassLinkLabel(m_writer.configuration)); classLinkInfo.getClassLinkLabel(m_writer.configuration));
classLinkInfo.displayLength += label.length(); classLinkInfo.displayLength += label.length();
Configuration configuration = ConfigurationImpl.getInstance(); Configuration configuration = m_writer.configuration;
LinkOutputImpl linkOutput = new LinkOutputImpl(); LinkOutputImpl linkOutput = new LinkOutputImpl();
if (classDoc.isIncluded()) { if (classDoc.isIncluded()) {
if (configuration.isGeneratedDoc(classDoc)) { if (configuration.isGeneratedDoc(classDoc)) {
@ -118,8 +118,8 @@ public class LinkFactoryImpl extends LinkFactory {
*/ */
protected LinkOutput getTypeParameterLink(LinkInfo linkInfo, protected LinkOutput getTypeParameterLink(LinkInfo linkInfo,
Type typeParam) { Type typeParam) {
LinkInfoImpl typeLinkInfo = new LinkInfoImpl(linkInfo.getContext(), LinkInfoImpl typeLinkInfo = new LinkInfoImpl(m_writer.configuration,
typeParam); linkInfo.getContext(), typeParam);
typeLinkInfo.excludeTypeBounds = linkInfo.excludeTypeBounds; typeLinkInfo.excludeTypeBounds = linkInfo.excludeTypeBounds;
typeLinkInfo.excludeTypeParameterLinks = linkInfo.excludeTypeParameterLinks; typeLinkInfo.excludeTypeParameterLinks = linkInfo.excludeTypeParameterLinks;
typeLinkInfo.linkToSelf = linkInfo.linkToSelf; typeLinkInfo.linkToSelf = linkInfo.linkToSelf;
@ -135,10 +135,10 @@ public class LinkFactoryImpl extends LinkFactory {
* @return the tool tip for the appropriate class. * @return the tool tip for the appropriate class.
*/ */
private String getClassToolTip(ClassDoc classDoc, boolean isTypeLink) { private String getClassToolTip(ClassDoc classDoc, boolean isTypeLink) {
Configuration configuration = ConfigurationImpl.getInstance(); Configuration configuration = m_writer.configuration;
if (isTypeLink) { if (isTypeLink) {
return configuration.getText("doclet.Href_Type_Param_Title", return configuration.getText("doclet.Href_Type_Param_Title",
classDoc.name()); classDoc.name());
} else if (classDoc.isInterface()){ } else if (classDoc.isInterface()){
return configuration.getText("doclet.Href_Interface_Title", return configuration.getText("doclet.Href_Interface_Title",
Util.getPackageName(classDoc.containingPackage())); Util.getPackageName(classDoc.containingPackage()));

View File

@ -198,6 +198,8 @@ public class LinkInfoImpl extends LinkInfo {
*/ */
public static final int CONTEXT_CLASS_USE_HEADER = 33; public static final int CONTEXT_CLASS_USE_HEADER = 33;
public final ConfigurationImpl configuration;
/** /**
* The integer indicating the location of the link. * The integer indicating the location of the link.
*/ */
@ -214,20 +216,22 @@ public class LinkInfoImpl extends LinkInfo {
public String styleName =""; public String styleName ="";
/** /**
* The valueof the target. * The value of the target.
*/ */
public String target = ""; public String target = "";
/** /**
* Construct a LinkInfo object. * Construct a LinkInfo object.
* *
* @param configuration the configuration data for the doclet
* @param context the context of the link. * @param context the context of the link.
* @param classDoc the class to link to. * @param classDoc the class to link to.
* @param label the label for the link. * @param label the label for the link.
* @param target the value of the target attribute. * @param target the value of the target attribute.
*/ */
public LinkInfoImpl (int context, ClassDoc classDoc, String label, public LinkInfoImpl(ConfigurationImpl configuration,
String target){ int context, ClassDoc classDoc, String label, String target) {
this.configuration = configuration;
this.classDoc = classDoc; this.classDoc = classDoc;
this.label = label; this.label = label;
this.target = target; this.target = target;
@ -237,6 +241,7 @@ public class LinkInfoImpl extends LinkInfo {
/** /**
* Construct a LinkInfo object. * Construct a LinkInfo object.
* *
* @param configuration the configuration data for the doclet
* @param context the context of the link. * @param context the context of the link.
* @param classDoc the class to link to. * @param classDoc the class to link to.
* @param where the value of the marker #. * @param where the value of the marker #.
@ -244,8 +249,10 @@ public class LinkInfoImpl extends LinkInfo {
* @param isStrong true if the link should be strong. * @param isStrong true if the link should be strong.
* @param styleName String style of text defined in style sheet. * @param styleName String style of text defined in style sheet.
*/ */
public LinkInfoImpl (int context, ClassDoc classDoc, String where, String label, public LinkInfoImpl(ConfigurationImpl configuration,
boolean isStrong, String styleName){ int context, ClassDoc classDoc, String where, String label,
boolean isStrong, String styleName) {
this.configuration = configuration;
this.classDoc = classDoc; this.classDoc = classDoc;
this.where = where; this.where = where;
this.label = label; this.label = label;
@ -257,14 +264,17 @@ public class LinkInfoImpl extends LinkInfo {
/** /**
* Construct a LinkInfo object. * Construct a LinkInfo object.
* *
* @param configuration the configuration data for the doclet
* @param context the context of the link. * @param context the context of the link.
* @param classDoc the class to link to. * @param classDoc the class to link to.
* @param where the value of the marker #. * @param where the value of the marker #.
* @param label the label for the link. * @param label the label for the link.
* @param isStrong true if the link should be strong. * @param isStrong true if the link should be strong.
*/ */
public LinkInfoImpl (int context, ClassDoc classDoc, String where, String label, public LinkInfoImpl(ConfigurationImpl configuration,
boolean isStrong){ int context, ClassDoc classDoc, String where, String label,
boolean isStrong) {
this.configuration = configuration;
this.classDoc = classDoc; this.classDoc = classDoc;
this.where = where; this.where = where;
this.label = label; this.label = label;
@ -275,10 +285,13 @@ public class LinkInfoImpl extends LinkInfo {
/** /**
* Construct a LinkInfo object. * Construct a LinkInfo object.
* *
* @param configuration the configuration data for the doclet
* @param classDoc the class to link to. * @param classDoc the class to link to.
* @param label the label for the link. * @param label the label for the link.
*/ */
public LinkInfoImpl (ClassDoc classDoc, String label){ public LinkInfoImpl(ConfigurationImpl configuration,
ClassDoc classDoc, String label) {
this.configuration = configuration;
this.classDoc = classDoc; this.classDoc = classDoc;
this.label = label; this.label = label;
setContext(context); setContext(context);
@ -287,12 +300,15 @@ public class LinkInfoImpl extends LinkInfo {
/** /**
* Construct a LinkInfo object. * Construct a LinkInfo object.
* *
* @param configuration the configuration data for the doclet
* @param context the context of the link. * @param context the context of the link.
* @param executableMemberDoc the member to link to. * @param executableMemberDoc the member to link to.
* @param isStrong true if the link should be strong. * @param isStrong true if the link should be strong.
*/ */
public LinkInfoImpl (int context, ExecutableMemberDoc executableMemberDoc, public LinkInfoImpl(ConfigurationImpl configuration,
boolean isStrong){ int context, ExecutableMemberDoc executableMemberDoc,
boolean isStrong) {
this.configuration = configuration;
this.executableMemberDoc = executableMemberDoc; this.executableMemberDoc = executableMemberDoc;
this.isStrong = isStrong; this.isStrong = isStrong;
setContext(context); setContext(context);
@ -301,11 +317,14 @@ public class LinkInfoImpl extends LinkInfo {
/** /**
* Construct a LinkInfo object. * Construct a LinkInfo object.
* *
* @param configuration the configuration data for the doclet
* @param context the context of the link. * @param context the context of the link.
* @param classDoc the class to link to. * @param classDoc the class to link to.
* @param isStrong true if the link should be strong. * @param isStrong true if the link should be strong.
*/ */
public LinkInfoImpl (int context, ClassDoc classDoc, boolean isStrong){ public LinkInfoImpl(ConfigurationImpl configuration,
int context, ClassDoc classDoc, boolean isStrong) {
this.configuration = configuration;
this.classDoc = classDoc; this.classDoc = classDoc;
this.isStrong = isStrong; this.isStrong = isStrong;
setContext(context); setContext(context);
@ -314,10 +333,13 @@ public class LinkInfoImpl extends LinkInfo {
/** /**
* Construct a LinkInfo object. * Construct a LinkInfo object.
* *
* @param configuration the configuration data for the doclet
* @param context the context of the link. * @param context the context of the link.
* @param type the class to link to. * @param type the class to link to.
*/ */
public LinkInfoImpl (int context, Type type){ public LinkInfoImpl(ConfigurationImpl configuration,
int context, Type type) {
this.configuration = configuration;
this.type = type; this.type = type;
setContext(context); setContext(context);
} }
@ -325,11 +347,14 @@ public class LinkInfoImpl extends LinkInfo {
/** /**
* Construct a LinkInfo object. * Construct a LinkInfo object.
* *
* @param configuration the configuration data for the doclet
* @param context the context of the link. * @param context the context of the link.
* @param type the class to link to. * @param type the class to link to.
* @param isVarArg true if this is a link to a var arg. * @param isVarArg true if this is a link to a var arg.
*/ */
public LinkInfoImpl (int context, Type type, boolean isVarArg){ public LinkInfoImpl(ConfigurationImpl configuration,
int context, Type type, boolean isVarArg) {
this.configuration = configuration;
this.type = type; this.type = type;
this.isVarArg = isVarArg; this.isVarArg = isVarArg;
setContext(context); setContext(context);
@ -338,13 +363,16 @@ public class LinkInfoImpl extends LinkInfo {
/** /**
* Construct a LinkInfo object. * Construct a LinkInfo object.
* *
* @param configuration the configuration data for the doclet
* @param context the context of the link. * @param context the context of the link.
* @param type the class to link to. * @param type the class to link to.
* @param label the label for the link. * @param label the label for the link.
* @param isStrong true if the link should be strong. * @param isStrong true if the link should be strong.
*/ */
public LinkInfoImpl (int context, Type type, String label, public LinkInfoImpl(ConfigurationImpl configuration,
boolean isStrong){ int context, Type type, String label,
boolean isStrong) {
this.configuration = configuration;
this.type = type; this.type = type;
this.label = label; this.label = label;
this.isStrong = isStrong; this.isStrong = isStrong;
@ -354,13 +382,16 @@ public class LinkInfoImpl extends LinkInfo {
/** /**
* Construct a LinkInfo object. * Construct a LinkInfo object.
* *
* @param configuration the configuration data for the doclet
* @param context the context of the link. * @param context the context of the link.
* @param classDoc the class to link to. * @param classDoc the class to link to.
* @param label the label for the link. * @param label the label for the link.
* @param isStrong true if the link should be strong. * @param isStrong true if the link should be strong.
*/ */
public LinkInfoImpl (int context, ClassDoc classDoc, String label, public LinkInfoImpl(ConfigurationImpl configuration,
boolean isStrong){ int context, ClassDoc classDoc, String label,
boolean isStrong) {
this.configuration = configuration;
this.classDoc = classDoc; this.classDoc = classDoc;
this.label = label; this.label = label;
this.isStrong = isStrong; this.isStrong = isStrong;
@ -448,6 +479,6 @@ public class LinkInfoImpl extends LinkInfo {
* desired place. * desired place.
*/ */
public boolean isLinkable() { public boolean isLinkable() {
return Util.isLinkable(classDoc, ConfigurationImpl.getInstance()); return Util.isLinkable(classDoc, configuration);
} }
} }

View File

@ -123,7 +123,7 @@ public class MethodWriterImpl extends AbstractExecutableMemberWriter
addModifiers(method, pre); addModifiers(method, pre);
addTypeParameters(method, pre); addTypeParameters(method, pre);
addReturnType(method, pre); addReturnType(method, pre);
if (configuration().linksource) { if (configuration.linksource) {
Content methodName = new StringContent(method.name()); Content methodName = new StringContent(method.name());
writer.addSrcLink(method, methodName, pre); writer.addSrcLink(method, methodName, pre);
} else { } else {
@ -149,7 +149,7 @@ public class MethodWriterImpl extends AbstractExecutableMemberWriter
if (method.inlineTags().length > 0) { if (method.inlineTags().length > 0) {
if (holder.asClassDoc().equals(classdoc) || if (holder.asClassDoc().equals(classdoc) ||
(! (holderClassDoc.isPublic() || (! (holderClassDoc.isPublic() ||
Util.isLinkable(holderClassDoc, configuration())))) { Util.isLinkable(holderClassDoc, configuration)))) {
writer.addInlineComment(method, methodDocTree); writer.addInlineComment(method, methodDocTree);
} else { } else {
Content link = new RawHtml( Content link = new RawHtml(
@ -215,16 +215,16 @@ public class MethodWriterImpl extends AbstractExecutableMemberWriter
* {@inheritDoc} * {@inheritDoc}
*/ */
public String getTableSummary() { public String getTableSummary() {
return configuration().getText("doclet.Member_Table_Summary", return configuration.getText("doclet.Member_Table_Summary",
configuration().getText("doclet.Method_Summary"), configuration.getText("doclet.Method_Summary"),
configuration().getText("doclet.methods")); configuration.getText("doclet.methods"));
} }
/** /**
* {@inheritDoc} * {@inheritDoc}
*/ */
public String getCaption() { public String getCaption() {
return configuration().getText("doclet.Methods"); return configuration.getText("doclet.Methods");
} }
/** /**
@ -233,9 +233,9 @@ public class MethodWriterImpl extends AbstractExecutableMemberWriter
public String[] getSummaryTableHeader(ProgramElementDoc member) { public String[] getSummaryTableHeader(ProgramElementDoc member) {
String[] header = new String[] { String[] header = new String[] {
writer.getModifierTypeHeader(), writer.getModifierTypeHeader(),
configuration().getText("doclet.0_and_1", configuration.getText("doclet.0_and_1",
configuration().getText("doclet.Method"), configuration.getText("doclet.Method"),
configuration().getText("doclet.Description")) configuration.getText("doclet.Description"))
}; };
return header; return header;
} }
@ -253,7 +253,7 @@ public class MethodWriterImpl extends AbstractExecutableMemberWriter
public void addInheritedSummaryAnchor(ClassDoc cd, Content inheritedTree) { public void addInheritedSummaryAnchor(ClassDoc cd, Content inheritedTree) {
inheritedTree.addContent(writer.getMarkerAnchor( inheritedTree.addContent(writer.getMarkerAnchor(
"methods_inherited_from_class_" + "methods_inherited_from_class_" +
configuration().getClassName(cd))); configuration.getClassName(cd)));
} }
/** /**
@ -263,8 +263,8 @@ public class MethodWriterImpl extends AbstractExecutableMemberWriter
Content classLink = new RawHtml(writer.getPreQualifiedClassLink( Content classLink = new RawHtml(writer.getPreQualifiedClassLink(
LinkInfoImpl.CONTEXT_MEMBER, cd, false)); LinkInfoImpl.CONTEXT_MEMBER, cd, false));
Content label = new StringContent(cd.isClass() ? Content label = new StringContent(cd.isClass() ?
configuration().getText("doclet.Methods_Inherited_From_Class") : configuration.getText("doclet.Methods_Inherited_From_Class") :
configuration().getText("doclet.Methods_Inherited_From_Interface")); configuration.getText("doclet.Methods_Inherited_From_Interface"));
Content labelHeading = HtmlTree.HEADING(HtmlConstants.INHERITED_SUMMARY_HEADING, Content labelHeading = HtmlTree.HEADING(HtmlConstants.INHERITED_SUMMARY_HEADING,
label); label);
labelHeading.addContent(writer.getSpace()); labelHeading.addContent(writer.getSpace());
@ -285,12 +285,12 @@ public class MethodWriterImpl extends AbstractExecutableMemberWriter
*/ */
protected static void addOverridden(HtmlDocletWriter writer, protected static void addOverridden(HtmlDocletWriter writer,
Type overriddenType, MethodDoc method, Content dl) { Type overriddenType, MethodDoc method, Content dl) {
if(writer.configuration.nocomment){ if (writer.configuration.nocomment) {
return; return;
} }
ClassDoc holderClassDoc = overriddenType.asClassDoc(); ClassDoc holderClassDoc = overriddenType.asClassDoc();
if (! (holderClassDoc.isPublic() || if (! (holderClassDoc.isPublic() ||
Util.isLinkable(holderClassDoc, writer.configuration()))) { Util.isLinkable(holderClassDoc, writer.configuration))) {
//This is an implementation detail that should not be documented. //This is an implementation detail that should not be documented.
return; return;
} }
@ -303,7 +303,7 @@ public class MethodWriterImpl extends AbstractExecutableMemberWriter
int context = LinkInfoImpl.CONTEXT_METHOD_OVERRIDES; int context = LinkInfoImpl.CONTEXT_METHOD_OVERRIDES;
if (method != null) { if (method != null) {
if(overriddenType.asClassDoc().isAbstract() && method.isAbstract()){ if (overriddenType.asClassDoc().isAbstract() && method.isAbstract()){
//Abstract method is implemented from abstract class, //Abstract method is implemented from abstract class,
//not overridden //not overridden
label = writer.specifiedByLabel; label = writer.specifiedByLabel;
@ -312,11 +312,11 @@ public class MethodWriterImpl extends AbstractExecutableMemberWriter
Content dt = HtmlTree.DT(HtmlTree.STRONG(label)); Content dt = HtmlTree.DT(HtmlTree.STRONG(label));
dl.addContent(dt); dl.addContent(dt);
Content overriddenTypeLink = new RawHtml( Content overriddenTypeLink = new RawHtml(
writer.getLink(new LinkInfoImpl(context, overriddenType))); writer.getLink(new LinkInfoImpl(writer.configuration, context, overriddenType)));
Content codeOverridenTypeLink = HtmlTree.CODE(overriddenTypeLink); Content codeOverridenTypeLink = HtmlTree.CODE(overriddenTypeLink);
String name = method.name(); String name = method.name();
Content methlink = new RawHtml(writer.getLink( Content methlink = new RawHtml(writer.getLink(
new LinkInfoImpl(LinkInfoImpl.CONTEXT_MEMBER, new LinkInfoImpl(writer.configuration, LinkInfoImpl.CONTEXT_MEMBER,
overriddenType.asClassDoc(), overriddenType.asClassDoc(),
writer.getAnchor(method), name, false))); writer.getAnchor(method), name, false)));
Content codeMethLink = HtmlTree.CODE(methlink); Content codeMethLink = HtmlTree.CODE(methlink);
@ -362,7 +362,7 @@ public class MethodWriterImpl extends AbstractExecutableMemberWriter
MethodDoc implementedMeth = implementedMethods[i]; MethodDoc implementedMeth = implementedMethods[i];
Type intfac = implementedMethodsFinder.getMethodHolder(implementedMeth); Type intfac = implementedMethodsFinder.getMethodHolder(implementedMeth);
Content intfaclink = new RawHtml(writer.getLink(new LinkInfoImpl( Content intfaclink = new RawHtml(writer.getLink(new LinkInfoImpl(
LinkInfoImpl.CONTEXT_METHOD_SPECIFIED_BY, intfac))); writer.configuration, LinkInfoImpl.CONTEXT_METHOD_SPECIFIED_BY, intfac)));
Content codeIntfacLink = HtmlTree.CODE(intfaclink); Content codeIntfacLink = HtmlTree.CODE(intfaclink);
Content dt = HtmlTree.DT(HtmlTree.STRONG(writer.specifiedByLabel)); Content dt = HtmlTree.DT(HtmlTree.STRONG(writer.specifiedByLabel));
dl.addContent(dt); dl.addContent(dt);
@ -389,7 +389,7 @@ public class MethodWriterImpl extends AbstractExecutableMemberWriter
Type type = method.returnType(); Type type = method.returnType();
if (type != null) { if (type != null) {
Content linkContent = new RawHtml(writer.getLink( Content linkContent = new RawHtml(writer.getLink(
new LinkInfoImpl(LinkInfoImpl.CONTEXT_RETURN_TYPE, type))); new LinkInfoImpl(configuration, LinkInfoImpl.CONTEXT_RETURN_TYPE, type)));
htmltree.addContent(linkContent); htmltree.addContent(linkContent);
htmltree.addContent(writer.getSpace()); htmltree.addContent(writer.getSpace());
} }
@ -403,7 +403,7 @@ public class MethodWriterImpl extends AbstractExecutableMemberWriter
return writer.getHyperLink((cd == null)? return writer.getHyperLink((cd == null)?
"method_summary": "method_summary":
"methods_inherited_from_class_" + "methods_inherited_from_class_" +
configuration().getClassName(cd), configuration.getClassName(cd),
writer.getResource("doclet.navMethod")); writer.getResource("doclet.navMethod"));
} else { } else {
return writer.getResource("doclet.navMethod"); return writer.getResource("doclet.navMethod");

View File

@ -93,16 +93,16 @@ public class NestedClassWriterImpl extends AbstractMemberWriter
* {@inheritDoc} * {@inheritDoc}
*/ */
public String getTableSummary() { public String getTableSummary() {
return configuration().getText("doclet.Member_Table_Summary", return configuration.getText("doclet.Member_Table_Summary",
configuration().getText("doclet.Nested_Class_Summary"), configuration.getText("doclet.Nested_Class_Summary"),
configuration().getText("doclet.nested_classes")); configuration.getText("doclet.nested_classes"));
} }
/** /**
* {@inheritDoc} * {@inheritDoc}
*/ */
public String getCaption() { public String getCaption() {
return configuration().getText("doclet.Nested_Classes"); return configuration.getText("doclet.Nested_Classes");
} }
/** /**
@ -113,17 +113,17 @@ public class NestedClassWriterImpl extends AbstractMemberWriter
if (member.isInterface()) { if (member.isInterface()) {
header = new String[] { header = new String[] {
writer.getModifierTypeHeader(), writer.getModifierTypeHeader(),
configuration().getText("doclet.0_and_1", configuration.getText("doclet.0_and_1",
configuration().getText("doclet.Interface"), configuration.getText("doclet.Interface"),
configuration().getText("doclet.Description")) configuration.getText("doclet.Description"))
}; };
} }
else { else {
header = new String[] { header = new String[] {
writer.getModifierTypeHeader(), writer.getModifierTypeHeader(),
configuration().getText("doclet.0_and_1", configuration.getText("doclet.0_and_1",
configuration().getText("doclet.Class"), configuration.getText("doclet.Class"),
configuration().getText("doclet.Description")) configuration.getText("doclet.Description"))
}; };
} }
return header; return header;
@ -151,8 +151,8 @@ public class NestedClassWriterImpl extends AbstractMemberWriter
Content classLink = new RawHtml(writer.getPreQualifiedClassLink( Content classLink = new RawHtml(writer.getPreQualifiedClassLink(
LinkInfoImpl.CONTEXT_MEMBER, cd, false)); LinkInfoImpl.CONTEXT_MEMBER, cd, false));
Content label = new StringContent(cd.isInterface() ? Content label = new StringContent(cd.isInterface() ?
configuration().getText("doclet.Nested_Classes_Interface_Inherited_From_Interface") : configuration.getText("doclet.Nested_Classes_Interface_Inherited_From_Interface") :
configuration().getText("doclet.Nested_Classes_Interfaces_Inherited_From_Class")); configuration.getText("doclet.Nested_Classes_Interfaces_Inherited_From_Class"));
Content labelHeading = HtmlTree.HEADING(HtmlConstants.INHERITED_SUMMARY_HEADING, Content labelHeading = HtmlTree.HEADING(HtmlConstants.INHERITED_SUMMARY_HEADING,
label); label);
labelHeading.addContent(writer.getSpace()); labelHeading.addContent(writer.getSpace());
@ -166,7 +166,7 @@ public class NestedClassWriterImpl extends AbstractMemberWriter
protected void addSummaryLink(int context, ClassDoc cd, ProgramElementDoc member, protected void addSummaryLink(int context, ClassDoc cd, ProgramElementDoc member,
Content tdSummary) { Content tdSummary) {
Content strong = HtmlTree.STRONG(new RawHtml( Content strong = HtmlTree.STRONG(new RawHtml(
writer.getLink(new LinkInfoImpl(context, (ClassDoc)member, false)))); writer.getLink(new LinkInfoImpl(configuration, context, (ClassDoc)member, false))));
Content code = HtmlTree.CODE(strong); Content code = HtmlTree.CODE(strong);
tdSummary.addContent(code); tdSummary.addContent(code);
} }
@ -177,7 +177,7 @@ public class NestedClassWriterImpl extends AbstractMemberWriter
protected void addInheritedSummaryLink(ClassDoc cd, protected void addInheritedSummaryLink(ClassDoc cd,
ProgramElementDoc member, Content linksTree) { ProgramElementDoc member, Content linksTree) {
linksTree.addContent(new RawHtml( linksTree.addContent(new RawHtml(
writer.getLink(new LinkInfoImpl(LinkInfoImpl.CONTEXT_MEMBER, writer.getLink(new LinkInfoImpl(configuration, LinkInfoImpl.CONTEXT_MEMBER,
(ClassDoc)member, false)))); (ClassDoc)member, false))));
} }

View File

@ -121,7 +121,7 @@ public class PackageFrameWriter extends HtmlDocletWriter {
* @param contentTree the content tree to which the listing will be added * @param contentTree the content tree to which the listing will be added
*/ */
protected void addClassListing(Content contentTree) { protected void addClassListing(Content contentTree) {
Configuration config = configuration(); Configuration config = configuration;
if (packageDoc.isIncluded()) { if (packageDoc.isIncluded()) {
addClassKindListing(packageDoc.interfaces(), addClassKindListing(packageDoc.interfaces(),
getResource("doclet.Interfaces"), contentTree); getResource("doclet.Interfaces"), contentTree);
@ -181,7 +181,7 @@ public class PackageFrameWriter extends HtmlDocletWriter {
contentTree.addContent(heading); contentTree.addContent(heading);
printedHeader = true; printedHeader = true;
} }
Content link = new RawHtml (getLink(new LinkInfoImpl( Content link = new RawHtml (getLink(new LinkInfoImpl(configuration,
LinkInfoImpl.PACKAGE_FRAME, arr[i], LinkInfoImpl.PACKAGE_FRAME, arr[i],
(arr[i].isInterface() ? italicsText(arr[i].name()) : (arr[i].isInterface() ? italicsText(arr[i].name()) :
arr[i].name()),"classFrame"))); arr[i].name()),"classFrame")));

View File

@ -152,7 +152,7 @@ public class PackageUseWriter extends SubWriterHolderWriter {
*/ */
protected void addPackageList(Content contentTree) throws IOException { protected void addPackageList(Content contentTree) throws IOException {
Content table = HtmlTree.TABLE(0, 3, 0, useTableSummary, Content table = HtmlTree.TABLE(0, 3, 0, useTableSummary,
getTableCaption(configuration().getText( getTableCaption(configuration.getText(
"doclet.ClassUse_Packages.that.use.0", "doclet.ClassUse_Packages.that.use.0",
getPackageLinkString(pkgdoc, Util.getPackageName(pkgdoc), false)))); getPackageLinkString(pkgdoc, Util.getPackageName(pkgdoc), false))));
table.addContent(getSummaryTableHeader(packageTableHeader, "col")); table.addContent(getSummaryTableHeader(packageTableHeader, "col"));
@ -197,7 +197,7 @@ public class PackageUseWriter extends SubWriterHolderWriter {
String tableSummary = configuration.getText("doclet.Use_Table_Summary", String tableSummary = configuration.getText("doclet.Use_Table_Summary",
configuration.getText("doclet.classes")); configuration.getText("doclet.classes"));
Content table = HtmlTree.TABLE(0, 3, 0, tableSummary, Content table = HtmlTree.TABLE(0, 3, 0, tableSummary,
getTableCaption(configuration().getText( getTableCaption(configuration.getText(
"doclet.ClassUse_Classes.in.0.used.by.1", "doclet.ClassUse_Classes.in.0.used.by.1",
getPackageLinkString(pkgdoc, Util.getPackageName(pkgdoc), false), getPackageLinkString(pkgdoc, Util.getPackageName(pkgdoc), false),
getPackageLinkString(usingPackage,Util.getPackageName(usingPackage), false)))); getPackageLinkString(usingPackage,Util.getPackageName(usingPackage), false))));

View File

@ -179,7 +179,8 @@ public class PackageWriterImpl extends HtmlDocletWriter
continue; continue;
} }
Content classContent = new RawHtml(getLink(new LinkInfoImpl( Content classContent = new RawHtml(getLink(new LinkInfoImpl(
LinkInfoImpl.CONTEXT_PACKAGE, classes[i], false))); configuration, LinkInfoImpl.CONTEXT_PACKAGE, classes[i],
false)));
Content tdClass = HtmlTree.TD(HtmlStyle.colFirst, classContent); Content tdClass = HtmlTree.TD(HtmlStyle.colFirst, classContent);
HtmlTree tr = HtmlTree.TR(tdClass); HtmlTree tr = HtmlTree.TR(tdClass);
if (i%2 == 0) if (i%2 == 0)

View File

@ -46,11 +46,13 @@ public class SerializedFormWriterImpl extends SubWriterHolderWriter
implements SerializedFormWriter { implements SerializedFormWriter {
/** /**
* @param configuration the configuration data for the doclet
* @throws IOException * @throws IOException
* @throws DocletAbortException * @throws DocletAbortException
*/ */
public SerializedFormWriterImpl() throws IOException { public SerializedFormWriterImpl(ConfigurationImpl configuration)
super(ConfigurationImpl.getInstance(), DocPaths.SERIALIZED_FORM); throws IOException {
super(configuration, DocPaths.SERIALIZED_FORM);
} }
/** /**
@ -126,15 +128,16 @@ public class SerializedFormWriterImpl extends SubWriterHolderWriter
*/ */
public Content getClassHeader(ClassDoc classDoc) { public Content getClassHeader(ClassDoc classDoc) {
String classLink = (classDoc.isPublic() || classDoc.isProtected())? String classLink = (classDoc.isPublic() || classDoc.isProtected())?
getLink(new LinkInfoImpl(classDoc, getLink(new LinkInfoImpl(configuration, classDoc,
configuration.getClassName(classDoc))): configuration.getClassName(classDoc))):
classDoc.qualifiedName(); classDoc.qualifiedName();
Content li = HtmlTree.LI(HtmlStyle.blockList, getMarkerAnchor( Content li = HtmlTree.LI(HtmlStyle.blockList, getMarkerAnchor(
classDoc.qualifiedName())); classDoc.qualifiedName()));
String superClassLink = String superClassLink =
classDoc.superclassType() != null ? classDoc.superclassType() != null ?
getLink(new LinkInfoImpl(LinkInfoImpl.CONTEXT_SERIALIZED_FORM, getLink(new LinkInfoImpl(configuration,
classDoc.superclassType())) : LinkInfoImpl.CONTEXT_SERIALIZED_FORM,
classDoc.superclassType())) :
null; null;
//Print the heading. //Print the heading.

View File

@ -60,16 +60,24 @@ public class SourceToHTMLConverter {
*/ */
private static final Content NEW_LINE = new RawHtml(DocletConstants.NL); private static final Content NEW_LINE = new RawHtml(DocletConstants.NL);
private final ConfigurationImpl configuration;
private final RootDoc rootDoc;
private DocPath outputdir;
/** /**
* Relative path from the documentation root to the file that is being * Relative path from the documentation root to the file that is being
* generated. * generated.
*/ */
private static DocPath relativePath = DocPath.empty; private DocPath relativePath = DocPath.empty;
/** private SourceToHTMLConverter(ConfigurationImpl configuration, RootDoc rd,
* Source is converted to HTML using static methods below. DocPath outputdir) {
*/ this.configuration = configuration;
private SourceToHTMLConverter() {} this.rootDoc = rd;
this.outputdir = outputdir;
}
/** /**
* Convert the Classes in the given RootDoc to an HTML. * Convert the Classes in the given RootDoc to an HTML.
@ -80,36 +88,38 @@ public class SourceToHTMLConverter {
*/ */
public static void convertRoot(ConfigurationImpl configuration, RootDoc rd, public static void convertRoot(ConfigurationImpl configuration, RootDoc rd,
DocPath outputdir) { DocPath outputdir) {
if (rd == null || outputdir == null) { new SourceToHTMLConverter(configuration, rd, outputdir).generate();
}
void generate() {
if (rootDoc == null || outputdir == null) {
return; return;
} }
PackageDoc[] pds = rd.specifiedPackages(); PackageDoc[] pds = rootDoc.specifiedPackages();
for (int i = 0; i < pds.length; i++) { for (int i = 0; i < pds.length; i++) {
// If -nodeprecated option is set and the package is marked as deprecated, // If -nodeprecated option is set and the package is marked as deprecated,
// do not convert the package files to HTML. // do not convert the package files to HTML.
if (!(configuration.nodeprecated && Util.isDeprecated(pds[i]))) if (!(configuration.nodeprecated && Util.isDeprecated(pds[i])))
convertPackage(configuration, pds[i], outputdir); convertPackage(pds[i], outputdir);
} }
ClassDoc[] cds = rd.specifiedClasses(); ClassDoc[] cds = rootDoc.specifiedClasses();
for (int i = 0; i < cds.length; i++) { for (int i = 0; i < cds.length; i++) {
// If -nodeprecated option is set and the class is marked as deprecated // If -nodeprecated option is set and the class is marked as deprecated
// or the containing package is deprecated, do not convert the // or the containing package is deprecated, do not convert the
// package files to HTML. // package files to HTML.
if (!(configuration.nodeprecated && if (!(configuration.nodeprecated &&
(Util.isDeprecated(cds[i]) || Util.isDeprecated(cds[i].containingPackage())))) (Util.isDeprecated(cds[i]) || Util.isDeprecated(cds[i].containingPackage()))))
convertClass(configuration, cds[i], outputdir); convertClass(cds[i], outputdir);
} }
} }
/** /**
* Convert the Classes in the given Package to an HTML. * Convert the Classes in the given Package to an HTML.
* *
* @param configuration the configuration.
* @param pd the Package to convert. * @param pd the Package to convert.
* @param outputdir the name of the directory to output to. * @param outputdir the name of the directory to output to.
*/ */
public static void convertPackage(ConfigurationImpl configuration, PackageDoc pd, public void convertPackage(PackageDoc pd, DocPath outputdir) {
DocPath outputdir) {
if (pd == null) { if (pd == null) {
return; return;
} }
@ -120,19 +130,17 @@ public class SourceToHTMLConverter {
// containing package deprecation since it is already check in // containing package deprecation since it is already check in
// the calling method above. // the calling method above.
if (!(configuration.nodeprecated && Util.isDeprecated(cds[i]))) if (!(configuration.nodeprecated && Util.isDeprecated(cds[i])))
convertClass(configuration, cds[i], outputdir); convertClass(cds[i], outputdir);
} }
} }
/** /**
* Convert the given Class to an HTML. * Convert the given Class to an HTML.
* *
* @param configuration the configuration.
* @param cd the class to convert. * @param cd the class to convert.
* @param outputdir the name of the directory to output to. * @param outputdir the name of the directory to output to.
*/ */
public static void convertClass(ConfigurationImpl configuration, ClassDoc cd, public void convertClass(ClassDoc cd, DocPath outputdir) {
DocPath outputdir) {
if (cd == null) { if (cd == null) {
return; return;
} }
@ -164,7 +172,7 @@ public class SourceToHTMLConverter {
try { try {
while ((line = reader.readLine()) != null) { while ((line = reader.readLine()) != null) {
addLineNo(pre, lineno); addLineNo(pre, lineno);
addLine(pre, line, configuration.sourcetab, lineno); addLine(pre, line, lineno);
lineno++; lineno++;
} }
} finally { } finally {
@ -173,7 +181,7 @@ public class SourceToHTMLConverter {
addBlankLines(pre); addBlankLines(pre);
Content div = HtmlTree.DIV(HtmlStyle.sourceContainer, pre); Content div = HtmlTree.DIV(HtmlStyle.sourceContainer, pre);
body.addContent(div); body.addContent(div);
writeToFile(body, outputdir.resolve(DocPath.forClass(cd)), configuration); writeToFile(body, outputdir.resolve(DocPath.forClass(cd)));
} catch (IOException e) { } catch (IOException e) {
e.printStackTrace(); e.printStackTrace();
} }
@ -184,15 +192,13 @@ public class SourceToHTMLConverter {
* *
* @param body the documentation content to be written to the file. * @param body the documentation content to be written to the file.
* @param path the path for the file. * @param path the path for the file.
* @param configuration the Doclet configuration to pass notices to.
*/ */
private static void writeToFile(Content body, DocPath path, private void writeToFile(Content body, DocPath path) throws IOException {
ConfigurationImpl configuration) throws IOException { Content htmlDocType = DocType.TRANSITIONAL;
Content htmlDocType = DocType.Transitional();
Content head = new HtmlTree(HtmlTag.HEAD); Content head = new HtmlTree(HtmlTag.HEAD);
head.addContent(HtmlTree.TITLE(new StringContent( head.addContent(HtmlTree.TITLE(new StringContent(
configuration.getText("doclet.Window_Source_title")))); configuration.getText("doclet.Window_Source_title"))));
head.addContent(getStyleSheetProperties(configuration)); head.addContent(getStyleSheetProperties());
Content htmlTree = HtmlTree.HTML(configuration.getLocale().getLanguage(), Content htmlTree = HtmlTree.HTML(configuration.getLocale().getLanguage(),
head, body); head, body);
Content htmlDocument = new HtmlDocument(htmlDocType, htmlTree); Content htmlDocument = new HtmlDocument(htmlDocType, htmlTree);
@ -210,10 +216,9 @@ public class SourceToHTMLConverter {
/** /**
* Returns a link to the stylesheet file. * Returns a link to the stylesheet file.
* *
* @param configuration the doclet configuration for the current run of javadoc
* @return an HtmlTree for the lINK tag which provides the stylesheet location * @return an HtmlTree for the lINK tag which provides the stylesheet location
*/ */
public static HtmlTree getStyleSheetProperties(ConfigurationImpl configuration) { public HtmlTree getStyleSheetProperties() {
String filename = configuration.stylesheetfile; String filename = configuration.stylesheetfile;
DocPath stylesheet; DocPath stylesheet;
if (filename.length() > 0) { if (filename.length() > 0) {
@ -260,14 +265,13 @@ public class SourceToHTMLConverter {
* *
* @param pre the content tree to which the line will be added. * @param pre the content tree to which the line will be added.
* @param line the string to format. * @param line the string to format.
* @param tabLength the number of spaces for each tab.
* @param currentLineNo the current number. * @param currentLineNo the current number.
*/ */
private static void addLine(Content pre, String line, int tabLength, private void addLine(Content pre, String line, int currentLineNo) {
int currentLineNo) {
if (line != null) { if (line != null) {
StringBuilder lineBuffer = new StringBuilder(Util.escapeHtmlChars(line)); StringBuilder lineBuffer = new StringBuilder(line);
Util.replaceTabs(tabLength, lineBuffer); Util.replaceTabs(configuration, lineBuffer);
Util.escapeHtmlChars(lineBuffer);
pre.addContent(new RawHtml(lineBuffer.toString())); pre.addContent(new RawHtml(lineBuffer.toString()));
Content anchor = HtmlTree.A_NAME("line." + Integer.toString(currentLineNo)); Content anchor = HtmlTree.A_NAME("line." + Integer.toString(currentLineNo));
pre.addContent(anchor); pre.addContent(anchor);

View File

@ -26,6 +26,7 @@
package com.sun.tools.doclets.formats.html; package com.sun.tools.doclets.formats.html;
import java.io.*; import java.io.*;
import java.util.*;
import com.sun.javadoc.*; import com.sun.javadoc.*;
import com.sun.tools.doclets.formats.html.markup.*; import com.sun.tools.doclets.formats.html.markup.*;
@ -77,15 +78,70 @@ public abstract class SubWriterHolderWriter extends HtmlDocletWriter {
* *
* @param mw the writer for the member being documented * @param mw the writer for the member being documented
* @param cd the classdoc to be documented * @param cd the classdoc to be documented
* @param tableContents list of summary table contents
* @param showTabs true if the table needs to show tabs
* @return the content tree for the summary table * @return the content tree for the summary table
*/ */
public Content getSummaryTableTree(AbstractMemberWriter mw, ClassDoc cd) { public Content getSummaryTableTree(AbstractMemberWriter mw, ClassDoc cd,
List<Content> tableContents, boolean showTabs) {
Content caption;
if (showTabs) {
caption = getTableCaption(mw.methodTypes);
generateMethodTypesScript(mw.typeMap, mw.methodTypes);
}
else {
caption = getTableCaption(mw.getCaption());
}
Content table = HtmlTree.TABLE(HtmlStyle.overviewSummary, 0, 3, 0, Content table = HtmlTree.TABLE(HtmlStyle.overviewSummary, 0, 3, 0,
mw.getTableSummary(), getTableCaption(mw.getCaption())); mw.getTableSummary(), caption);
table.addContent(getSummaryTableHeader(mw.getSummaryTableHeader(cd), "col")); table.addContent(getSummaryTableHeader(mw.getSummaryTableHeader(cd), "col"));
for (int i = 0; i < tableContents.size(); i++) {
table.addContent(tableContents.get(i));
}
return table; return table;
} }
/**
* Get the summary table caption.
*
* @param methodTypes set comprising of method types to show as table caption
* @return the caption for the summary table
*/
public Content getTableCaption(Set<MethodTypes> methodTypes) {
Content tabbedCaption = new HtmlTree(HtmlTag.CAPTION);
for (MethodTypes type : methodTypes) {
Content captionSpan;
Content span;
if (type.isDefaultTab()) {
captionSpan = HtmlTree.SPAN(new StringContent(type.text()));
span = HtmlTree.SPAN(type.tabId(),
HtmlStyle.activeTableTab, captionSpan);
} else {
captionSpan = HtmlTree.SPAN(getMethodTypeLinks(type));
span = HtmlTree.SPAN(type.tabId(),
HtmlStyle.tableTab, captionSpan);
}
Content tabSpan = HtmlTree.SPAN(HtmlStyle.tabEnd, getSpace());
span.addContent(tabSpan);
tabbedCaption.addContent(span);
}
return tabbedCaption;
}
/**
* Get the method type links for the table caption.
*
* @param methodType the method type to be displayed as link
* @return the content tree for the method type link
*/
public Content getMethodTypeLinks(MethodTypes methodType) {
StringBuilder jsShow = new StringBuilder("javascript:show(");
jsShow.append(methodType.value()).append(");");
HtmlTree link = HtmlTree.A(jsShow.toString(),
new StringContent(methodType.text()));
return link;
}
/** /**
* Add the inherited summary header. * Add the inherited summary header.
* *

View File

@ -46,11 +46,13 @@ import com.sun.tools.doclets.internal.toolkit.util.*;
public class TagletWriterImpl extends TagletWriter { public class TagletWriterImpl extends TagletWriter {
private HtmlDocletWriter htmlWriter; private final HtmlDocletWriter htmlWriter;
private final ConfigurationImpl configuration;
public TagletWriterImpl(HtmlDocletWriter htmlWriter, boolean isFirstSentence) { public TagletWriterImpl(HtmlDocletWriter htmlWriter, boolean isFirstSentence) {
super(isFirstSentence);
this.htmlWriter = htmlWriter; this.htmlWriter = htmlWriter;
this.isFirstSentence = isFirstSentence; configuration = htmlWriter.configuration;
} }
/** /**
@ -64,8 +66,8 @@ public class TagletWriterImpl extends TagletWriter {
* {@inheritDoc} * {@inheritDoc}
*/ */
public TagletOutput getDocRootOutput() { public TagletOutput getDocRootOutput() {
if (htmlWriter.configuration.docrootparent.length() > 0) if (configuration.docrootparent.length() > 0)
return new TagletOutputImpl(htmlWriter.configuration.docrootparent); return new TagletOutputImpl(configuration.docrootparent);
else if (htmlWriter.pathToRoot.isEmpty()) else if (htmlWriter.pathToRoot.isEmpty())
return new TagletOutputImpl("."); return new TagletOutputImpl(".");
else else
@ -81,7 +83,7 @@ public class TagletWriterImpl extends TagletWriter {
if (doc instanceof ClassDoc) { if (doc instanceof ClassDoc) {
if (Util.isDeprecated((ProgramElementDoc) doc)) { if (Util.isDeprecated((ProgramElementDoc) doc)) {
output.append("<span class=\"strong\">" + output.append("<span class=\"strong\">" +
ConfigurationImpl.getInstance(). configuration.
getText("doclet.Deprecated") + "</span>&nbsp;"); getText("doclet.Deprecated") + "</span>&nbsp;");
if (deprs.length > 0) { if (deprs.length > 0) {
Tag[] commentTags = deprs[0].inlineTags(); Tag[] commentTags = deprs[0].inlineTags();
@ -97,7 +99,7 @@ public class TagletWriterImpl extends TagletWriter {
MemberDoc member = (MemberDoc) doc; MemberDoc member = (MemberDoc) doc;
if (Util.isDeprecated((ProgramElementDoc) doc)) { if (Util.isDeprecated((ProgramElementDoc) doc)) {
output.append("<span class=\"strong\">" + output.append("<span class=\"strong\">" +
ConfigurationImpl.getInstance(). configuration.
getText("doclet.Deprecated") + "</span>&nbsp;"); getText("doclet.Deprecated") + "</span>&nbsp;");
if (deprs.length > 0) { if (deprs.length > 0) {
output.append("<i>"); output.append("<i>");
@ -108,7 +110,7 @@ public class TagletWriterImpl extends TagletWriter {
} else { } else {
if (Util.isDeprecated(member.containingClass())) { if (Util.isDeprecated(member.containingClass())) {
output.append("<span class=\"strong\">" + output.append("<span class=\"strong\">" +
ConfigurationImpl.getInstance(). configuration.
getText("doclet.Deprecated") + "</span>&nbsp;"); getText("doclet.Deprecated") + "</span>&nbsp;");
} }
} }
@ -120,7 +122,7 @@ public class TagletWriterImpl extends TagletWriter {
* {@inheritDoc} * {@inheritDoc}
*/ */
public MessageRetriever getMsgRetriever() { public MessageRetriever getMsgRetriever() {
return htmlWriter.configuration.message; return configuration.message;
} }
/** /**
@ -147,7 +149,7 @@ public class TagletWriterImpl extends TagletWriter {
*/ */
public TagletOutput returnTagOutput(Tag returnTag) { public TagletOutput returnTagOutput(Tag returnTag) {
TagletOutput result = new TagletOutputImpl(DocletConstants.NL + "<dt>" + TagletOutput result = new TagletOutputImpl(DocletConstants.NL + "<dt>" +
"<span class=\"strong\">" + htmlWriter.configuration.getText("doclet.Returns") + "<span class=\"strong\">" + configuration.getText("doclet.Returns") +
"</span>" + "</dt>" + "<dd>" + "</span>" + "</dt>" + "<dd>" +
htmlWriter.commentTagsToString(returnTag, null, returnTag.inlineTags(), htmlWriter.commentTagsToString(returnTag, null, returnTag.inlineTags(),
false) + "</dd>"); false) + "</dd>");
@ -178,7 +180,7 @@ public class TagletWriterImpl extends TagletWriter {
((ClassWriterImpl) htmlWriter).getClassDoc().qualifiedName() + "." + ((FieldDoc) holder).name(); ((ClassWriterImpl) htmlWriter).getClassDoc().qualifiedName() + "." + ((FieldDoc) holder).name();
DocLink link = constantsPath.fragment(whichConstant); DocLink link = constantsPath.fragment(whichConstant);
result += htmlWriter.getHyperLinkString(link, result += htmlWriter.getHyperLinkString(link,
htmlWriter.configuration.getText("doclet.Constants_Summary"), configuration.getText("doclet.Constants_Summary"),
false); false);
} }
if (holder.isClass() && ((ClassDoc)holder).isSerializable()) { if (holder.isClass() && ((ClassDoc)holder).isSerializable()) {
@ -189,7 +191,7 @@ public class TagletWriterImpl extends TagletWriter {
DocPath serialPath = htmlWriter.pathToRoot.resolve(DocPaths.SERIALIZED_FORM); DocPath serialPath = htmlWriter.pathToRoot.resolve(DocPaths.SERIALIZED_FORM);
DocLink link = serialPath.fragment(((ClassDoc)holder).qualifiedName()); DocLink link = serialPath.fragment(((ClassDoc)holder).qualifiedName());
result += htmlWriter.getHyperLinkString(link, result += htmlWriter.getHyperLinkString(link,
htmlWriter.configuration.getText("doclet.Serialized_Form"), false); configuration.getText("doclet.Serialized_Form"), false);
} }
} }
return result.equals("") ? null : new TagletOutputImpl(result + "</dd>"); return result.equals("") ? null : new TagletOutputImpl(result + "</dd>");
@ -200,7 +202,7 @@ public class TagletWriterImpl extends TagletWriter {
return result + ", " + DocletConstants.NL; return result + ", " + DocletConstants.NL;
} else { } else {
return "<dt><span class=\"strong\">" + return "<dt><span class=\"strong\">" +
htmlWriter.configuration().getText("doclet.See_Also") + "</span></dt><dd>"; configuration.getText("doclet.See_Also") + "</span></dt><dd>";
} }
} }
@ -234,7 +236,7 @@ public class TagletWriterImpl extends TagletWriter {
*/ */
public TagletOutput getThrowsHeader() { public TagletOutput getThrowsHeader() {
return new TagletOutputImpl(DocletConstants.NL + "<dt>" + "<span class=\"strong\">" + return new TagletOutputImpl(DocletConstants.NL + "<dt>" + "<span class=\"strong\">" +
htmlWriter.configuration().getText("doclet.Throws") + "</span></dt>"); configuration.getText("doclet.Throws") + "</span></dt>");
} }
/** /**
@ -245,7 +247,7 @@ public class TagletWriterImpl extends TagletWriter {
result += throwsTag.exceptionType() == null ? result += throwsTag.exceptionType() == null ?
htmlWriter.codeText(throwsTag.exceptionName()) : htmlWriter.codeText(throwsTag.exceptionName()) :
htmlWriter.codeText( htmlWriter.codeText(
htmlWriter.getLink(new LinkInfoImpl(LinkInfoImpl.CONTEXT_MEMBER, htmlWriter.getLink(new LinkInfoImpl(configuration, LinkInfoImpl.CONTEXT_MEMBER,
throwsTag.exceptionType()))); throwsTag.exceptionType())));
TagletOutput text = new TagletOutputImpl( TagletOutput text = new TagletOutputImpl(
htmlWriter.commentTagsToString(throwsTag, null, htmlWriter.commentTagsToString(throwsTag, null,
@ -263,7 +265,7 @@ public class TagletWriterImpl extends TagletWriter {
public TagletOutput throwsTagOutput(Type throwsType) { public TagletOutput throwsTagOutput(Type throwsType) {
return new TagletOutputImpl(DocletConstants.NL + "<dd>" + return new TagletOutputImpl(DocletConstants.NL + "<dd>" +
htmlWriter.codeText(htmlWriter.getLink( htmlWriter.codeText(htmlWriter.getLink(
new LinkInfoImpl(LinkInfoImpl.CONTEXT_MEMBER, throwsType))) + "</dd>"); new LinkInfoImpl(configuration, LinkInfoImpl.CONTEXT_MEMBER, throwsType))) + "</dd>");
} }
/** /**
@ -303,7 +305,7 @@ public class TagletWriterImpl extends TagletWriter {
* {@inheritDoc} * {@inheritDoc}
*/ */
public Configuration configuration() { public Configuration configuration() {
return htmlWriter.configuration(); return configuration;
} }
/** /**

View File

@ -25,6 +25,8 @@
package com.sun.tools.doclets.formats.html; package com.sun.tools.doclets.formats.html;
import java.io.IOException;
import com.sun.javadoc.*; import com.sun.javadoc.*;
import com.sun.tools.doclets.internal.toolkit.*; import com.sun.tools.doclets.internal.toolkit.*;
import com.sun.tools.doclets.internal.toolkit.util.*; import com.sun.tools.doclets.internal.toolkit.util.*;
@ -42,7 +44,7 @@ import com.sun.tools.doclets.internal.toolkit.util.*;
*/ */
public class WriterFactoryImpl implements WriterFactory { public class WriterFactoryImpl implements WriterFactory {
private ConfigurationImpl configuration; private final ConfigurationImpl configuration;
public WriterFactoryImpl(ConfigurationImpl configuration) { public WriterFactoryImpl(ConfigurationImpl configuration) {
this.configuration = configuration; this.configuration = configuration;
@ -60,7 +62,7 @@ public class WriterFactoryImpl implements WriterFactory {
*/ */
public PackageSummaryWriter getPackageSummaryWriter(PackageDoc packageDoc, public PackageSummaryWriter getPackageSummaryWriter(PackageDoc packageDoc,
PackageDoc prevPkg, PackageDoc nextPkg) throws Exception { PackageDoc prevPkg, PackageDoc nextPkg) throws Exception {
return new PackageWriterImpl(ConfigurationImpl.getInstance(), packageDoc, return new PackageWriterImpl(configuration, packageDoc,
prevPkg, nextPkg); prevPkg, nextPkg);
} }
@ -68,9 +70,9 @@ public class WriterFactoryImpl implements WriterFactory {
* {@inheritDoc} * {@inheritDoc}
*/ */
public ClassWriter getClassWriter(ClassDoc classDoc, ClassDoc prevClass, public ClassWriter getClassWriter(ClassDoc classDoc, ClassDoc prevClass,
ClassDoc nextClass, ClassTree classTree) ClassDoc nextClass, ClassTree classTree) throws IOException {
throws Exception { return new ClassWriterImpl(configuration, classDoc,
return new ClassWriterImpl(classDoc, prevClass, nextClass, classTree); prevClass, nextClass, classTree);
} }
/** /**
@ -79,7 +81,8 @@ public class WriterFactoryImpl implements WriterFactory {
public AnnotationTypeWriter getAnnotationTypeWriter( public AnnotationTypeWriter getAnnotationTypeWriter(
AnnotationTypeDoc annotationType, Type prevType, Type nextType) AnnotationTypeDoc annotationType, Type prevType, Type nextType)
throws Exception { throws Exception {
return new AnnotationTypeWriterImpl(annotationType, prevType, nextType); return new AnnotationTypeWriterImpl(configuration,
annotationType, prevType, nextType);
} }
/** /**
@ -106,7 +109,7 @@ public class WriterFactoryImpl implements WriterFactory {
/** /**
* {@inheritDoc} * {@inheritDoc}
*/ */
public EnumConstantWriter getEnumConstantWriter(ClassWriter classWriter) public EnumConstantWriterImpl getEnumConstantWriter(ClassWriter classWriter)
throws Exception { throws Exception {
return new EnumConstantWriterImpl((SubWriterHolderWriter) classWriter, return new EnumConstantWriterImpl((SubWriterHolderWriter) classWriter,
classWriter.getClassDoc()); classWriter.getClassDoc());
@ -115,7 +118,7 @@ public class WriterFactoryImpl implements WriterFactory {
/** /**
* {@inheritDoc} * {@inheritDoc}
*/ */
public FieldWriter getFieldWriter(ClassWriter classWriter) public FieldWriterImpl getFieldWriter(ClassWriter classWriter)
throws Exception { throws Exception {
return new FieldWriterImpl((SubWriterHolderWriter) classWriter, return new FieldWriterImpl((SubWriterHolderWriter) classWriter,
classWriter.getClassDoc()); classWriter.getClassDoc());
@ -124,7 +127,7 @@ public class WriterFactoryImpl implements WriterFactory {
/** /**
* {@inheritDoc} * {@inheritDoc}
*/ */
public MethodWriter getMethodWriter(ClassWriter classWriter) public MethodWriterImpl getMethodWriter(ClassWriter classWriter)
throws Exception { throws Exception {
return new MethodWriterImpl((SubWriterHolderWriter) classWriter, return new MethodWriterImpl((SubWriterHolderWriter) classWriter,
classWriter.getClassDoc()); classWriter.getClassDoc());
@ -133,7 +136,7 @@ public class WriterFactoryImpl implements WriterFactory {
/** /**
* {@inheritDoc} * {@inheritDoc}
*/ */
public ConstructorWriter getConstructorWriter(ClassWriter classWriter) public ConstructorWriterImpl getConstructorWriter(ClassWriter classWriter)
throws Exception { throws Exception {
return new ConstructorWriterImpl((SubWriterHolderWriter) classWriter, return new ConstructorWriterImpl((SubWriterHolderWriter) classWriter,
classWriter.getClassDoc()); classWriter.getClassDoc());
@ -143,20 +146,20 @@ public class WriterFactoryImpl implements WriterFactory {
* {@inheritDoc} * {@inheritDoc}
*/ */
public MemberSummaryWriter getMemberSummaryWriter( public MemberSummaryWriter getMemberSummaryWriter(
ClassWriter classWriter, int memberType) ClassWriter classWriter, int memberType)
throws Exception { throws Exception {
switch (memberType) { switch (memberType) {
case VisibleMemberMap.CONSTRUCTORS: case VisibleMemberMap.CONSTRUCTORS:
return (ConstructorWriterImpl) getConstructorWriter(classWriter); return getConstructorWriter(classWriter);
case VisibleMemberMap.ENUM_CONSTANTS: case VisibleMemberMap.ENUM_CONSTANTS:
return (EnumConstantWriterImpl) getEnumConstantWriter(classWriter); return getEnumConstantWriter(classWriter);
case VisibleMemberMap.FIELDS: case VisibleMemberMap.FIELDS:
return (FieldWriterImpl) getFieldWriter(classWriter); return getFieldWriter(classWriter);
case VisibleMemberMap.INNERCLASSES: case VisibleMemberMap.INNERCLASSES:
return new NestedClassWriterImpl((SubWriterHolderWriter) return new NestedClassWriterImpl((SubWriterHolderWriter)
classWriter, classWriter.getClassDoc()); classWriter, classWriter.getClassDoc());
case VisibleMemberMap.METHODS: case VisibleMemberMap.METHODS:
return (MethodWriterImpl) getMethodWriter(classWriter); return getMethodWriter(classWriter);
default: default:
return null; return null;
} }
@ -184,6 +187,6 @@ public class WriterFactoryImpl implements WriterFactory {
* {@inheritDoc} * {@inheritDoc}
*/ */
public SerializedFormWriter getSerializedFormWriter() throws Exception { public SerializedFormWriter getSerializedFormWriter() throws Exception {
return new SerializedFormWriterImpl(); return new SerializedFormWriterImpl(configuration);
} }
} }

View File

@ -41,13 +41,15 @@ import com.sun.tools.doclets.internal.toolkit.util.*;
* *
* @author Bhavesh Patel * @author Bhavesh Patel
*/ */
public class DocType extends Content{ public class DocType extends Content {
private String docType; private String docType;
private static DocType transitional; public static final DocType TRANSITIONAL =
new DocType("Transitional", "http://www.w3.org/TR/html4/loose.dtd");
private static DocType frameset; public static final DocType FRAMESET =
new DocType("Frameset", "http://www.w3.org/TR/html4/frameset.dtd");
/** /**
* Constructor to construct a DocType object. * Constructor to construct a DocType object.
@ -59,28 +61,6 @@ public class DocType extends Content{
"//EN\" \"" + dtd + "\">" + DocletConstants.NL; "//EN\" \"" + dtd + "\">" + DocletConstants.NL;
} }
/**
* Construct and return a HTML 4.01 transitional DocType content
*
* @return a content tree for transitional DocType
*/
public static DocType Transitional() {
if (transitional == null)
transitional = new DocType("Transitional", "http://www.w3.org/TR/html4/loose.dtd");
return transitional;
}
/**
* Construct and return a HTML 4.01 frameset DocType content
*
* @return a content tree for frameset DocType
*/
public static DocType Frameset() {
if (frameset == null)
frameset = new DocType("Frameset", "http://www.w3.org/TR/html4/frameset.dtd");
return frameset;
}
/** /**
* This method is not supported by the class. * This method is not supported by the class.
* *

View File

@ -31,6 +31,7 @@ import java.util.*;
import com.sun.javadoc.*; import com.sun.javadoc.*;
import com.sun.tools.doclets.formats.html.ConfigurationImpl; import com.sun.tools.doclets.formats.html.ConfigurationImpl;
import com.sun.tools.doclets.internal.toolkit.*; import com.sun.tools.doclets.internal.toolkit.*;
import com.sun.tools.doclets.internal.toolkit.util.DocFile;
import com.sun.tools.doclets.internal.toolkit.util.DocLink; import com.sun.tools.doclets.internal.toolkit.util.DocLink;
import com.sun.tools.doclets.internal.toolkit.util.DocPath; import com.sun.tools.doclets.internal.toolkit.util.DocPath;
import com.sun.tools.doclets.internal.toolkit.util.DocPaths; import com.sun.tools.doclets.internal.toolkit.util.DocPaths;
@ -63,7 +64,7 @@ public abstract class HtmlDocWriter extends HtmlWriter {
throws IOException { throws IOException {
super(configuration, filename); super(configuration, filename);
configuration.message.notice("doclet.Generating_0", configuration.message.notice("doclet.Generating_0",
filename.resolveAgainst(configuration.destDirName)); DocFile.createFileForOutput(configuration, filename).getPath());
} }
/** /**
@ -254,7 +255,7 @@ public abstract class HtmlDocWriter extends HtmlWriter {
*/ */
public void printFramesetDocument(String title, boolean noTimeStamp, public void printFramesetDocument(String title, boolean noTimeStamp,
Content frameset) throws IOException { Content frameset) throws IOException {
Content htmlDocType = DocType.Frameset(); Content htmlDocType = DocType.FRAMESET;
Content htmlComment = new Comment(configuration.getText("doclet.New_Page")); Content htmlComment = new Comment(configuration.getText("doclet.New_Page"));
Content head = new HtmlTree(HtmlTag.HEAD); Content head = new HtmlTree(HtmlTag.HEAD);
if (! noTimeStamp) { if (! noTimeStamp) {

View File

@ -37,6 +37,7 @@ package com.sun.tools.doclets.formats.html.markup;
*/ */
public enum HtmlStyle { public enum HtmlStyle {
aboutLanguage, aboutLanguage,
activeTableTab,
altColor, altColor,
bar, bar,
block, block,
@ -75,6 +76,7 @@ public enum HtmlStyle {
summary, summary,
deprecatedContent, deprecatedContent,
tabEnd, tabEnd,
tableTab,
title, title,
topNav; topNav;
} }

View File

@ -493,6 +493,20 @@ public class HtmlTree extends Content {
return htmltree; return htmltree;
} }
/**
* Generates a SCRIPT tag with the type and src attributes.
*
* @param type type of link
* @param src the path for the script
* @return an HtmlTree object for the SCRIPT tag
*/
public static HtmlTree SCRIPT(String type, String src) {
HtmlTree htmltree = new HtmlTree(HtmlTag.SCRIPT);
htmltree.addAttr(HtmlAttr.TYPE, nullCheck(type));
htmltree.addAttr(HtmlAttr.SRC, nullCheck(src));
return htmltree;
}
/** /**
* Generates a SMALL tag with some content. * Generates a SMALL tag with some content.
* *
@ -539,6 +553,23 @@ public class HtmlTree extends Content {
return htmltree; return htmltree;
} }
/**
* Generates a SPAN tag with id and style class attributes. It also encloses
* a content.
*
* @param id the id for the tag
* @param styleClass stylesheet class for the tag
* @param body content for the tag
* @return an HtmlTree object for the SPAN tag
*/
public static HtmlTree SPAN(String id, HtmlStyle styleClass, Content body) {
HtmlTree htmltree = new HtmlTree(HtmlTag.SPAN, nullCheck(body));
htmltree.addAttr(HtmlAttr.ID, nullCheck(id));
if (styleClass != null)
htmltree.addStyle(styleClass);
return htmltree;
}
/** /**
* Generates a Table tag with border, width and summary attributes and * Generates a Table tag with border, width and summary attributes and
* some content. * some content.
@ -742,6 +773,9 @@ public class HtmlTree extends Content {
return (hasAttr(HtmlAttr.HREF) && !hasContent()); return (hasAttr(HtmlAttr.HREF) && !hasContent());
case META : case META :
return (hasAttr(HtmlAttr.CONTENT) && !hasContent()); return (hasAttr(HtmlAttr.CONTENT) && !hasContent());
case SCRIPT :
return ((hasAttr(HtmlAttr.TYPE) && hasAttr(HtmlAttr.SRC) && !hasContent()) ||
(hasAttr(HtmlAttr.TYPE) && hasContent()));
default : default :
return hasContent(); return hasContent();
} }

View File

@ -26,6 +26,7 @@
package com.sun.tools.doclets.formats.html.markup; package com.sun.tools.doclets.formats.html.markup;
import java.io.*; import java.io.*;
import java.util.*;
import com.sun.tools.doclets.internal.toolkit.*; import com.sun.tools.doclets.internal.toolkit.*;
import com.sun.tools.doclets.internal.toolkit.util.*; import com.sun.tools.doclets.internal.toolkit.util.*;
@ -144,6 +145,8 @@ public class HtmlWriter {
private final Writer writer; private final Writer writer;
private Content script;
/** /**
* Constructor. * Constructor.
* *
@ -301,7 +304,8 @@ public class HtmlWriter {
// Don't print windowtitle script for overview-frame, allclasses-frame // Don't print windowtitle script for overview-frame, allclasses-frame
// and package-frame // and package-frame
if (includeScript) { if (includeScript) {
body.addContent(getWinTitleScript()); this.script = getWinTitleScript();
body.addContent(script);
Content noScript = HtmlTree.NOSCRIPT( Content noScript = HtmlTree.NOSCRIPT(
HtmlTree.DIV(getResource("doclet.No_Script_Message"))); HtmlTree.DIV(getResource("doclet.No_Script_Message")));
body.addContent(noScript); body.addContent(noScript);
@ -309,6 +313,53 @@ public class HtmlWriter {
return body; return body;
} }
/**
* Generated javascript variables for the document.
*
* @param typeMap map comprising of method and type relationship
* @param methodTypes set comprising of all methods types for this class
*/
public void generateMethodTypesScript(Map<String,Integer> typeMap,
Set<MethodTypes> methodTypes) {
String sep = "";
StringBuilder vars = new StringBuilder("var methods = {");
for (Map.Entry<String,Integer> entry : typeMap.entrySet()) {
vars.append(sep);
sep = ",";
vars.append("\"");
vars.append(entry.getKey());
vars.append("\":");
vars.append(entry.getValue());
}
vars.append("};").append(DocletConstants.NL);
sep = "";
vars.append("var tabs = {");
for (MethodTypes entry : methodTypes) {
vars.append(sep);
sep = ",";
vars.append(entry.value()).append(":");
vars.append("[").append("\"").append(entry.tabId());
vars.append("\"").append(sep).append("\"").append(entry.text()).append("\"]");
}
vars.append("};").append(DocletConstants.NL);
addStyles(HtmlStyle.altColor, vars);
addStyles(HtmlStyle.rowColor, vars);
addStyles(HtmlStyle.tableTab, vars);
addStyles(HtmlStyle.activeTableTab, vars);
script.addContent(new RawHtml(vars.toString()));
}
/**
* Adds javascript style variables to the document.
*
* @param style style to be added as a javascript variable
* @param vars variable string to which the style variable will be added
*/
public void addStyles(HtmlStyle style, StringBuilder vars) {
vars.append("var ").append(style).append(" = \"").append(style)
.append("\";").append(DocletConstants.NL);
}
/** /**
* Returns an HtmlTree for the TITLE tag. * Returns an HtmlTree for the TITLE tag.
* *

View File

@ -51,8 +51,8 @@ public abstract class AbstractDoclet {
/** /**
* The only doclet that may use this toolkit is {@value} * The only doclet that may use this toolkit is {@value}
*/ */
private static final String TOOLKIT_DOCLET_NAME = new private static final String TOOLKIT_DOCLET_NAME =
com.sun.tools.doclets.formats.html.HtmlDoclet().getClass().getName(); com.sun.tools.doclets.formats.html.HtmlDoclet.class.getName();
/** /**
* Verify that the only doclet that is using this toolkit is * Verify that the only doclet that is using this toolkit is

View File

@ -32,6 +32,7 @@ import com.sun.javadoc.*;
import com.sun.tools.doclets.internal.toolkit.builders.BuilderFactory; import com.sun.tools.doclets.internal.toolkit.builders.BuilderFactory;
import com.sun.tools.doclets.internal.toolkit.taglets.*; import com.sun.tools.doclets.internal.toolkit.taglets.*;
import com.sun.tools.doclets.internal.toolkit.util.*; import com.sun.tools.doclets.internal.toolkit.util.*;
import javax.tools.JavaFileManager;
/** /**
* Configure the output based on the options. Doclets should sub-class * Configure the output based on the options. Doclets should sub-class
@ -77,14 +78,16 @@ public abstract class Configuration {
/** /**
* This is true if option "-serialwarn" is used. Defualt value is false to * This is true if option "-serialwarn" is used. Defualt value is false to
* supress excessive warnings about serial tag. * suppress excessive warnings about serial tag.
*/ */
public boolean serialwarn = false; public boolean serialwarn = false;
/** /**
* The specified amount of space between tab stops. * The specified amount of space between tab stops.
*/ */
public int sourcetab = DocletConstants.DEFAULT_TAB_STOP_LENGTH; public int sourcetab;
public String tabSpaces;
/** /**
* True if we should generate browsable sources. * True if we should generate browsable sources.
@ -259,6 +262,7 @@ public abstract class Configuration {
"com.sun.tools.doclets.internal.toolkit.resources.doclets"); "com.sun.tools.doclets.internal.toolkit.resources.doclets");
excludedDocFileDirs = new HashSet<String>(); excludedDocFileDirs = new HashSet<String>();
excludedQualifiers = new HashSet<String>(); excludedQualifiers = new HashSet<String>();
setTabWidth(DocletConstants.DEFAULT_TAB_STOP_LENGTH);
} }
/** /**
@ -382,7 +386,7 @@ public abstract class Configuration {
} else if (opt.equals("-sourcetab")) { } else if (opt.equals("-sourcetab")) {
linksource = true; linksource = true;
try { try {
sourcetab = Integer.parseInt(os[1]); setTabWidth(Integer.parseInt(os[1]));
} catch (NumberFormatException e) { } catch (NumberFormatException e) {
//Set to -1 so that warning will be printed //Set to -1 so that warning will be printed
//to indicate what is valid argument. //to indicate what is valid argument.
@ -390,7 +394,7 @@ public abstract class Configuration {
} }
if (sourcetab <= 0) { if (sourcetab <= 0) {
message.warning("doclet.sourcetab_warning"); message.warning("doclet.sourcetab_warning");
sourcetab = DocletConstants.DEFAULT_TAB_STOP_LENGTH; setTabWidth(DocletConstants.DEFAULT_TAB_STOP_LENGTH);
} }
} else if (opt.equals("-notimestamp")) { } else if (opt.equals("-notimestamp")) {
notimestamp = true; notimestamp = true;
@ -442,7 +446,7 @@ public abstract class Configuration {
/** /**
* Initialize the taglet manager. The strings to initialize the simple custom tags should * Initialize the taglet manager. The strings to initialize the simple custom tags should
* be in the following format: "[tag name]:[location str]:[heading]". * be in the following format: "[tag name]:[location str]:[heading]".
* @param customTagStrs the set two dimentional arrays of strings. These arrays contain * @param customTagStrs the set two dimensional arrays of strings. These arrays contain
* either -tag or -taglet arguments. * either -tag or -taglet arguments.
*/ */
private void initTagletManager(Set<String[]> customTagStrs) { private void initTagletManager(Set<String[]> customTagStrs) {
@ -453,11 +457,11 @@ public abstract class Configuration {
for (Iterator<String[]> it = customTagStrs.iterator(); it.hasNext(); ) { for (Iterator<String[]> it = customTagStrs.iterator(); it.hasNext(); ) {
args = it.next(); args = it.next();
if (args[0].equals("-taglet")) { if (args[0].equals("-taglet")) {
tagletManager.addCustomTag(args[1], tagletpath); tagletManager.addCustomTag(args[1], getFileManager(), tagletpath);
continue; continue;
} }
String[] tokens = tokenize(args[1], String[] tokens = tokenize(args[1],
TagletManager.SIMPLE_TAGLET_OPT_SEPERATOR, 3); TagletManager.SIMPLE_TAGLET_OPT_SEPARATOR, 3);
if (tokens.length == 1) { if (tokens.length == 1) {
String tagName = args[1]; String tagName = args[1];
if (tagletManager.isKnownCustomTag(tagName)) { if (tagletManager.isKnownCustomTag(tagName)) {
@ -749,7 +753,7 @@ public abstract class Configuration {
* @return the input steam to the builder XML. * @return the input steam to the builder XML.
* @throws FileNotFoundException when the given XML file cannot be found. * @throws FileNotFoundException when the given XML file cannot be found.
*/ */
public InputStream getBuilderXML() throws FileNotFoundException { public InputStream getBuilderXML() throws IOException {
return builderXMLPath == null ? return builderXMLPath == null ?
Configuration.class.getResourceAsStream(DEFAULT_BUILDER_XML) : Configuration.class.getResourceAsStream(DEFAULT_BUILDER_XML) :
DocFile.createFileForInput(this, builderXMLPath).openInputStream(); DocFile.createFileForInput(this, builderXMLPath).openInputStream();
@ -760,6 +764,11 @@ public abstract class Configuration {
*/ */
public abstract Locale getLocale(); public abstract Locale getLocale();
/**
* Return the current file manager.
*/
public abstract JavaFileManager getFileManager();
/** /**
* Return the comparator that will be used to sort member documentation. * Return the comparator that will be used to sort member documentation.
* To no do any sorting, return null. * To no do any sorting, return null.
@ -767,4 +776,9 @@ public abstract class Configuration {
* @return the {@link java.util.Comparator} used to sort members. * @return the {@link java.util.Comparator} used to sort members.
*/ */
public abstract Comparator<ProgramElementDoc> getMemberComparator(); public abstract Comparator<ProgramElementDoc> getMemberComparator();
private void setTabWidth(int n) {
sourcetab = n;
tabSpaces = String.format("%" + n + "s", "");
}
} }

View File

@ -58,9 +58,11 @@ public interface MemberSummaryWriter {
* Get the summary table for the given class. * Get the summary table for the given class.
* *
* @param classDoc the class the summary table belongs to * @param classDoc the class the summary table belongs to
* @param tableContents list of contents that will be added to the summary table
* @return a content tree for the member summary table * @return a content tree for the member summary table
*/ */
public Content getSummaryTableTree(ClassDoc classDoc); public Content getSummaryTableTree(ClassDoc classDoc,
List<Content> tableContents);
/** /**
* Add the member summary for the given class and member. * Add the member summary for the given class and member.
@ -68,11 +70,11 @@ public interface MemberSummaryWriter {
* @param classDoc the class the summary belongs to * @param classDoc the class the summary belongs to
* @param member the member that is documented * @param member the member that is documented
* @param firstSentenceTags the tags for the sentence being documented * @param firstSentenceTags the tags for the sentence being documented
* @param tableTree the content treeto which the information will be added * @param tableContents list of contents to which the summary will be added
* @param counter the counter for determing style for the table row * @param counter the counter for determining id and style for the table row
*/ */
public void addMemberSummary(ClassDoc classDoc, ProgramElementDoc member, public void addMemberSummary(ClassDoc classDoc, ProgramElementDoc member,
Tag[] firstSentenceTags, Content tableTree, int counter); Tag[] firstSentenceTags, List<Content> tableContents, int counter);
/** /**
* Get the inherited member summary header for the given class. * Get the inherited member summary header for the given class.

View File

@ -52,18 +52,46 @@ import com.sun.tools.doclets.internal.toolkit.util.*;
*/ */
public abstract class AbstractBuilder { public abstract class AbstractBuilder {
public static class Context {
/**
* The configuration used in this run of the doclet.
*/
final Configuration configuration;
/**
* Keep track of which packages we have seen for
* efficiency purposes. We don't want to copy the
* doc files multiple times for a single package.
*/
final Set<String> containingPackagesSeen;
/**
* Shared parser for the builder XML file
*/
final LayoutParser layoutParser;
Context(Configuration configuration,
Set<String> containingPackagesSeen,
LayoutParser layoutParser) {
this.configuration = configuration;
this.containingPackagesSeen = containingPackagesSeen;
this.layoutParser = layoutParser;
}
}
/** /**
* The configuration used in this run of the doclet. * The configuration used in this run of the doclet.
*/ */
protected Configuration configuration; protected final Configuration configuration;
/** /**
* Keep track of which packages we have seen for * Keep track of which packages we have seen for
* efficiency purposes. We don't want to copy the * efficiency purposes. We don't want to copy the
* doc files multiple times for a single package. * doc files multiple times for a single package.
*/ */
protected static Set<String> containingPackagesSeen; protected final Set<String> containingPackagesSeen;
protected final LayoutParser layoutParser;
/** /**
* True if we want to print debug output. * True if we want to print debug output.
@ -75,8 +103,10 @@ public abstract class AbstractBuilder {
* @param configuration the configuration used in this run * @param configuration the configuration used in this run
* of the doclet. * of the doclet.
*/ */
public AbstractBuilder(Configuration configuration) { public AbstractBuilder(Context c) {
this.configuration = configuration; this.configuration = c.configuration;
this.containingPackagesSeen = c.containingPackagesSeen;
this.layoutParser = c.layoutParser;
} }
/** /**

View File

@ -25,6 +25,8 @@
package com.sun.tools.doclets.internal.toolkit.builders; package com.sun.tools.doclets.internal.toolkit.builders;
import java.util.Set;
import com.sun.tools.doclets.internal.toolkit.*; import com.sun.tools.doclets.internal.toolkit.*;
import com.sun.tools.doclets.internal.toolkit.util.*; import com.sun.tools.doclets.internal.toolkit.util.*;
@ -48,8 +50,8 @@ public abstract class AbstractMemberBuilder extends AbstractBuilder {
* @param configuration the configuration used in this run * @param configuration the configuration used in this run
* of the doclet. * of the doclet.
*/ */
public AbstractMemberBuilder(Configuration configuration) { public AbstractMemberBuilder(Context context) {
super(configuration); super(context);
} }
/** /**

View File

@ -54,12 +54,12 @@ public class AnnotationTypeBuilder extends AbstractBuilder {
/** /**
* The annotation type being documented. * The annotation type being documented.
*/ */
private AnnotationTypeDoc annotationTypeDoc; private final AnnotationTypeDoc annotationTypeDoc;
/** /**
* The doclet specific writer. * The doclet specific writer.
*/ */
private AnnotationTypeWriter writer; private final AnnotationTypeWriter writer;
/** /**
* The content tree for the annotation documentation. * The content tree for the annotation documentation.
@ -69,38 +69,37 @@ public class AnnotationTypeBuilder extends AbstractBuilder {
/** /**
* Construct a new ClassBuilder. * Construct a new ClassBuilder.
* *
* @param configuration the current configuration of the * @param context the build context.
* doclet. * @param annotationTypeDoc the class being documented.
* @param writer the doclet specific writer.
*/ */
private AnnotationTypeBuilder(Configuration configuration) { private AnnotationTypeBuilder(Context context,
super(configuration); AnnotationTypeDoc annotationTypeDoc,
AnnotationTypeWriter writer) {
super(context);
this.annotationTypeDoc = annotationTypeDoc;
this.writer = writer;
} }
/** /**
* Construct a new ClassBuilder. * Construct a new ClassBuilder.
* *
* @param configuration the current configuration of the doclet. * @param context the build context.
* @param annotationTypeDoc the class being documented. * @param annotationTypeDoc the class being documented.
* @param writer the doclet specific writer. * @param writer the doclet specific writer.
*/ */
public static AnnotationTypeBuilder getInstance(Configuration configuration, public static AnnotationTypeBuilder getInstance(Context context,
AnnotationTypeDoc annotationTypeDoc, AnnotationTypeWriter writer) AnnotationTypeDoc annotationTypeDoc,
throws Exception { AnnotationTypeWriter writer)
AnnotationTypeBuilder builder = new AnnotationTypeBuilder(configuration); throws Exception {
builder.configuration = configuration; return new AnnotationTypeBuilder(context, annotationTypeDoc, writer);
builder.annotationTypeDoc = annotationTypeDoc;
builder.writer = writer;
if(containingPackagesSeen == null) {
containingPackagesSeen = new HashSet<String>();
}
return builder;
} }
/** /**
* {@inheritDoc} * {@inheritDoc}
*/ */
public void build() throws IOException { public void build() throws IOException {
build(LayoutParser.getInstance(configuration).parseXML(ROOT), contentTree); build(layoutParser.parseXML(ROOT), contentTree);
} }
/** /**

View File

@ -25,8 +25,6 @@
package com.sun.tools.doclets.internal.toolkit.builders; package com.sun.tools.doclets.internal.toolkit.builders;
import java.util.*;
import com.sun.javadoc.*; import com.sun.javadoc.*;
import com.sun.tools.doclets.internal.toolkit.*; import com.sun.tools.doclets.internal.toolkit.*;
import com.sun.tools.doclets.internal.toolkit.util.*; import com.sun.tools.doclets.internal.toolkit.util.*;
@ -44,43 +42,36 @@ import com.sun.tools.doclets.internal.toolkit.util.*;
* @since 1.5 * @since 1.5
*/ */
public class AnnotationTypeOptionalMemberBuilder extends public class AnnotationTypeOptionalMemberBuilder extends
AnnotationTypeRequiredMemberBuilder { AnnotationTypeRequiredMemberBuilder {
/** /**
* Construct a new AnnotationTypeMemberBuilder. * Construct a new AnnotationTypeMemberBuilder.
* *
* @param configuration the current configuration of the * @param context the build context.
* doclet. * @param classDoc the class whose members are being documented.
* @param writer the doclet specific writer.
*/ */
private AnnotationTypeOptionalMemberBuilder(Configuration configuration) { private AnnotationTypeOptionalMemberBuilder(Context context,
super(configuration); ClassDoc classDoc,
AnnotationTypeOptionalMemberWriter writer) {
super(context, classDoc, writer,
VisibleMemberMap.ANNOTATION_TYPE_MEMBER_OPTIONAL);
} }
/** /**
* Construct a new AnnotationTypeMemberBuilder. * Construct a new AnnotationTypeMemberBuilder.
* *
* @param configuration the current configuration of the doclet. * @param context the build context.
* @param classDoc the class whoses members are being documented. * @param classDoc the class whose members are being documented.
* @param writer the doclet specific writer. * @param writer the doclet specific writer.
*/ */
public static AnnotationTypeOptionalMemberBuilder getInstance( public static AnnotationTypeOptionalMemberBuilder getInstance(
Configuration configuration, ClassDoc classDoc, Context context, ClassDoc classDoc,
AnnotationTypeOptionalMemberWriter writer) { AnnotationTypeOptionalMemberWriter writer) {
AnnotationTypeOptionalMemberBuilder builder = return new AnnotationTypeOptionalMemberBuilder(context,
new AnnotationTypeOptionalMemberBuilder(configuration); classDoc, writer);
builder.classDoc = classDoc;
builder.writer = writer;
builder.visibleMemberMap = new VisibleMemberMap(classDoc,
VisibleMemberMap.ANNOTATION_TYPE_MEMBER_OPTIONAL, configuration.nodeprecated);
builder.members = new ArrayList<ProgramElementDoc>(
builder.visibleMemberMap.getMembersFor(classDoc));
if (configuration.getMemberComparator() != null) {
Collections.sort(builder.members,
configuration.getMemberComparator());
}
return builder;
} }
/** /**

View File

@ -74,37 +74,40 @@ public class AnnotationTypeRequiredMemberBuilder extends AbstractMemberBuilder {
/** /**
* Construct a new AnnotationTypeRequiredMemberBuilder. * Construct a new AnnotationTypeRequiredMemberBuilder.
* *
* @param configuration the current configuration of the * @param context the build context.
* doclet. * @param classDoc the class whose members are being documented.
* @param writer the doclet specific writer.
*/ */
protected AnnotationTypeRequiredMemberBuilder(Configuration configuration) { protected AnnotationTypeRequiredMemberBuilder(Context context,
super(configuration); ClassDoc classDoc,
AnnotationTypeRequiredMemberWriter writer,
int memberType) {
super(context);
this.classDoc = classDoc;
this.writer = writer;
this.visibleMemberMap = new VisibleMemberMap(classDoc, memberType,
configuration.nodeprecated);
this.members = new ArrayList<ProgramElementDoc>(
this.visibleMemberMap.getMembersFor(classDoc));
if (configuration.getMemberComparator() != null) {
Collections.sort(this.members, configuration.getMemberComparator());
}
} }
/** /**
* Construct a new AnnotationTypeMemberBuilder. * Construct a new AnnotationTypeMemberBuilder.
* *
* @param configuration the current configuration of the doclet. * @param context the build context.
* @param classDoc the class whoses members are being documented. * @param classDoc the class whose members are being documented.
* @param writer the doclet specific writer. * @param writer the doclet specific writer.
*/ */
public static AnnotationTypeRequiredMemberBuilder getInstance( public static AnnotationTypeRequiredMemberBuilder getInstance(
Configuration configuration, ClassDoc classDoc, Context context, ClassDoc classDoc,
AnnotationTypeRequiredMemberWriter writer) { AnnotationTypeRequiredMemberWriter writer) {
AnnotationTypeRequiredMemberBuilder builder = return new AnnotationTypeRequiredMemberBuilder(context, classDoc,
new AnnotationTypeRequiredMemberBuilder(configuration); writer,
builder.classDoc = classDoc; VisibleMemberMap.ANNOTATION_TYPE_MEMBER_REQUIRED);
builder.writer = writer;
builder.visibleMemberMap = new VisibleMemberMap(classDoc,
VisibleMemberMap.ANNOTATION_TYPE_MEMBER_REQUIRED, configuration.nodeprecated);
builder.members = new ArrayList<ProgramElementDoc>(
builder.visibleMemberMap.getMembersFor(classDoc));
if (configuration.getMemberComparator() != null) {
Collections.sort(builder.members,
configuration.getMemberComparator());
}
return builder;
} }
/** /**

View File

@ -25,6 +25,9 @@
package com.sun.tools.doclets.internal.toolkit.builders; package com.sun.tools.doclets.internal.toolkit.builders;
import java.util.HashSet;
import java.util.Set;
import com.sun.javadoc.*; import com.sun.javadoc.*;
import com.sun.tools.doclets.internal.toolkit.*; import com.sun.tools.doclets.internal.toolkit.*;
import com.sun.tools.doclets.internal.toolkit.util.*; import com.sun.tools.doclets.internal.toolkit.util.*;
@ -46,12 +49,14 @@ public class BuilderFactory {
/** /**
* The current configuration of the doclet. * The current configuration of the doclet.
*/ */
private Configuration configuration; private final Configuration configuration;
/** /**
* The factory to retrieve the required writers from. * The factory to retrieve the required writers from.
*/ */
private WriterFactory writerFactory; private final WriterFactory writerFactory;
private final AbstractBuilder.Context context;
/** /**
* Construct a builder factory using the given configuration. * Construct a builder factory using the given configuration.
@ -61,6 +66,10 @@ public class BuilderFactory {
public BuilderFactory (Configuration configuration) { public BuilderFactory (Configuration configuration) {
this.configuration = configuration; this.configuration = configuration;
this.writerFactory = configuration.getWriterFactory(); this.writerFactory = configuration.getWriterFactory();
Set<String> containingPackagesSeen = new HashSet<String>();
context = new AbstractBuilder.Context(configuration, containingPackagesSeen,
LayoutParser.getInstance(configuration));
} }
/** /**
@ -68,7 +77,7 @@ public class BuilderFactory {
* @return the builder that builds the constant summary. * @return the builder that builds the constant summary.
*/ */
public AbstractBuilder getConstantsSummaryBuider() throws Exception { public AbstractBuilder getConstantsSummaryBuider() throws Exception {
return ConstantsSummaryBuilder.getInstance(configuration, return ConstantsSummaryBuilder.getInstance(context,
writerFactory.getConstantsSummaryWriter()); writerFactory.getConstantsSummaryWriter());
} }
@ -82,7 +91,7 @@ public class BuilderFactory {
*/ */
public AbstractBuilder getPackageSummaryBuilder(PackageDoc pkg, PackageDoc prevPkg, public AbstractBuilder getPackageSummaryBuilder(PackageDoc pkg, PackageDoc prevPkg,
PackageDoc nextPkg) throws Exception { PackageDoc nextPkg) throws Exception {
return PackageSummaryBuilder.getInstance(configuration, pkg, return PackageSummaryBuilder.getInstance(context, pkg,
writerFactory.getPackageSummaryWriter(pkg, prevPkg, nextPkg)); writerFactory.getPackageSummaryWriter(pkg, prevPkg, nextPkg));
} }
@ -97,9 +106,9 @@ public class BuilderFactory {
* writer is not supported by the doclet. * writer is not supported by the doclet.
*/ */
public AbstractBuilder getClassBuilder(ClassDoc classDoc, public AbstractBuilder getClassBuilder(ClassDoc classDoc,
ClassDoc prevClass, ClassDoc nextClass, ClassTree classTree) ClassDoc prevClass, ClassDoc nextClass, ClassTree classTree)
throws Exception { throws Exception {
return ClassBuilder.getInstance(configuration, classDoc, return ClassBuilder.getInstance(context, classDoc,
writerFactory.getClassWriter(classDoc, prevClass, nextClass, writerFactory.getClassWriter(classDoc, prevClass, nextClass,
classTree)); classTree));
} }
@ -117,9 +126,8 @@ public class BuilderFactory {
AnnotationTypeDoc annotationType, AnnotationTypeDoc annotationType,
Type prevType, Type nextType) Type prevType, Type nextType)
throws Exception { throws Exception {
return AnnotationTypeBuilder.getInstance(configuration, annotationType, return AnnotationTypeBuilder.getInstance(context, annotationType,
writerFactory.getAnnotationTypeWriter(annotationType, prevType, writerFactory.getAnnotationTypeWriter(annotationType, prevType, nextType));
nextType));
} }
/** /**
@ -129,7 +137,7 @@ public class BuilderFactory {
*/ */
public AbstractBuilder getMethodBuilder(ClassWriter classWriter) public AbstractBuilder getMethodBuilder(ClassWriter classWriter)
throws Exception { throws Exception {
return MethodBuilder.getInstance(configuration, return MethodBuilder.getInstance(context,
classWriter.getClassDoc(), classWriter.getClassDoc(),
writerFactory.getMethodWriter(classWriter)); writerFactory.getMethodWriter(classWriter));
} }
@ -144,7 +152,7 @@ public class BuilderFactory {
public AbstractBuilder getAnnotationTypeOptionalMemberBuilder( public AbstractBuilder getAnnotationTypeOptionalMemberBuilder(
AnnotationTypeWriter annotationTypeWriter) AnnotationTypeWriter annotationTypeWriter)
throws Exception { throws Exception {
return AnnotationTypeOptionalMemberBuilder.getInstance(configuration, return AnnotationTypeOptionalMemberBuilder.getInstance(context,
annotationTypeWriter.getAnnotationTypeDoc(), annotationTypeWriter.getAnnotationTypeDoc(),
writerFactory.getAnnotationTypeOptionalMemberWriter( writerFactory.getAnnotationTypeOptionalMemberWriter(
annotationTypeWriter)); annotationTypeWriter));
@ -160,7 +168,7 @@ public class BuilderFactory {
public AbstractBuilder getAnnotationTypeRequiredMemberBuilder( public AbstractBuilder getAnnotationTypeRequiredMemberBuilder(
AnnotationTypeWriter annotationTypeWriter) AnnotationTypeWriter annotationTypeWriter)
throws Exception { throws Exception {
return AnnotationTypeRequiredMemberBuilder.getInstance(configuration, return AnnotationTypeRequiredMemberBuilder.getInstance(context,
annotationTypeWriter.getAnnotationTypeDoc(), annotationTypeWriter.getAnnotationTypeDoc(),
writerFactory.getAnnotationTypeRequiredMemberWriter( writerFactory.getAnnotationTypeRequiredMemberWriter(
annotationTypeWriter)); annotationTypeWriter));
@ -173,7 +181,7 @@ public class BuilderFactory {
*/ */
public AbstractBuilder getEnumConstantsBuilder(ClassWriter classWriter) public AbstractBuilder getEnumConstantsBuilder(ClassWriter classWriter)
throws Exception { throws Exception {
return EnumConstantBuilder.getInstance(configuration, classWriter.getClassDoc(), return EnumConstantBuilder.getInstance(context, classWriter.getClassDoc(),
writerFactory.getEnumConstantWriter(classWriter)); writerFactory.getEnumConstantWriter(classWriter));
} }
@ -184,7 +192,7 @@ public class BuilderFactory {
*/ */
public AbstractBuilder getFieldBuilder(ClassWriter classWriter) public AbstractBuilder getFieldBuilder(ClassWriter classWriter)
throws Exception { throws Exception {
return FieldBuilder.getInstance(configuration, classWriter.getClassDoc(), return FieldBuilder.getInstance(context, classWriter.getClassDoc(),
writerFactory.getFieldWriter(classWriter)); writerFactory.getFieldWriter(classWriter));
} }
@ -195,9 +203,9 @@ public class BuilderFactory {
*/ */
public AbstractBuilder getConstructorBuilder(ClassWriter classWriter) public AbstractBuilder getConstructorBuilder(ClassWriter classWriter)
throws Exception { throws Exception {
return ConstructorBuilder.getInstance(configuration, return ConstructorBuilder.getInstance(context,
classWriter.getClassDoc(), writerFactory.getConstructorWriter( classWriter.getClassDoc(),
classWriter)); writerFactory.getConstructorWriter(classWriter));
} }
/** /**
@ -207,7 +215,7 @@ public class BuilderFactory {
*/ */
public AbstractBuilder getMemberSummaryBuilder(ClassWriter classWriter) public AbstractBuilder getMemberSummaryBuilder(ClassWriter classWriter)
throws Exception { throws Exception {
return MemberSummaryBuilder.getInstance(classWriter, configuration); return MemberSummaryBuilder.getInstance(classWriter, context);
} }
/** /**
@ -220,8 +228,7 @@ public class BuilderFactory {
public AbstractBuilder getMemberSummaryBuilder( public AbstractBuilder getMemberSummaryBuilder(
AnnotationTypeWriter annotationTypeWriter) AnnotationTypeWriter annotationTypeWriter)
throws Exception { throws Exception {
return MemberSummaryBuilder.getInstance(annotationTypeWriter, return MemberSummaryBuilder.getInstance(annotationTypeWriter, context);
configuration);
} }
/** /**
@ -231,6 +238,6 @@ public class BuilderFactory {
*/ */
public AbstractBuilder getSerializedFormBuilder() public AbstractBuilder getSerializedFormBuilder()
throws Exception { throws Exception {
return SerializedFormBuilder.getInstance(configuration); return SerializedFormBuilder.getInstance(context);
} }
} }

View File

@ -54,22 +54,22 @@ public class ClassBuilder extends AbstractBuilder {
/** /**
* The class being documented. * The class being documented.
*/ */
private ClassDoc classDoc; private final ClassDoc classDoc;
/** /**
* The doclet specific writer. * The doclet specific writer.
*/ */
private ClassWriter writer; private final ClassWriter writer;
/** /**
* Keep track of whether or not this classdoc is an interface. * Keep track of whether or not this classdoc is an interface.
*/ */
private boolean isInterface = false; private final boolean isInterface;
/** /**
* Keep track of whether or not this classdoc is an enum. * Keep track of whether or not this classdoc is an enum.
*/ */
private boolean isEnum = false; private final boolean isEnum;
/** /**
* The content tree for the class documentation. * The content tree for the class documentation.
@ -79,44 +79,45 @@ public class ClassBuilder extends AbstractBuilder {
/** /**
* Construct a new ClassBuilder. * Construct a new ClassBuilder.
* *
* @param configuration the current configuration of the * @param context the build context
* doclet. * @param classDoc the class being documented.
* @param writer the doclet specific writer.
*/ */
private ClassBuilder(Configuration configuration) { private ClassBuilder(Context context,
super(configuration); ClassDoc classDoc, ClassWriter writer) {
super(context);
this.classDoc = classDoc;
this.writer = writer;
if (classDoc.isInterface()) {
isInterface = true;
isEnum = false;
} else if (classDoc.isEnum()) {
isInterface = false;
isEnum = true;
Util.setEnumDocumentation(configuration, classDoc);
} else {
isInterface = false;
isEnum = false;
}
} }
/** /**
* Construct a new ClassBuilder. * Construct a new ClassBuilder.
* *
* @param configuration the current configuration of the doclet. * @param context the build context
* @param classDoc the class being documented. * @param classDoc the class being documented.
* @param writer the doclet specific writer. * @param writer the doclet specific writer.
*/ */
public static ClassBuilder getInstance(Configuration configuration, public static ClassBuilder getInstance(Context context,
ClassDoc classDoc, ClassWriter writer) ClassDoc classDoc, ClassWriter writer) {
throws Exception { return new ClassBuilder(context, classDoc, writer);
ClassBuilder builder = new ClassBuilder(configuration);
builder.configuration = configuration;
builder.classDoc = classDoc;
builder.writer = writer;
if (classDoc.isInterface()) {
builder.isInterface = true;
} else if (classDoc.isEnum()) {
builder.isEnum = true;
Util.setEnumDocumentation(configuration, classDoc);
}
if(containingPackagesSeen == null) {
containingPackagesSeen = new HashSet<String>();
}
return builder;
} }
/** /**
* {@inheritDoc} * {@inheritDoc}
*/ */
public void build() throws IOException { public void build() throws IOException {
build(LayoutParser.getInstance(configuration).parseXML(ROOT), contentTree); build(layoutParser.parseXML(ROOT), contentTree);
} }
/** /**

View File

@ -60,12 +60,12 @@ public class ConstantsSummaryBuilder extends AbstractBuilder {
/** /**
* The writer used to write the results. * The writer used to write the results.
*/ */
protected ConstantsSummaryWriter writer; protected final ConstantsSummaryWriter writer;
/** /**
* The set of ClassDocs that have constant fields. * The set of ClassDocs that have constant fields.
*/ */
protected Set<ClassDoc> classDocsWithConstFields; protected final Set<ClassDoc> classDocsWithConstFields;
/** /**
* The set of printed package headers. * The set of printed package headers.
@ -90,27 +90,25 @@ public class ConstantsSummaryBuilder extends AbstractBuilder {
/** /**
* Construct a new ConstantsSummaryBuilder. * Construct a new ConstantsSummaryBuilder.
* *
* @param configuration the current configuration of the * @param context the build context.
* doclet. * @param writer the writer for the summary.
*/ */
private ConstantsSummaryBuilder(Configuration configuration) { private ConstantsSummaryBuilder(Context context,
super(configuration); ConstantsSummaryWriter writer) {
super(context);
this.writer = writer;
this.classDocsWithConstFields = new HashSet<ClassDoc>();
} }
/** /**
* Construct a ConstantsSummaryBuilder. * Construct a ConstantsSummaryBuilder.
* *
* @param configuration the configuration used in this run * @param context the build context.
* of the doclet.
* @param writer the writer for the summary. * @param writer the writer for the summary.
*/ */
public static ConstantsSummaryBuilder getInstance( public static ConstantsSummaryBuilder getInstance(Context context,
Configuration configuration, ConstantsSummaryWriter writer) { ConstantsSummaryWriter writer) {
ConstantsSummaryBuilder builder = new ConstantsSummaryBuilder( return new ConstantsSummaryBuilder(context, writer);
configuration);
builder.writer = writer;
builder.classDocsWithConstFields = new HashSet<ClassDoc>();
return builder;
} }
/** /**
@ -121,7 +119,7 @@ public class ConstantsSummaryBuilder extends AbstractBuilder {
//Doclet does not support this output. //Doclet does not support this output.
return; return;
} }
build(LayoutParser.getInstance(configuration).parseXML(ROOT), contentTree); build(layoutParser.parseXML(ROOT), contentTree);
} }
/** /**

View File

@ -59,66 +59,64 @@ public class ConstructorBuilder extends AbstractMemberBuilder {
/** /**
* The class whose constructors are being documented. * The class whose constructors are being documented.
*/ */
private ClassDoc classDoc; private final ClassDoc classDoc;
/** /**
* The visible constructors for the given class. * The visible constructors for the given class.
*/ */
private VisibleMemberMap visibleMemberMap; private final VisibleMemberMap visibleMemberMap;
/** /**
* The writer to output the constructor documentation. * The writer to output the constructor documentation.
*/ */
private ConstructorWriter writer; private final ConstructorWriter writer;
/** /**
* The constructors being documented. * The constructors being documented.
*/ */
private List<ProgramElementDoc> constructors; private final List<ProgramElementDoc> constructors;
/** /**
* Construct a new ConstructorBuilder. * Construct a new ConstructorBuilder.
* *
* @param configuration the current configuration of the * @param context the build context.
* doclet. * @param classDoc the class whoses members are being documented.
* @param writer the doclet specific writer.
*/ */
private ConstructorBuilder(Configuration configuration) { private ConstructorBuilder(Context context,
super(configuration); ClassDoc classDoc,
ConstructorWriter writer) {
super(context);
this.classDoc = classDoc;
this.writer = writer;
visibleMemberMap =
new VisibleMemberMap(
classDoc,
VisibleMemberMap.CONSTRUCTORS,
configuration.nodeprecated);
constructors =
new ArrayList<ProgramElementDoc>(visibleMemberMap.getMembersFor(classDoc));
for (int i = 0; i < constructors.size(); i++) {
if (constructors.get(i).isProtected()
|| constructors.get(i).isPrivate()) {
writer.setFoundNonPubConstructor(true);
}
}
if (configuration.getMemberComparator() != null) {
Collections.sort(constructors,configuration.getMemberComparator());
}
} }
/** /**
* Construct a new ConstructorBuilder. * Construct a new ConstructorBuilder.
* *
* @param configuration the current configuration of the doclet. * @param context the build context.
* @param classDoc the class whoses members are being documented. * @param classDoc the class whoses members are being documented.
* @param writer the doclet specific writer. * @param writer the doclet specific writer.
*/ */
public static ConstructorBuilder getInstance( public static ConstructorBuilder getInstance(Context context,
Configuration configuration, ClassDoc classDoc, ConstructorWriter writer) {
ClassDoc classDoc, return new ConstructorBuilder(context, classDoc, writer);
ConstructorWriter writer) {
ConstructorBuilder builder = new ConstructorBuilder(configuration);
builder.classDoc = classDoc;
builder.writer = writer;
builder.visibleMemberMap =
new VisibleMemberMap(
classDoc,
VisibleMemberMap.CONSTRUCTORS,
configuration.nodeprecated);
builder.constructors =
new ArrayList<ProgramElementDoc>(builder.visibleMemberMap.getMembersFor(classDoc));
for (int i = 0; i < builder.constructors.size(); i++) {
if (builder.constructors.get(i).isProtected()
|| builder.constructors.get(i).isPrivate()) {
writer.setFoundNonPubConstructor(true);
}
}
if (configuration.getMemberComparator() != null) {
Collections.sort(
builder.constructors,
configuration.getMemberComparator());
}
return builder;
} }
/** /**

View File

@ -48,22 +48,22 @@ public class EnumConstantBuilder extends AbstractMemberBuilder {
/** /**
* The class whose enum constants are being documented. * The class whose enum constants are being documented.
*/ */
private ClassDoc classDoc; private final ClassDoc classDoc;
/** /**
* The visible enum constantss for the given class. * The visible enum constantss for the given class.
*/ */
private VisibleMemberMap visibleMemberMap; private final VisibleMemberMap visibleMemberMap;
/** /**
* The writer to output the enum constants documentation. * The writer to output the enum constants documentation.
*/ */
private EnumConstantWriter writer; private final EnumConstantWriter writer;
/** /**
* The list of enum constants being documented. * The list of enum constants being documented.
*/ */
private List<ProgramElementDoc> enumConstants; private final List<ProgramElementDoc> enumConstants;
/** /**
* The index of the current enum constant that is being documented at this point * The index of the current enum constant that is being documented at this point
@ -74,40 +74,37 @@ public class EnumConstantBuilder extends AbstractMemberBuilder {
/** /**
* Construct a new EnumConstantsBuilder. * Construct a new EnumConstantsBuilder.
* *
* @param configuration the current configuration of the * @param context the build context.
* doclet. * @param classDoc the class whoses members are being documented.
* @param writer the doclet specific writer.
*/ */
private EnumConstantBuilder(Configuration configuration) { private EnumConstantBuilder(Context context,
super(configuration); ClassDoc classDoc, EnumConstantWriter writer) {
super(context);
this.classDoc = classDoc;
this.writer = writer;
visibleMemberMap =
new VisibleMemberMap(
classDoc,
VisibleMemberMap.ENUM_CONSTANTS,
configuration.nodeprecated);
enumConstants =
new ArrayList<ProgramElementDoc>(visibleMemberMap.getMembersFor(classDoc));
if (configuration.getMemberComparator() != null) {
Collections.sort(enumConstants, configuration.getMemberComparator());
}
} }
/** /**
* Construct a new EnumConstantsBuilder. * Construct a new EnumConstantsBuilder.
* *
* @param configuration the current configuration of the doclet. * @param context the build context.
* @param classDoc the class whoses members are being documented. * @param classDoc the class whoses members are being documented.
* @param writer the doclet specific writer. * @param writer the doclet specific writer.
*/ */
public static EnumConstantBuilder getInstance( public static EnumConstantBuilder getInstance(Context context,
Configuration configuration, ClassDoc classDoc, EnumConstantWriter writer) {
ClassDoc classDoc, return new EnumConstantBuilder(context, classDoc, writer);
EnumConstantWriter writer) {
EnumConstantBuilder builder = new EnumConstantBuilder(configuration);
builder.classDoc = classDoc;
builder.writer = writer;
builder.visibleMemberMap =
new VisibleMemberMap(
classDoc,
VisibleMemberMap.ENUM_CONSTANTS,
configuration.nodeprecated);
builder.enumConstants =
new ArrayList<ProgramElementDoc>(builder.visibleMemberMap.getMembersFor(classDoc));
if (configuration.getMemberComparator() != null) {
Collections.sort(
builder.enumConstants,
configuration.getMemberComparator());
}
return builder;
} }
/** /**

View File

@ -48,22 +48,22 @@ public class FieldBuilder extends AbstractMemberBuilder {
/** /**
* The class whose fields are being documented. * The class whose fields are being documented.
*/ */
private ClassDoc classDoc; private final ClassDoc classDoc;
/** /**
* The visible fields for the given class. * The visible fields for the given class.
*/ */
private VisibleMemberMap visibleMemberMap; private final VisibleMemberMap visibleMemberMap;
/** /**
* The writer to output the field documentation. * The writer to output the field documentation.
*/ */
private FieldWriter writer; private final FieldWriter writer;
/** /**
* The list of fields being documented. * The list of fields being documented.
*/ */
private List<ProgramElementDoc> fields; private final List<ProgramElementDoc> fields;
/** /**
* The index of the current field that is being documented at this point * The index of the current field that is being documented at this point
@ -74,41 +74,40 @@ public class FieldBuilder extends AbstractMemberBuilder {
/** /**
* Construct a new FieldBuilder. * Construct a new FieldBuilder.
* *
* @param configuration the current configuration of the * @param context the build context.
* doclet. * @param classDoc the class whoses members are being documented.
* @param writer the doclet specific writer.
*/ */
private FieldBuilder(Configuration configuration) { private FieldBuilder(Context context,
super(configuration); ClassDoc classDoc,
FieldWriter writer) {
super(context);
this.classDoc = classDoc;
this.writer = writer;
visibleMemberMap =
new VisibleMemberMap(
classDoc,
VisibleMemberMap.FIELDS,
configuration.nodeprecated);
fields =
new ArrayList<ProgramElementDoc>(visibleMemberMap.getLeafClassMembers(
configuration));
if (configuration.getMemberComparator() != null) {
Collections.sort(fields, configuration.getMemberComparator());
}
} }
/** /**
* Construct a new FieldBuilder. * Construct a new FieldBuilder.
* *
* @param configuration the current configuration of the doclet. * @param context the build context.
* @param classDoc the class whoses members are being documented. * @param classDoc the class whoses members are being documented.
* @param writer the doclet specific writer. * @param writer the doclet specific writer.
*/ */
public static FieldBuilder getInstance( public static FieldBuilder getInstance(Context context,
Configuration configuration,
ClassDoc classDoc, ClassDoc classDoc,
FieldWriter writer) { FieldWriter writer) {
FieldBuilder builder = new FieldBuilder(configuration); return new FieldBuilder(context, classDoc, writer);
builder.classDoc = classDoc;
builder.writer = writer;
builder.visibleMemberMap =
new VisibleMemberMap(
classDoc,
VisibleMemberMap.FIELDS,
configuration.nodeprecated);
builder.fields =
new ArrayList<ProgramElementDoc>(builder.visibleMemberMap.getLeafClassMembers(
configuration));
if (configuration.getMemberComparator() != null) {
Collections.sort(
builder.fields,
configuration.getMemberComparator());
}
return builder;
} }
/** /**

View File

@ -55,14 +55,10 @@ public class LayoutParser extends DefaultHandler {
*/ */
private Map<String,XMLNode> xmlElementsMap; private Map<String,XMLNode> xmlElementsMap;
private XMLNode currentNode; private XMLNode currentNode;
private Configuration configuration; private final Configuration configuration;
private static LayoutParser instance;
private String currentRoot; private String currentRoot;
private boolean isParsing; private boolean isParsing;
/**
* This class is a singleton.
*/
private LayoutParser(Configuration configuration) { private LayoutParser(Configuration configuration) {
xmlElementsMap = new HashMap<String,XMLNode>(); xmlElementsMap = new HashMap<String,XMLNode>();
this.configuration = configuration; this.configuration = configuration;
@ -75,10 +71,7 @@ public class LayoutParser extends DefaultHandler {
* @return an instance of the BuilderXML. * @return an instance of the BuilderXML.
*/ */
public static LayoutParser getInstance(Configuration configuration) { public static LayoutParser getInstance(Configuration configuration) {
if (instance == null) { return new LayoutParser(configuration);
instance = new LayoutParser(configuration);
}
return instance;
} }
/** /**

View File

@ -53,7 +53,7 @@ public class MemberSummaryBuilder extends AbstractMemberBuilder {
/** /**
* The visible members for the given class. * The visible members for the given class.
*/ */
private VisibleMemberMap[] visibleMemberMaps; private final VisibleMemberMap[] visibleMemberMaps;
/** /**
* The member summary writers for the given class. * The member summary writers for the given class.
@ -63,10 +63,27 @@ public class MemberSummaryBuilder extends AbstractMemberBuilder {
/** /**
* The type being documented. * The type being documented.
*/ */
private ClassDoc classDoc; private final ClassDoc classDoc;
private MemberSummaryBuilder(Configuration configuration) { /**
super(configuration); * Construct a new MemberSummaryBuilder.
*
* @param classWriter the writer for the class whose members are being
* summarized.
* @param context the build context.
*/
private MemberSummaryBuilder(Context context, ClassDoc classDoc) {
super(context);
this.classDoc = classDoc;
visibleMemberMaps =
new VisibleMemberMap[VisibleMemberMap.NUM_MEMBER_TYPES];
for (int i = 0; i < VisibleMemberMap.NUM_MEMBER_TYPES; i++) {
visibleMemberMaps[i] =
new VisibleMemberMap(
classDoc,
i,
configuration.nodeprecated);
}
} }
/** /**
@ -74,14 +91,22 @@ public class MemberSummaryBuilder extends AbstractMemberBuilder {
* *
* @param classWriter the writer for the class whose members are being * @param classWriter the writer for the class whose members are being
* summarized. * summarized.
* @param configuration the current configuration of the doclet. * @param context the build context.
*/ */
public static MemberSummaryBuilder getInstance( public static MemberSummaryBuilder getInstance(
ClassWriter classWriter, Configuration configuration) ClassWriter classWriter, Context context)
throws Exception { throws Exception {
MemberSummaryBuilder builder = new MemberSummaryBuilder(configuration); MemberSummaryBuilder builder = new MemberSummaryBuilder(context,
builder.classDoc = classWriter.getClassDoc(); classWriter.getClassDoc());
builder.init(classWriter); builder.memberSummaryWriters =
new MemberSummaryWriter[VisibleMemberMap.NUM_MEMBER_TYPES];
WriterFactory wf = context.configuration.getWriterFactory();
for (int i = 0; i < VisibleMemberMap.NUM_MEMBER_TYPES; i++) {
builder.memberSummaryWriters[i] =
builder.visibleMemberMaps[i].noVisibleMembers() ?
null :
wf.getMemberSummaryWriter(classWriter, i);
}
return builder; return builder;
} }
@ -93,42 +118,21 @@ public class MemberSummaryBuilder extends AbstractMemberBuilder {
* @param configuration the current configuration of the doclet. * @param configuration the current configuration of the doclet.
*/ */
public static MemberSummaryBuilder getInstance( public static MemberSummaryBuilder getInstance(
AnnotationTypeWriter annotationTypeWriter, Configuration configuration) AnnotationTypeWriter annotationTypeWriter, Context context)
throws Exception { throws Exception {
MemberSummaryBuilder builder = new MemberSummaryBuilder(configuration); MemberSummaryBuilder builder = new MemberSummaryBuilder(context,
builder.classDoc = annotationTypeWriter.getAnnotationTypeDoc(); annotationTypeWriter.getAnnotationTypeDoc());
builder.init(annotationTypeWriter); builder.memberSummaryWriters =
return builder;
}
private void init(Object writer) throws Exception {
visibleMemberMaps =
new VisibleMemberMap[VisibleMemberMap.NUM_MEMBER_TYPES];
for (int i = 0; i < VisibleMemberMap.NUM_MEMBER_TYPES; i++) {
visibleMemberMaps[i] =
new VisibleMemberMap(
classDoc,
i,
configuration.nodeprecated);
}
memberSummaryWriters =
new MemberSummaryWriter[VisibleMemberMap.NUM_MEMBER_TYPES]; new MemberSummaryWriter[VisibleMemberMap.NUM_MEMBER_TYPES];
WriterFactory wf = context.configuration.getWriterFactory();
for (int i = 0; i < VisibleMemberMap.NUM_MEMBER_TYPES; i++) { for (int i = 0; i < VisibleMemberMap.NUM_MEMBER_TYPES; i++) {
if (classDoc.isAnnotationType()) { builder.memberSummaryWriters[i] =
memberSummaryWriters[i] = builder.visibleMemberMaps[i].noVisibleMembers()?
visibleMemberMaps[i].noVisibleMembers()?
null : null :
configuration.getWriterFactory().getMemberSummaryWriter( wf.getMemberSummaryWriter(
(AnnotationTypeWriter) writer, i); annotationTypeWriter, i);
} else {
memberSummaryWriters[i] =
visibleMemberMaps[i].noVisibleMembers()?
null :
configuration.getWriterFactory().getMemberSummaryWriter(
(ClassWriter) writer, i);
}
} }
return builder;
} }
/** /**
@ -304,7 +308,7 @@ public class MemberSummaryBuilder extends AbstractMemberBuilder {
configuration)); configuration));
if (members.size() > 0) { if (members.size() > 0) {
Collections.sort(members); Collections.sort(members);
Content tableTree = writer.getSummaryTableTree(classDoc); List<Content> tableContents = new LinkedList<Content>();
for (int i = 0; i < members.size(); i++) { for (int i = 0; i < members.size(); i++) {
ProgramElementDoc member = members.get(i); ProgramElementDoc member = members.get(i);
Tag[] firstSentenceTags = member.firstSentenceTags(); Tag[] firstSentenceTags = member.firstSentenceTags();
@ -313,14 +317,15 @@ public class MemberSummaryBuilder extends AbstractMemberBuilder {
//necessary. //necessary.
DocFinder.Output inheritedDoc = DocFinder.Output inheritedDoc =
DocFinder.search(new DocFinder.Input((MethodDoc) member)); DocFinder.search(new DocFinder.Input((MethodDoc) member));
if (inheritedDoc.holder != null && if (inheritedDoc.holder != null
inheritedDoc.holder.firstSentenceTags().length > 0) { && inheritedDoc.holder.firstSentenceTags().length > 0) {
firstSentenceTags = inheritedDoc.holder.firstSentenceTags(); firstSentenceTags = inheritedDoc.holder.firstSentenceTags();
} }
} }
writer.addMemberSummary(classDoc, member, firstSentenceTags, tableTree, i); writer.addMemberSummary(classDoc, member, firstSentenceTags,
tableContents, i);
} }
summaryTreeList.add(tableTree); summaryTreeList.add(writer.getSummaryTableTree(classDoc, tableContents));
} }
} }

View File

@ -54,57 +54,61 @@ public class MethodBuilder extends AbstractMemberBuilder {
/** /**
* The class whose methods are being documented. * The class whose methods are being documented.
*/ */
private ClassDoc classDoc; private final ClassDoc classDoc;
/** /**
* The visible methods for the given class. * The visible methods for the given class.
*/ */
private VisibleMemberMap visibleMemberMap; private final VisibleMemberMap visibleMemberMap;
/** /**
* The writer to output the method documentation. * The writer to output the method documentation.
*/ */
private MethodWriter writer; private final MethodWriter writer;
/** /**
* The methods being documented. * The methods being documented.
*/ */
private List<ProgramElementDoc> methods; private List<ProgramElementDoc> methods;
private MethodBuilder(Configuration configuration) {
super(configuration); /**
* Construct a new MethodBuilder.
*
* @param context the build context.
* @param classDoc the class whoses members are being documented.
* @param writer the doclet specific writer.
*/
private MethodBuilder(Context context,
ClassDoc classDoc,
MethodWriter writer) {
super(context);
this.classDoc = classDoc;
this.writer = writer;
visibleMemberMap = new VisibleMemberMap(
classDoc,
VisibleMemberMap.METHODS,
configuration.nodeprecated);
methods =
new ArrayList<ProgramElementDoc>(visibleMemberMap.getLeafClassMembers(
configuration));
if (configuration.getMemberComparator() != null) {
Collections.sort(methods, configuration.getMemberComparator());
}
} }
/** /**
* Construct a new MethodBuilder. * Construct a new MethodBuilder.
* *
* @param configuration the current configuration of the doclet. * @param context the build context.
* @param classDoc the class whoses members are being documented. * @param classDoc the class whoses members are being documented.
* @param writer the doclet specific writer. * @param writer the doclet specific writer.
* *
* @return an instance of a MethodBuilder. * @return an instance of a MethodBuilder.
*/ */
public static MethodBuilder getInstance( public static MethodBuilder getInstance(Context context,
Configuration configuration, ClassDoc classDoc, MethodWriter writer) {
ClassDoc classDoc, return new MethodBuilder(context, classDoc, writer);
MethodWriter writer) {
MethodBuilder builder = new MethodBuilder(configuration);
builder.classDoc = classDoc;
builder.writer = writer;
builder.visibleMemberMap =
new VisibleMemberMap(
classDoc,
VisibleMemberMap.METHODS,
configuration.nodeprecated);
builder.methods =
new ArrayList<ProgramElementDoc>(builder.visibleMemberMap.getLeafClassMembers(
configuration));
if (configuration.getMemberComparator() != null) {
Collections.sort(
builder.methods,
configuration.getMemberComparator());
}
return builder;
} }
/** /**

View File

@ -52,40 +52,47 @@ public class PackageSummaryBuilder extends AbstractBuilder {
/** /**
* The package being documented. * The package being documented.
*/ */
private PackageDoc packageDoc; private final PackageDoc packageDoc;
/** /**
* The doclet specific writer that will output the result. * The doclet specific writer that will output the result.
*/ */
private PackageSummaryWriter packageWriter; private final PackageSummaryWriter packageWriter;
/** /**
* The content that will be added to the package summary documentation tree. * The content that will be added to the package summary documentation tree.
*/ */
private Content contentTree; private Content contentTree;
private PackageSummaryBuilder(Configuration configuration) { /**
super(configuration); * Construct a new PackageSummaryBuilder.
*
* @param context the build context.
* @param pkg the package being documented.
* @param packageWriter the doclet specific writer that will output the
* result.
*/
private PackageSummaryBuilder(Context context,
PackageDoc pkg,
PackageSummaryWriter packageWriter) {
super(context);
this.packageDoc = pkg;
this.packageWriter = packageWriter;
} }
/** /**
* Construct a new PackageSummaryBuilder. * Construct a new PackageSummaryBuilder.
* @param configuration the current configuration of the doclet. *
* @param context the build context.
* @param pkg the package being documented. * @param pkg the package being documented.
* @param packageWriter the doclet specific writer that will output the * @param packageWriter the doclet specific writer that will output the
* result. * result.
* *
* @return an instance of a PackageSummaryBuilder. * @return an instance of a PackageSummaryBuilder.
*/ */
public static PackageSummaryBuilder getInstance( public static PackageSummaryBuilder getInstance(Context context,
Configuration configuration, PackageDoc pkg, PackageSummaryWriter packageWriter) {
PackageDoc pkg, return new PackageSummaryBuilder(context, pkg, packageWriter);
PackageSummaryWriter packageWriter) {
PackageSummaryBuilder builder =
new PackageSummaryBuilder(configuration);
builder.packageDoc = pkg;
builder.packageWriter = packageWriter;
return builder;
} }
/** /**
@ -96,7 +103,7 @@ public class PackageSummaryBuilder extends AbstractBuilder {
//Doclet does not support this output. //Doclet does not support this output.
return; return;
} }
build(LayoutParser.getInstance(configuration).parseXML(ROOT), contentTree); build(layoutParser.parseXML(ROOT), contentTree);
} }
/** /**

View File

@ -93,17 +93,21 @@ public class SerializedFormBuilder extends AbstractBuilder {
*/ */
private Content contentTree; private Content contentTree;
private SerializedFormBuilder(Configuration configuration) {
super(configuration); /**
* Construct a new SerializedFormBuilder.
* @param context the build context.
*/
private SerializedFormBuilder(Context context) {
super(context);
} }
/** /**
* Construct a new SerializedFormBuilder. * Construct a new SerializedFormBuilder.
* @param configuration the current configuration of the doclet. * @param context the build context.
*/ */
public static SerializedFormBuilder getInstance(Configuration configuration) { public static SerializedFormBuilder getInstance(Context context) {
SerializedFormBuilder builder = new SerializedFormBuilder(configuration); return new SerializedFormBuilder(context);
return builder;
} }
/** /**
@ -123,7 +127,7 @@ public class SerializedFormBuilder extends AbstractBuilder {
} catch (Exception e) { } catch (Exception e) {
throw new DocletAbortException(); throw new DocletAbortException();
} }
build(LayoutParser.getInstance(configuration).parseXML(NAME), contentTree); build(layoutParser.parseXML(NAME), contentTree);
writer.close(); writer.close();
} }

Binary file not shown.

After

Width:  |  Height:  |  Size: 11 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 909 B

View File

@ -0,0 +1,30 @@
function show(type)
{
count = 0;
for (var key in methods) {
var row = document.getElementById(key);
if ((methods[key] & type) != 0) {
row.style.display = '';
row.className = (count++ % 2) ? rowColor : altColor;
}
else
row.style.display = 'none';
}
updateTabs(type);
}
function updateTabs(type)
{
for (var value in tabs) {
var sNode = document.getElementById(tabs[value][0]);
var spanNode = sNode.firstChild;
if (value == type) {
sNode.className = activeTableTab;
spanNode.innerHTML = tabs[value][1];
}
else {
sNode.className = tableTab;
spanNode.innerHTML = "<a href=\"javascript:show("+ value + ");\">" + tabs[value][1] + "</a>";
}
}
}

View File

@ -381,6 +381,31 @@ caption a:link, caption a:hover, caption a:active, caption a:visited {
background-image:url(resources/titlebar.gif); background-image:url(resources/titlebar.gif);
height:18px; height:18px;
} }
.contentContainer ul.blockList li.blockList caption span.activeTableTab span {
white-space:nowrap;
padding-top:8px;
padding-left:8px;
display:block;
float:left;
background-image:url(resources/activetitlebar.gif);
height:18px;
}
.contentContainer ul.blockList li.blockList caption span.tableTab span {
white-space:nowrap;
padding-top:8px;
padding-left:8px;
display:block;
float:left;
background-image:url(resources/titlebar.gif);
height:18px;
}
.contentContainer ul.blockList li.blockList caption span.tableTab, .contentContainer ul.blockList li.blockList caption span.activeTableTab {
padding-top:0px;
padding-left:0px;
background-image:none;
float:none;
display:inline;
}
.overviewSummary .tabEnd, .packageSummary .tabEnd, .contentContainer ul.blockList li.blockList .tabEnd, .summary .tabEnd, .classUseContainer .tabEnd, .constantValuesContainer .tabEnd { .overviewSummary .tabEnd, .packageSummary .tabEnd, .contentContainer ul.blockList li.blockList .tabEnd, .summary .tabEnd, .classUseContainer .tabEnd, .constantValuesContainer .tabEnd {
width:10px; width:10px;
background-image:url(resources/titlebar_end.gif); background-image:url(resources/titlebar_end.gif);
@ -389,6 +414,24 @@ caption a:link, caption a:hover, caption a:active, caption a:visited {
position:relative; position:relative;
float:left; float:left;
} }
.contentContainer ul.blockList li.blockList .activeTableTab .tabEnd {
width:10px;
margin-right:5px;
background-image:url(resources/activetitlebar_end.gif);
background-repeat:no-repeat;
background-position:top right;
position:relative;
float:left;
}
.contentContainer ul.blockList li.blockList .tableTab .tabEnd {
width:10px;
margin-right:5px;
background-image:url(resources/titlebar_end.gif);
background-repeat:no-repeat;
background-position:top right;
position:relative;
float:left;
}
ul.blockList ul.blockList li.blockList table { ul.blockList ul.blockList li.blockList table {
margin:0 0 12px 0px; margin:0 0 12px 0px;
width:100%; width:100%;

View File

@ -26,6 +26,7 @@
package com.sun.tools.doclets.internal.toolkit.taglets; package com.sun.tools.doclets.internal.toolkit.taglets;
import com.sun.javadoc.*; import com.sun.javadoc.*;
import com.sun.tools.doclets.internal.toolkit.Configuration;
import com.sun.tools.doclets.internal.toolkit.util.*; import com.sun.tools.doclets.internal.toolkit.util.*;
/** /**
@ -104,7 +105,7 @@ public class InheritDocTaglet extends BaseInlineTaglet {
/** /**
* Given a <code>MethodDoc</code> item, a <code>Tag</code> in the * Given a <code>MethodDoc</code> item, a <code>Tag</code> in the
* <code>MethodDoc</code> item and a String, replace all occurances * <code>MethodDoc</code> item and a String, replace all occurrences
* of @inheritDoc with documentation from it's superclass or superinterface. * of @inheritDoc with documentation from it's superclass or superinterface.
* *
* @param writer the writer that is writing the output. * @param writer the writer that is writing the output.
@ -116,12 +117,13 @@ public class InheritDocTaglet extends BaseInlineTaglet {
MethodDoc md, Tag holderTag, boolean isFirstSentence) { MethodDoc md, Tag holderTag, boolean isFirstSentence) {
TagletOutput replacement = writer.getTagletOutputInstance(); TagletOutput replacement = writer.getTagletOutputInstance();
Configuration configuration = writer.configuration();
Taglet inheritableTaglet = holderTag == null ? Taglet inheritableTaglet = holderTag == null ?
null : writer.configuration().tagletManager.getTaglet(holderTag.name()); null : configuration.tagletManager.getTaglet(holderTag.name());
if (inheritableTaglet != null && if (inheritableTaglet != null &&
!(inheritableTaglet instanceof InheritableTaglet)) { !(inheritableTaglet instanceof InheritableTaglet)) {
//This tag does not support inheritence. //This tag does not support inheritence.
writer.configuration().message.warning(md.position(), configuration.message.warning(md.position(),
"doclet.noInheritedDoc", md.name() + md.flatSignature()); "doclet.noInheritedDoc", md.name() + md.flatSignature());
} }
DocFinder.Output inheritedDoc = DocFinder.Output inheritedDoc =
@ -129,7 +131,7 @@ public class InheritDocTaglet extends BaseInlineTaglet {
(InheritableTaglet) inheritableTaglet, holderTag, (InheritableTaglet) inheritableTaglet, holderTag,
isFirstSentence, true)); isFirstSentence, true));
if (inheritedDoc.isValidInheritDocTag == false) { if (inheritedDoc.isValidInheritDocTag == false) {
writer.configuration().message.warning(md.position(), configuration.message.warning(md.position(),
"doclet.noInheritedDoc", md.name() + md.flatSignature()); "doclet.noInheritedDoc", md.name() + md.flatSignature());
} else if (inheritedDoc.inlineTags.length > 0) { } else if (inheritedDoc.inlineTags.length > 0) {
replacement = writer.commentTagsToOutput(inheritedDoc.holderTag, replacement = writer.commentTagsToOutput(inheritedDoc.holderTag,

Some files were not shown because too many files have changed in this diff Show More