langtools/src/share/classes/com/sun/tools/javadoc/Comment.java
changeset 22163 3651128c74eb
parent 22159 682da512ec17
equal deleted inserted replaced
22162:3b3e23e67329 22163:3651128c74eb
    48 class Comment {
    48 class Comment {
    49 
    49 
    50     /**
    50     /**
    51      * sorted comments with different tags.
    51      * sorted comments with different tags.
    52      */
    52      */
    53     private final ListBuffer<Tag> tagList = new ListBuffer<Tag>();
    53     private final ListBuffer<Tag> tagList = new ListBuffer<>();
    54 
    54 
    55     /**
    55     /**
    56      * text minus any tags.
    56      * text minus any tags.
    57      */
    57      */
    58     private String text;
    58     private String text;
   216 
   216 
   217     /**
   217     /**
   218      * Return tags of the specified kind in this comment.
   218      * Return tags of the specified kind in this comment.
   219      */
   219      */
   220     Tag[] tags(String tagname) {
   220     Tag[] tags(String tagname) {
   221         ListBuffer<Tag> found = new ListBuffer<Tag>();
   221         ListBuffer<Tag> found = new ListBuffer<>();
   222         String target = tagname;
   222         String target = tagname;
   223         if (target.charAt(0) != '@') {
   223         if (target.charAt(0) != '@') {
   224             target = "@" + target;
   224             target = "@" + target;
   225         }
   225         }
   226         for (Tag tag : tagList) {
   226         for (Tag tag : tagList) {
   233 
   233 
   234     /**
   234     /**
   235      * Return throws tags in this comment.
   235      * Return throws tags in this comment.
   236      */
   236      */
   237     ThrowsTag[] throwsTags() {
   237     ThrowsTag[] throwsTags() {
   238         ListBuffer<ThrowsTag> found = new ListBuffer<ThrowsTag>();
   238         ListBuffer<ThrowsTag> found = new ListBuffer<>();
   239         for (Tag next : tagList) {
   239         for (Tag next : tagList) {
   240             if (next instanceof ThrowsTag) {
   240             if (next instanceof ThrowsTag) {
   241                 found.append((ThrowsTag)next);
   241                 found.append((ThrowsTag)next);
   242             }
   242             }
   243         }
   243         }
   262      * Return param tags in this comment.  If typeParams is true
   262      * Return param tags in this comment.  If typeParams is true
   263      * include only type param tags, otherwise include only ordinary
   263      * include only type param tags, otherwise include only ordinary
   264      * param tags.
   264      * param tags.
   265      */
   265      */
   266     private ParamTag[] paramTags(boolean typeParams) {
   266     private ParamTag[] paramTags(boolean typeParams) {
   267         ListBuffer<ParamTag> found = new ListBuffer<ParamTag>();
   267         ListBuffer<ParamTag> found = new ListBuffer<>();
   268         for (Tag next : tagList) {
   268         for (Tag next : tagList) {
   269             if (next instanceof ParamTag) {
   269             if (next instanceof ParamTag) {
   270                 ParamTag p = (ParamTag)next;
   270                 ParamTag p = (ParamTag)next;
   271                 if (typeParams == p.isTypeParameter()) {
   271                 if (typeParams == p.isTypeParameter()) {
   272                     found.append(p);
   272                     found.append(p);
   278 
   278 
   279     /**
   279     /**
   280      * Return see also tags in this comment.
   280      * Return see also tags in this comment.
   281      */
   281      */
   282     SeeTag[] seeTags() {
   282     SeeTag[] seeTags() {
   283         ListBuffer<SeeTag> found = new ListBuffer<SeeTag>();
   283         ListBuffer<SeeTag> found = new ListBuffer<>();
   284         for (Tag next : tagList) {
   284         for (Tag next : tagList) {
   285             if (next instanceof SeeTag) {
   285             if (next instanceof SeeTag) {
   286                 found.append((SeeTag)next);
   286                 found.append((SeeTag)next);
   287             }
   287             }
   288         }
   288         }
   291 
   291 
   292     /**
   292     /**
   293      * Return serialField tags in this comment.
   293      * Return serialField tags in this comment.
   294      */
   294      */
   295     SerialFieldTag[] serialFieldTags() {
   295     SerialFieldTag[] serialFieldTags() {
   296         ListBuffer<SerialFieldTag> found = new ListBuffer<SerialFieldTag>();
   296         ListBuffer<SerialFieldTag> found = new ListBuffer<>();
   297         for (Tag next : tagList) {
   297         for (Tag next : tagList) {
   298             if (next instanceof SerialFieldTag) {
   298             if (next instanceof SerialFieldTag) {
   299                 found.append((SerialFieldTag)next);
   299                 found.append((SerialFieldTag)next);
   300             }
   300             }
   301         }
   301         }
   304 
   304 
   305     /**
   305     /**
   306      * Return array of tags with text and inline See Tags for a Doc comment.
   306      * Return array of tags with text and inline See Tags for a Doc comment.
   307      */
   307      */
   308     static Tag[] getInlineTags(DocImpl holder, String inlinetext) {
   308     static Tag[] getInlineTags(DocImpl holder, String inlinetext) {
   309         ListBuffer<Tag> taglist = new ListBuffer<Tag>();
   309         ListBuffer<Tag> taglist = new ListBuffer<>();
   310         int delimend = 0, textstart = 0, len = inlinetext.length();
   310         int delimend = 0, textstart = 0, len = inlinetext.length();
   311         boolean inPre = false;
   311         boolean inPre = false;
   312         DocEnv docenv = holder.env;
   312         DocEnv docenv = holder.env;
   313 
   313 
   314         if (len == 0) {
   314         if (len == 0) {