Java Code Examples for com.sun.tools.doclint.DocLint#init()

The following examples show how to use com.sun.tools.doclint.DocLint#init() . 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: WorkArounds.java    From openjdk-jdk9 with GNU General Public License v2.0 5 votes vote down vote up
public void initDocLint(Collection<String> opts, Collection<String> customTagNames, String htmlVersion) {
    ArrayList<String> doclintOpts = new ArrayList<>();
    boolean msgOptionSeen = false;

    for (String opt : opts) {
        if (opt.startsWith(DocLint.XMSGS_OPTION)) {
            if (opt.equals(DocLint.XMSGS_CUSTOM_PREFIX + "none"))
                return;
            msgOptionSeen = true;
        }
        doclintOpts.add(opt);
    }

    if (!msgOptionSeen) {
        doclintOpts.add(DocLint.XMSGS_OPTION);
    }

    String sep = "";
    StringBuilder customTags = new StringBuilder();
    for (String customTag : customTagNames) {
        customTags.append(sep);
        customTags.append(customTag);
        sep = DocLint.SEPARATOR;
    }
    doclintOpts.add(DocLint.XCUSTOM_TAGS_PREFIX + customTags.toString());
    doclintOpts.add(DocLint.XHTML_VERSION_PREFIX + htmlVersion);

    JavacTask t = BasicJavacTask.instance(toolEnv.context);
    doclint = new DocLint();
    // standard doclet normally generates H1, H2
    doclintOpts.add(DocLint.XIMPLICIT_HEADERS + "2");
    doclint.init(t, doclintOpts.toArray(new String[doclintOpts.size()]), false);
}
 
Example 2
Source File: RunTest.java    From openjdk-8 with GNU General Public License v2.0 5 votes vote down vote up
void testInit(boolean expectOK, String[] args, List<? extends JavaFileObject> files) {
    JavacTool javac = JavacTool.create();
    JavacTask task = javac.getTask(null, null, null, null, null, files);
    try {
        DocLint dl = new DocLint();
        dl.init(task, args, true);
        if (!expectOK)
            error("expected IllegalArgumentException not thrown");
        task.call();
    } catch (IllegalArgumentException e) {
        System.err.println(e);
        if (expectOK)
            error("unexpected IllegalArgumentException caught");
    }
}
 
Example 3
Source File: DocEnv.java    From openjdk-8 with GNU General Public License v2.0 5 votes vote down vote up
void initDoclint(Collection<String> opts, Collection<String> customTagNames) {
    ArrayList<String> doclintOpts = new ArrayList<String>();

    for (String opt: opts) {
        doclintOpts.add(opt == null ? DocLint.XMSGS_OPTION : DocLint.XMSGS_CUSTOM_PREFIX + opt);
    }

    if (doclintOpts.isEmpty()) {
        doclintOpts.add(DocLint.XMSGS_OPTION);
    } else if (doclintOpts.size() == 1
            && doclintOpts.get(0).equals(DocLint.XMSGS_CUSTOM_PREFIX + "none")) {
        return;
    }

    String sep = "";
    StringBuilder customTags = new StringBuilder();
    for (String customTag : customTagNames) {
        customTags.append(sep);
        customTags.append(customTag);
        sep = DocLint.TAGS_SEPARATOR;
    }
    doclintOpts.add(DocLint.XCUSTOM_TAGS_PREFIX + customTags.toString());

    JavacTask t = BasicJavacTask.instance(context);
    doclint = new DocLint();
    // standard doclet normally generates H1, H2
    doclintOpts.add(DocLint.XIMPLICIT_HEADERS + "2");
    doclint.init(t, doclintOpts.toArray(new String[doclintOpts.size()]), false);
}
 
Example 4
Source File: RunTest.java    From openjdk-8-source with GNU General Public License v2.0 5 votes vote down vote up
void testInit(boolean expectOK, String[] args, List<? extends JavaFileObject> files) {
    JavacTool javac = JavacTool.create();
    JavacTask task = javac.getTask(null, null, null, null, null, files);
    try {
        DocLint dl = new DocLint();
        dl.init(task, args, true);
        if (!expectOK)
            error("expected IllegalArgumentException not thrown");
        task.call();
    } catch (IllegalArgumentException e) {
        System.err.println(e);
        if (expectOK)
            error("unexpected IllegalArgumentException caught");
    }
}
 
