Java Code Examples for com.sun.tools.javac.util.ListBuffer#toArray()

The following examples show how to use com.sun.tools.javac.util.ListBuffer#toArray() . You can vote up the ones you like or vote down the ones you don't like, and go to the original project or source file by following the links above each example. You may check out the related API usage on the sidebar.
Example 1
/**
 * Return interfaces implemented by this class or interfaces
 * extended by this interface.
 *
 * @return An array of ClassDocImpl representing the interfaces.
 * Return an empty array if there are no interfaces.
 */
public ClassDoc[] interfaces() {
    ListBuffer<ClassDocImpl> ta = new ListBuffer<ClassDocImpl>();
    for (Type t : env.types.interfaces(type)) {
        ta.append(env.getClassDoc((ClassSymbol)t.tsym));
    }
    //### Cache ta here?
    return ta.toArray(new ClassDocImpl[ta.length()]);
}
 
Example 2
/**
 * Return serialField tags in this comment.
 */
SerialFieldTag[] serialFieldTags() {
    ListBuffer<SerialFieldTag> found = new ListBuffer<>();
    for (Tag next : tagList) {
        if (next instanceof SerialFieldTag) {
            found.append((SerialFieldTag)next);
        }
    }
    return found.toArray(new SerialFieldTag[found.length()]);
}
 
Example 3
/**
 * Get Exception classes in this package.
 *
 * @return included Exceptions in this package.
 */
public ClassDoc[] exceptions() {
    ListBuffer<ClassDocImpl> ret = new ListBuffer<ClassDocImpl>();
    for (ClassDocImpl c : getClasses(true)) {
        if (c.isException()) {
            ret.append(c);
        }
    }
    return ret.toArray(new ClassDocImpl[ret.length()]);
}
 
Example 4
/**
 * Get included interfaces in this package, omitting annotation types.
 *
 * @return included interfaces in this package.
 */
public ClassDoc[] interfaces() {
    ListBuffer<ClassDocImpl> ret = new ListBuffer<ClassDocImpl>();
    for (ClassDocImpl c : getClasses(true)) {
        if (c.isInterface()) {
            ret.append(c);
        }
    }
    return ret.toArray(new ClassDocImpl[ret.length()]);
}
 
Example 5
private Attribute.Compound[] unpackContained(Attribute.Compound container) {
    // Pack them in an array
    Attribute[] contained0 = null;
    if (container != null)
        contained0 = unpackAttributes(container);
    ListBuffer<Attribute.Compound> compounds = new ListBuffer<>();
    if (contained0 != null) {
        for (Attribute a : contained0)
            if (a instanceof Attribute.Compound)
                compounds = compounds.append((Attribute.Compound)a);
    }
    return compounds.toArray(new Attribute.Compound[compounds.size()]);
}
 
Example 6
/**
 * Get included interfaces in this package, omitting annotation types.
 *
 * @return included interfaces in this package.
 */
public ClassDoc[] interfaces() {
    ListBuffer<ClassDocImpl> ret = new ListBuffer<ClassDocImpl>();
    for (ClassDocImpl c : getClasses(true)) {
        if (c.isInterface()) {
            ret.append(c);
        }
    }
    return ret.toArray(new ClassDocImpl[ret.length()]);
}
 
Example 7
/**
 * Get included annotation types in this package.
 *
 * @return included annotation types in this package.
 */
public AnnotationTypeDoc[] annotationTypes() {
    ListBuffer<AnnotationTypeDocImpl> ret =
        new ListBuffer<AnnotationTypeDocImpl>();
    for (ClassDocImpl c : getClasses(true)) {
        if (c.isAnnotationType()) {
            ret.append((AnnotationTypeDocImpl)c);
        }
    }
    return ret.toArray(new AnnotationTypeDocImpl[ret.length()]);
}
 
Example 8
Source Project: hottub   File: Comment.java    License: GNU General Public License v2.0 5 votes vote down vote up
/**
 * Return serialField tags in this comment.
 */
SerialFieldTag[] serialFieldTags() {
    ListBuffer<SerialFieldTag> found = new ListBuffer<SerialFieldTag>();
    for (Tag next : tagList) {
        if (next instanceof SerialFieldTag) {
            found.append((SerialFieldTag)next);
        }
    }
    return found.toArray(new SerialFieldTag[found.length()]);
}
 
