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
Source File: RootDocImpl.java    From openjdk-8 with GNU General Public License v2.0 5 votes vote down vote up
/**
 * 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 2
Source File: PackageDocImpl.java    From openjdk-jdk8u with GNU General Public License v2.0 5 votes vote down vote up
/**
 * 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 3
Source File: ExecutableMemberDocImpl.java    From openjdk-jdk9 with GNU General Public License v2.0 5 votes vote down vote up
/**
 * 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 4
Source File: ExecutableMemberDocImpl.java    From hottub with GNU General Public License v2.0 5 votes vote down vote up
/**
 * 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 5
Source File: AnnoConstruct.java    From TencentKona-8 with GNU General Public License v2.0 5 votes vote down vote up
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
Source File: ClassDocImpl.java    From openjdk-8-source with GNU General Public License v2.0 5 votes vote down vote up
/**
 * 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 7
Source File: Comment.java    From TencentKona-8 with 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 8
Source File: PackageDocImpl.java    From hottub with GNU General Public License v2.0 5 votes vote down vote up
/**
 * 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 9
Source File: Comment.java    From TencentKona-8 with GNU General Public License v2.0 5 votes vote down vote up
/**
 * 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 10
Source File: ClassDocImpl.java    From TencentKona-8 with GNU General Public License v2.0 5 votes vote down vote up
/**
 * 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 11
Source File: Comment.java    From hottub with 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 12
Source File: PackageDocImpl.java    From jdk8u60 with GNU General Public License v2.0 5 votes vote down vote up
/**
 * 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 13
Source File: Comment.java    From hottub with 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 14
Source File: PackageDocImpl.java    From openjdk-8-source with GNU General Public License v2.0 5 votes vote down vote up
/**
 * 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 15
Source File: PackageDocImpl.java    From openjdk-jdk8u-backup with GNU General Public License v2.0 5 votes vote down vote up
/**
 * 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 16
Source File: AnnoConstruct.java    From hottub with GNU General Public License v2.0 5 votes vote down vote up
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
Source File: PackageDocImpl.java    From jdk8u60 with GNU General Public License v2.0 5 votes vote down vote up
/**
 * 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 18
Source File: PackageDocImpl.java    From TencentKona-8 with GNU General Public License v2.0 5 votes vote down vote up
/**
 * 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 19
Source File: Comment.java    From openjdk-jdk9 with 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<>();
    for (Tag next : tagList) {
        if (next instanceof SerialFieldTag) {
            found.append((SerialFieldTag)next);
        }
    }
    return found.toArray(new SerialFieldTag[found.length()]);
}
 
Example 20
Source File: Comment.java    From openjdk-jdk8u with GNU General Public License v2.0 4 votes vote down vote up
/**
 * 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()]);
}