Example 5
Source File: DocEnv.java    From openjdk-8-source with GNU General Public License v2.0 5 votes vote down vote up
void initDoclint(Collection<String> opts, Collection<String> customTagNames) {
    ArrayList<String> doclintOpts = new ArrayList<String>();

    for (String opt: opts) {
        doclintOpts.add(opt == null ? DocLint.XMSGS_OPTION : DocLint.XMSGS_CUSTOM_PREFIX + opt);
    }

    if (doclintOpts.isEmpty()) {
        doclintOpts.add(DocLint.XMSGS_OPTION);
    } else if (doclintOpts.size() == 1
            && doclintOpts.get(0).equals(DocLint.XMSGS_CUSTOM_PREFIX + "none")) {
        return;
    }

    String sep = "";
    StringBuilder customTags = new StringBuilder();
    for (String customTag : customTagNames) {
        customTags.append(sep);
        customTags.append(customTag);
        sep = DocLint.TAGS_SEPARATOR;
    }
    doclintOpts.add(DocLint.XCUSTOM_TAGS_PREFIX + customTags.toString());

    JavacTask t = BasicJavacTask.instance(context);
    doclint = new DocLint();
    // standard doclet normally generates H1, H2
    doclintOpts.add(DocLint.XIMPLICIT_HEADERS + "2");
    doclint.init(t, doclintOpts.toArray(new String[doclintOpts.size()]), false);
}
 
Example 6
Source File: RunTest.java    From hottub with GNU General Public License v2.0 5 votes vote down vote up
void testInit(boolean expectOK, String[] args, List<? extends JavaFileObject> files) {
    JavacTool javac = JavacTool.create();
    JavacTask task = javac.getTask(null, null, null, null, null, files);
    try {
        DocLint dl = new DocLint();
        dl.init(task, args, true);
        if (!expectOK)
            error("expected IllegalArgumentException not thrown");
        task.call();
    } catch (IllegalArgumentException e) {
        System.err.println(e);
        if (expectOK)
            error("unexpected IllegalArgumentException caught");
    }
}
 
Example 7
Source File: DocEnv.java    From hottub with GNU General Public License v2.0 5 votes vote down vote up
void initDoclint(Collection<String> opts, Collection<String> customTagNames) {
    ArrayList<String> doclintOpts = new ArrayList<String>();

    for (String opt: opts) {
        doclintOpts.add(opt == null ? DocLint.XMSGS_OPTION : DocLint.XMSGS_CUSTOM_PREFIX + opt);
    }

    if (doclintOpts.isEmpty()) {
        doclintOpts.add(DocLint.XMSGS_OPTION);
    } else if (doclintOpts.size() == 1
            && doclintOpts.get(0).equals(DocLint.XMSGS_CUSTOM_PREFIX + "none")) {
        return;
    }

    String sep = "";
    StringBuilder customTags = new StringBuilder();
    for (String customTag : customTagNames) {
        customTags.append(sep);
        customTags.append(customTag);
        sep = DocLint.TAGS_SEPARATOR;
    }
    doclintOpts.add(DocLint.XCUSTOM_TAGS_PREFIX + customTags.toString());

    JavacTask t = BasicJavacTask.instance(context);
    doclint = new DocLint();
    // standard doclet normally generates H1, H2
    doclintOpts.add(DocLint.XIMPLICIT_HEADERS + "2");
    doclint.init(t, doclintOpts.toArray(new String[doclintOpts.size()]), false);
}
 
Example 8
Source File: RunTest.java    From openjdk-jdk9 with GNU General Public License v2.0 5 votes vote down vote up
void testInit(boolean expectOK, String[] args, List<? extends JavaFileObject> files) {
    JavacTool javac = JavacTool.create();
    JavacTask task = javac.getTask(null, null, null, null, null, files);
    try {
        DocLint dl = new DocLint();
        dl.init(task, args, true);
        if (!expectOK)
            error("expected IllegalArgumentException not thrown");
        task.call();
    } catch (IllegalArgumentException e) {
        System.err.println(e);
        if (expectOK)
            error("unexpected IllegalArgumentException caught");
    }
}
 