Example 9
/**
 * Get Error classes in this package.
 *
 * @return included Errors in this package.
 */
public ClassDoc[] errors() {
    ListBuffer<ClassDocImpl> ret = new ListBuffer<ClassDocImpl>();
    for (ClassDocImpl c : getClasses(true)) {
        if (c.isError()) {
            ret.append(c);
        }
    }
    return ret.toArray(new ClassDocImpl[ret.length()]);
}
 
Example 10
Source Project: hottub   File: Comment.java    License: GNU General Public License v2.0 5 votes vote down vote up
/**
 * Return see also tags in this comment.
 */
SeeTag[] seeTags() {
    ListBuffer<SeeTag> found = new ListBuffer<SeeTag>();
    for (Tag next : tagList) {
        if (next instanceof SeeTag) {
            found.append((SeeTag)next);
        }
    }
    return found.toArray(new SeeTag[found.length()]);
}
 
Example 11
/**
 * Classes and interfaces specified on the command line.
 */
public ClassDoc[] specifiedClasses() {
    ListBuffer<ClassDocImpl> classesToDocument = new ListBuffer<ClassDocImpl>();
    for (ClassDocImpl cd : cmdLineClasses) {
        cd.addAllClasses(classesToDocument, true);
    }
    return (ClassDoc[])classesToDocument.toArray(new ClassDocImpl[classesToDocument.length()]);
}
 
Example 12
/**
 * Return throws tags in this comment.
 */
ThrowsTag[] throwsTags() {
    ListBuffer<ThrowsTag> found = new ListBuffer<ThrowsTag>();
    for (Tag next : tagList) {
        if (next instanceof ThrowsTag) {
            found.append((ThrowsTag)next);
        }
    }
    return found.toArray(new ThrowsTag[found.length()]);
}
 
Example 13
/**
 * Get Error classes in this package.
 *
 * @return included Errors in this package.
 */
public ClassDoc[] errors() {
    ListBuffer<ClassDocImpl> ret = new ListBuffer<ClassDocImpl>();
    for (ClassDocImpl c : getClasses(true)) {
        if (c.isError()) {
            ret.append(c);
        }
    }
    return ret.toArray(new ClassDocImpl[ret.length()]);
}
 
Example 14
/**
 * Return see also tags in this comment.
 */
SeeTag[] seeTags() {
    ListBuffer<SeeTag> found = new ListBuffer<SeeTag>();
    for (Tag next : tagList) {
        if (next instanceof SeeTag) {
            found.append((SeeTag)next);
        }
    }
    return found.toArray(new SeeTag[found.length()]);
}
 
Example 15
/**
 * Return interfaces implemented by this class or interfaces
 * extended by this interface.
 *
 * @return An array of ClassDocImpl representing the interfaces.
 * Return an empty array if there are no interfaces.
 */
public ClassDoc[] interfaces() {
    ListBuffer<ClassDocImpl> ta = new ListBuffer<ClassDocImpl>();
    for (Type t : env.types.interfaces(type)) {
        ta.append(env.getClassDoc((ClassSymbol)t.tsym));
    }
    //### Cache ta here?
    return ta.toArray(new ClassDocImpl[ta.length()]);
}
 
Example 16
private Attribute.Compound[] unpackContained(Attribute.Compound container) {
    // Pack them in an array
    Attribute[] contained0 = null;
    if (container != null)
        contained0 = unpackAttributes(container);
    ListBuffer<Attribute.Compound> compounds = new ListBuffer<>();
    if (contained0 != null) {
        for (Attribute a : contained0)
            if (a instanceof Attribute.Compound)
                compounds = compounds.append((Attribute.Compound)a);
    }
    return compounds.toArray(new Attribute.Compound[compounds.size()]);
}
 
Example 17
/**
 * Return exceptions this method or constructor throws.
 *
 * @return an array of ClassDoc[] representing the exceptions
 * thrown by this method.
 */
public ClassDoc[] thrownExceptions() {
    ListBuffer<ClassDocImpl> l = new ListBuffer<ClassDocImpl>();
    for (Type ex : sym.type.getThrownTypes()) {
        ex = env.types.erasure(ex);
        //### Will these casts succeed in the face of static semantic
        //### errors in the documented code?
        ClassDocImpl cdi = env.getClassDoc((ClassSymbol)ex.tsym);
        if (cdi != null) l.append(cdi);
    }
    return l.toArray(new ClassDocImpl[l.length()]);
}
 