Example 9
Source File: DocEnv.java    From openjdk-jdk9 with GNU General Public License v2.0 5 votes vote down vote up
void initDoclint(Collection<String> opts, Collection<String> customTagNames, String htmlVersion) {
    ArrayList<String> doclintOpts = new ArrayList<>();
    boolean msgOptionSeen = false;

    for (String opt : opts) {
        if (opt.startsWith(DocLint.XMSGS_OPTION)) {
            if (opt.equals(DocLint.XMSGS_CUSTOM_PREFIX + "none"))
                return;
            msgOptionSeen = true;
        }
        doclintOpts.add(opt);
    }

    if (!msgOptionSeen) {
        doclintOpts.add(DocLint.XMSGS_OPTION);
    }

    String sep = "";
    StringBuilder customTags = new StringBuilder();
    for (String customTag : customTagNames) {
        customTags.append(sep);
        customTags.append(customTag);
        sep = DocLint.SEPARATOR;
    }
    doclintOpts.add(DocLint.XCUSTOM_TAGS_PREFIX + customTags.toString());
    doclintOpts.add(DocLint.XHTML_VERSION_PREFIX + htmlVersion);

    JavacTask t = BasicJavacTask.instance(context);
    doclint = new DocLint();
    // standard doclet normally generates H1, H2
    doclintOpts.add(DocLint.XIMPLICIT_HEADERS + "2");
    doclint.init(t, doclintOpts.toArray(new String[doclintOpts.size()]), false);
}
 
Example 10
Source File: DocEnv.java    From TencentKona-8 with GNU General Public License v2.0 5 votes vote down vote up
void initDoclint(Collection<String> opts, Collection<String> customTagNames) {
    ArrayList<String> doclintOpts = new ArrayList<String>();

    for (String opt: opts) {
        doclintOpts.add(opt == null ? DocLint.XMSGS_OPTION : DocLint.XMSGS_CUSTOM_PREFIX + opt);
    }

    if (doclintOpts.isEmpty()) {
        doclintOpts.add(DocLint.XMSGS_OPTION);
    } else if (doclintOpts.size() == 1
            && doclintOpts.get(0).equals(DocLint.XMSGS_CUSTOM_PREFIX + "none")) {
        return;
    }

    String sep = "";
    StringBuilder customTags = new StringBuilder();
    for (String customTag : customTagNames) {
        customTags.append(sep);
        customTags.append(customTag);
        sep = DocLint.TAGS_SEPARATOR;
    }
    doclintOpts.add(DocLint.XCUSTOM_TAGS_PREFIX + customTags.toString());

    JavacTask t = BasicJavacTask.instance(context);
    doclint = new DocLint();
    // standard doclet normally generates H1, H2
    doclintOpts.add(DocLint.XIMPLICIT_HEADERS + "2");
    doclint.init(t, doclintOpts.toArray(new String[doclintOpts.size()]), false);
}
 
Example 11
Source File: RunTest.java    From openjdk-jdk8u-backup with GNU General Public License v2.0 5 votes vote down vote up
void testInit(boolean expectOK, String[] args, List<? extends JavaFileObject> files) {
    JavacTool javac = JavacTool.create();
    JavacTask task = javac.getTask(null, null, null, null, null, files);
    try {
        DocLint dl = new DocLint();
        dl.init(task, args, true);
        if (!expectOK)
            error("expected IllegalArgumentException not thrown");
        task.call();
    } catch (IllegalArgumentException e) {
        System.err.println(e);
        if (expectOK)
            error("unexpected IllegalArgumentException caught");
    }
}
 
Example 12
Source File: DocEnv.java    From openjdk-jdk8u-backup with GNU General Public License v2.0 5 votes vote down vote up
void initDoclint(Collection<String> opts, Collection<String> customTagNames) {
    ArrayList<String> doclintOpts = new ArrayList<String>();

    for (String opt: opts) {
        doclintOpts.add(opt == null ? DocLint.XMSGS_OPTION : DocLint.XMSGS_CUSTOM_PREFIX + opt);
    }

    if (doclintOpts.isEmpty()) {
        doclintOpts.add(DocLint.XMSGS_OPTION);
    } else if (doclintOpts.size() == 1
            && doclintOpts.get(0).equals(DocLint.XMSGS_CUSTOM_PREFIX + "none")) {
        return;
    }

    String sep = "";
    StringBuilder customTags = new StringBuilder();
    for (String customTag : customTagNames) {
        customTags.append(sep);
        customTags.append(customTag);
        sep = DocLint.TAGS_SEPARATOR;
    }
    doclintOpts.add(DocLint.XCUSTOM_TAGS_PREFIX + customTags.toString());

    JavacTask t = BasicJavacTask.instance(context);
    doclint = new DocLint();
    // standard doclet normally generates H1, H2
    doclintOpts.add(DocLint.XIMPLICIT_HEADERS + "2");
    doclint.init(t, doclintOpts.toArray(new String[doclintOpts.size()]), false);
}
 
Example 13
Source File: RunTest.java    From openjdk-jdk8u with GNU General Public License v2.0 5 votes vote down vote up
void testInit(boolean expectOK, String[] args, List<? extends JavaFileObject> files) {
    JavacTool javac = JavacTool.create();
    JavacTask task = javac.getTask(null, null, null, null, null, files);
    try {
        DocLint dl = new DocLint();
        dl.init(task, args, true);
        if (!expectOK)
            error("expected IllegalArgumentException not thrown");
        task.call();
    } catch (IllegalArgumentException e) {
        System.err.println(e);
        if (expectOK)
            error("unexpected IllegalArgumentException caught");
    }
}
 
Example 14
Source File: DocEnv.java    From openjdk-jdk8u with GNU General Public License v2.0 5 votes vote down vote up
void initDoclint(Collection<String> opts, Collection<String> customTagNames) {
    ArrayList<String> doclintOpts = new ArrayList<String>();

    for (String opt: opts) {
        doclintOpts.add(opt == null ? DocLint.XMSGS_OPTION : DocLint.XMSGS_CUSTOM_PREFIX + opt);
    }

    if (doclintOpts.isEmpty()) {
        doclintOpts.add(DocLint.XMSGS_OPTION);
    } else if (doclintOpts.size() == 1
            && doclintOpts.get(0).equals(DocLint.XMSGS_CUSTOM_PREFIX + "none")) {
        return;
    }

    String sep = "";
    StringBuilder customTags = new StringBuilder();
    for (String customTag : customTagNames) {
        customTags.append(sep);
        customTags.append(customTag);
        sep = DocLint.TAGS_SEPARATOR;
    }
    doclintOpts.add(DocLint.XCUSTOM_TAGS_PREFIX + customTags.toString());

    JavacTask t = BasicJavacTask.instance(context);
    doclint = new DocLint();
    // standard doclet normally generates H1, H2
    doclintOpts.add(DocLint.XIMPLICIT_HEADERS + "2");
    doclint.init(t, doclintOpts.toArray(new String[doclintOpts.size()]), false);
}
 
Example 15
Source File: RunTest.java    From jdk8u60 with GNU General Public License v2.0 5 votes vote down vote up
void testInit(boolean expectOK, String[] args, List<? extends JavaFileObject> files) {
    JavacTool javac = JavacTool.create();
    JavacTask task = javac.getTask(null, null, null, null, null, files);
    try {
        DocLint dl = new DocLint();
        dl.init(task, args, true);
        if (!expectOK)
            error("expected IllegalArgumentException not thrown");
        task.call();
    } catch (IllegalArgumentException e) {
        System.err.println(e);
        if (expectOK)
            error("unexpected IllegalArgumentException caught");
    }
}
 
Example 16
Source File: DocEnv.java    From jdk8u60 with GNU General Public License v2.0 5 votes vote down vote up
void initDoclint(Collection<String> opts, Collection<String> customTagNames) {
    ArrayList<String> doclintOpts = new ArrayList<String>();

    for (String opt: opts) {
        doclintOpts.add(opt == null ? DocLint.XMSGS_OPTION : DocLint.XMSGS_CUSTOM_PREFIX + opt);
    }

    if (doclintOpts.isEmpty()) {
        doclintOpts.add(DocLint.XMSGS_OPTION);
    } else if (doclintOpts.size() == 1
            && doclintOpts.get(0).equals(DocLint.XMSGS_CUSTOM_PREFIX + "none")) {
        return;
    }

    String sep = "";
    StringBuilder customTags = new StringBuilder();
    for (String customTag : customTagNames) {
        customTags.append(sep);
        customTags.append(customTag);
        sep = DocLint.TAGS_SEPARATOR;
    }
    doclintOpts.add(DocLint.XCUSTOM_TAGS_PREFIX + customTags.toString());

    JavacTask t = BasicJavacTask.instance(context);
    doclint = new DocLint();
    // standard doclet normally generates H1, H2
    doclintOpts.add(DocLint.XIMPLICIT_HEADERS + "2");
    doclint.init(t, doclintOpts.toArray(new String[doclintOpts.size()]), false);
}
 
Example 17
Source File: RunTest.java    From TencentKona-8 with GNU General Public License v2.0 5 votes vote down vote up
void testInit(boolean expectOK, String[] args, List<? extends JavaFileObject> files) {
    JavacTool javac = JavacTool.create();
    JavacTask task = javac.getTask(null, null, null, null, null, files);
    try {
        DocLint dl = new DocLint();
        dl.init(task, args, true);
        if (!expectOK)
            error("expected IllegalArgumentException not thrown");
        task.call();
    } catch (IllegalArgumentException e) {
        System.err.println(e);
        if (expectOK)
            error("unexpected IllegalArgumentException caught");
    }
}