Example 18
/**
 * Return exceptions this method or constructor throws.
 *
 * @return an array of ClassDoc[] representing the exceptions
 * thrown by this method.
 */
public ClassDoc[] thrownExceptions() {
    ListBuffer<ClassDocImpl> l = new ListBuffer<>();
    for (Type ex : sym.type.getThrownTypes()) {
        ex = env.types.erasure(ex);
        //### Will these casts succeed in the face of static semantic
        //### errors in the documented code?
        ClassDocImpl cdi = env.getClassDoc((ClassSymbol)ex.tsym);
        if (cdi != null) l.append(cdi);
    }
    return l.toArray(new ClassDocImpl[l.length()]);
}
 
Example 19
/**
 * Get ordinary classes (that is, exclude exceptions, errors,
 * enums, interfaces, and annotation types) in this package.
 *
 * @return included ordinary classes in this package.
 */
public ClassDoc[] ordinaryClasses() {
    ListBuffer<ClassDocImpl> ret = new ListBuffer<ClassDocImpl>();
    for (ClassDocImpl c : getClasses(true)) {
        if (c.isOrdinaryClass()) {
            ret.append(c);
        }
    }
    return ret.toArray(new ClassDocImpl[ret.length()]);
}
 
Example 20
/**
 * Return array of tags with text and inline See Tags for a Doc comment.
 */
static Tag[] getInlineTags(DocImpl holder, String inlinetext) {
    ListBuffer<Tag> taglist = new ListBuffer<Tag>();
    int delimend = 0, textstart = 0, len = inlinetext.length();
    boolean inPre = false;
    DocEnv docenv = holder.env;

    if (len == 0) {
        return taglist.toArray(new Tag[taglist.length()]);
    }
    while (true) {
        int linkstart;
        if ((linkstart = inlineTagFound(holder, inlinetext,
                                        textstart)) == -1) {
            taglist.append(new TagImpl(holder, "Text",
                                       inlinetext.substring(textstart)));
            break;
        } else {
            inPre = scanForPre(inlinetext, textstart, linkstart, inPre);
            int seetextstart = linkstart;
            for (int i = linkstart; i < inlinetext.length(); i++) {
                char c = inlinetext.charAt(i);
                if (Character.isWhitespace(c) ||
                    c == '}') {
                    seetextstart = i;
                    break;
                 }
            }
            String linkName = inlinetext.substring(linkstart+2, seetextstart);
            if (!(inPre && (linkName.equals("code") || linkName.equals("literal")))) {
                //Move past the white space after the inline tag name.
                while (Character.isWhitespace(inlinetext.
                                                  charAt(seetextstart))) {
                    if (inlinetext.length() <= seetextstart) {
                        taglist.append(new TagImpl(holder, "Text",
                                                   inlinetext.substring(textstart, seetextstart)));
                        docenv.warning(holder,
                                       "tag.Improper_Use_Of_Link_Tag",
                                       inlinetext);
                        return taglist.toArray(new Tag[taglist.length()]);
                    } else {
                        seetextstart++;
                    }
                }
            }
            taglist.append(new TagImpl(holder, "Text",
                                       inlinetext.substring(textstart, linkstart)));
            textstart = seetextstart;   // this text is actually seetag
            if ((delimend = findInlineTagDelim(inlinetext, textstart)) == -1) {
                //Missing closing '}' character.
                // store the text as it is with the {@link.
                taglist.append(new TagImpl(holder, "Text",
                                           inlinetext.substring(textstart)));
                docenv.warning(holder,
                               "tag.End_delimiter_missing_for_possible_SeeTag",
                               inlinetext);
                return taglist.toArray(new Tag[taglist.length()]);
            } else {
                //Found closing '}' character.
                if (linkName.equals("see")
                       || linkName.equals("link")
                       || linkName.equals("linkplain")) {
                    taglist.append( new SeeTagImpl(holder, "@" + linkName,
                          inlinetext.substring(textstart, delimend)));
                } else {
                    taglist.append( new TagImpl(holder, "@" + linkName,
                          inlinetext.substring(textstart, delimend)));
                }
                textstart = delimend + 1;
            }
        }
        if (textstart == inlinetext.length()) {
            break;
        }
    }
    return taglist.toArray(new Tag[taglist.length()]);
}