com.sun.tools.doclint.DocLint Java Examples
The following examples show how to use
com.sun.tools.doclint.DocLint.
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: RunTest.java From jdk8u60 with GNU General Public License v2.0 | 6 votes |
void testArgsNoFiles() throws BadArgs, IOException { System.err.println("test args, no files"); DocLint dl = new DocLint(); StringWriter sw = new StringWriter(); PrintWriter pw = new PrintWriter(sw); dl.run(pw, "-Xmsgs"); pw.close(); String out = sw.toString(); String expect = "No files given"; if (!Objects.equals(out.trim(), expect)) { error("unexpected output"); System.err.println("EXPECT>>" + expect + "<<"); System.err.println("FOUND>>" + out + "<<"); } }
Example #2
Source File: RunTest.java From openjdk-jdk8u-backup with GNU General Public License v2.0 | 6 votes |
void testArgsNoFiles() throws BadArgs, IOException { System.err.println("test args, no files"); DocLint dl = new DocLint(); StringWriter sw = new StringWriter(); PrintWriter pw = new PrintWriter(sw); dl.run(pw, "-Xmsgs"); pw.close(); String out = sw.toString(); String expect = "No files given"; if (!Objects.equals(out.trim(), expect)) { error("unexpected output"); System.err.println("EXPECT>>" + expect + "<<"); System.err.println("FOUND>>" + out + "<<"); } }
Example #3
Source File: RunTest.java From openjdk-jdk8u with GNU General Public License v2.0 | 6 votes |
void testArgsNoFiles() throws BadArgs, IOException { System.err.println("test args, no files"); DocLint dl = new DocLint(); StringWriter sw = new StringWriter(); PrintWriter pw = new PrintWriter(sw); dl.run(pw, "-Xmsgs"); pw.close(); String out = sw.toString(); String expect = "No files given"; if (!Objects.equals(out.trim(), expect)) { error("unexpected output"); System.err.println("EXPECT>>" + expect + "<<"); System.err.println("FOUND>>" + out + "<<"); } }
Example #4
Source File: RunTest.java From hottub with GNU General Public License v2.0 | 6 votes |
void testArgsNoFiles() throws BadArgs, IOException { System.err.println("test args, no files"); DocLint dl = new DocLint(); StringWriter sw = new StringWriter(); PrintWriter pw = new PrintWriter(sw); dl.run(pw, "-Xmsgs"); pw.close(); String out = sw.toString(); String expect = "No files given"; if (!Objects.equals(out.trim(), expect)) { error("unexpected output"); System.err.println("EXPECT>>" + expect + "<<"); System.err.println("FOUND>>" + out + "<<"); } }
Example #5
Source File: RunTest.java From TencentKona-8 with GNU General Public License v2.0 | 6 votes |
void testArgsNoFiles() throws BadArgs, IOException { System.err.println("test args, no files"); DocLint dl = new DocLint(); StringWriter sw = new StringWriter(); PrintWriter pw = new PrintWriter(sw); dl.run(pw, "-Xmsgs"); pw.close(); String out = sw.toString(); String expect = "No files given"; if (!Objects.equals(out.trim(), expect)) { error("unexpected output"); System.err.println("EXPECT>>" + expect + "<<"); System.err.println("FOUND>>" + out + "<<"); } }
Example #6
Source File: RunTest.java From openjdk-jdk9 with GNU General Public License v2.0 | 6 votes |
void testArgsNoFiles() throws BadArgs, IOException { System.err.println("test args, no files"); DocLint dl = new DocLint(); StringWriter sw = new StringWriter(); PrintWriter pw = new PrintWriter(sw); dl.run(pw, "-Xmsgs"); pw.close(); String out = sw.toString(); String expect = "No files given"; if (!Objects.equals(out.trim(), expect)) { error("unexpected output"); System.err.println("EXPECT>>" + expect + "<<"); System.err.println("FOUND>>" + out + "<<"); } }
Example #7
Source File: RunTest.java From openjdk-8-source with GNU General Public License v2.0 | 6 votes |
void testArgsNoFiles() throws BadArgs, IOException { System.err.println("test args, no files"); DocLint dl = new DocLint(); StringWriter sw = new StringWriter(); PrintWriter pw = new PrintWriter(sw); dl.run(pw, "-Xmsgs"); pw.close(); String out = sw.toString(); String expect = "No files given"; if (!Objects.equals(out.trim(), expect)) { error("unexpected output"); System.err.println("EXPECT>>" + expect + "<<"); System.err.println("FOUND>>" + out + "<<"); } }
Example #8
Source File: DocLintTester.java From openjdk-8-source with GNU General Public License v2.0 | 5 votes |
void check(List<String> opts, List<File> files, boolean expectBadArgs, File refFile) throws Exception { List<String> args = new ArrayList<String>(); args.addAll(opts); for (File file: files) args.add(file.getPath()); StringWriter sw = new StringWriter(); PrintWriter pw = new PrintWriter(sw); try { new DocLint().run(pw, args.toArray(new String[args.size()])); if (expectBadArgs) error("expected exception not thrown"); } catch (BadArgs e) { if (!expectBadArgs) error("unexpected exception caught: " + e); } pw.flush(); String out = normalizeNewlines(removeFileNames(sw.toString())).trim(); if (out != null) System.err.println("Output:\n" + out); if (refFile == null) { if (!out.isEmpty()) error("unexpected output"); } else { String expect = readFile(refFile); if (!expect.equals(out)) { error("expected output not found"); System.err.println("EXPECT>>" + expect + "<<"); System.err.println(" FOUND>>" + out + "<<"); } } }
Example #9
Source File: RunTest.java From hottub with GNU General Public License v2.0 | 5 votes |
void testRun() throws BadArgs, IOException { System.err.println("test run(String[])"); DocLint dl = new DocLint(); String[] args = { "-help" }; ByteArrayOutputStream baos = new ByteArrayOutputStream(); PrintStream ps = new PrintStream(baos); PrintStream prev = System.out; try { System.setOut(ps); dl.run(args); } finally { System.setOut(prev); } ps.close(); String stdout = baos.toString(); StringWriter sw = new StringWriter(); PrintWriter pw = new PrintWriter(sw); dl.run(pw, args); pw.close(); String direct = sw.toString(); if (!stdout.equals(direct)) { error("unexpected output"); System.err.println("EXPECT>>" + direct + "<<"); System.err.println("FOUND>>" + stdout + "<<"); } }
Example #10
Source File: RunTest.java From hottub with GNU General Public License v2.0 | 5 votes |
void testInit() { System.err.println("test init"); DocLint dl = new DocLint(); String name = dl.getName(); if (!Objects.equals(name, "doclint")) error("unexpected result for DocLint.getName()"); List<? extends JavaFileObject> files = Arrays.asList(createFile("Test.java", "/** &0; */ class Test{ }")); String[] goodArgs = { "-Xmsgs" }; testInit(true, goodArgs, files); String[] badArgs = { "-unknown" }; testInit(false, badArgs, files); }
Example #11
Source File: RunTest.java From openjdk-8 with GNU General Public License v2.0 | 5 votes |
void testInit() { System.err.println("test init"); DocLint dl = new DocLint(); String name = dl.getName(); if (!Objects.equals(name, "doclint")) error("unexpected result for DocLint.getName()"); List<? extends JavaFileObject> files = Arrays.asList(createFile("Test.java", "/** &0; */ class Test{ }")); String[] goodArgs = { "-Xmsgs" }; testInit(true, goodArgs, files); String[] badArgs = { "-unknown" }; testInit(false, badArgs, files); }
Example #12
Source File: PathsTest.java From openjdk-8-source with GNU General Public License v2.0 | 5 votes |
String doclint(String... args) throws BadArgs, IOException { StringWriter sw = new StringWriter(); PrintWriter pw = new PrintWriter(sw); DocLint dl = new DocLint(); dl.run(pw, args); pw.close(); String out = sw.toString(); if (!out.isEmpty()) System.err.println(out); return out; }
Example #13
Source File: DocEnv.java From openjdk-8 with GNU General Public License v2.0 | 5 votes |
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 #14
Source File: RunTest.java From openjdk-8 with GNU General Public License v2.0 | 5 votes |
void testMain(boolean expectOK, String... args) { try { DocLint.main(args); if (!expectOK) error("expected SecurityException (from System.exit) not thrown"); } catch (SecurityException e) { System.err.println(e); if (expectOK) error("unexpected SecurityException caught"); } }
Example #15
Source File: RunTest.java From openjdk-8 with GNU General Public License v2.0 | 5 votes |
void testRun() throws BadArgs, IOException { System.err.println("test run(String[])"); DocLint dl = new DocLint(); String[] args = { "-help" }; ByteArrayOutputStream baos = new ByteArrayOutputStream(); PrintStream ps = new PrintStream(baos); PrintStream prev = System.out; try { System.setOut(ps); dl.run(args); } finally { System.setOut(prev); } ps.close(); String stdout = baos.toString(); StringWriter sw = new StringWriter(); PrintWriter pw = new PrintWriter(sw); dl.run(pw, args); pw.close(); String direct = sw.toString(); if (!stdout.equals(direct)) { error("unexpected output"); System.err.println("EXPECT>>" + direct + "<<"); System.err.println("FOUND>>" + stdout + "<<"); } }
Example #16
Source File: DocLintTester.java From openjdk-8 with GNU General Public License v2.0 | 5 votes |
void check(List<String> opts, List<File> files, boolean expectBadArgs, File refFile) throws Exception { List<String> args = new ArrayList<String>(); args.addAll(opts); for (File file: files) args.add(file.getPath()); StringWriter sw = new StringWriter(); PrintWriter pw = new PrintWriter(sw); try { new DocLint().run(pw, args.toArray(new String[args.size()])); if (expectBadArgs) error("expected exception not thrown"); } catch (BadArgs e) { if (!expectBadArgs) error("unexpected exception caught: " + e); } pw.flush(); String out = normalizeNewlines(removeFileNames(sw.toString())).trim(); if (out != null) System.err.println("Output:\n" + out); if (refFile == null) { if (!out.isEmpty()) error("unexpected output"); } else { String expect = readFile(refFile); if (!expect.equals(out)) { error("expected output not found"); System.err.println("EXPECT>>" + expect + "<<"); System.err.println(" FOUND>>" + out + "<<"); } } }
Example #17
Source File: PathsTest.java From openjdk-8 with GNU General Public License v2.0 | 5 votes |
String doclint(String... args) throws BadArgs, IOException { StringWriter sw = new StringWriter(); PrintWriter pw = new PrintWriter(sw); DocLint dl = new DocLint(); dl.run(pw, args); pw.close(); String out = sw.toString(); if (!out.isEmpty()) System.err.println(out); return out; }
Example #18
Source File: PathsTest.java From hottub with GNU General Public License v2.0 | 5 votes |
String doclint(String... args) throws BadArgs, IOException { StringWriter sw = new StringWriter(); PrintWriter pw = new PrintWriter(sw); DocLint dl = new DocLint(); dl.run(pw, args); pw.close(); String out = sw.toString(); if (!out.isEmpty()) System.err.println(out); return out; }
Example #19
Source File: RunTest.java From hottub with GNU General Public License v2.0 | 5 votes |
void testMain(boolean expectOK, String... args) { try { DocLint.main(args); if (!expectOK) error("expected SecurityException (from System.exit) not thrown"); } catch (SecurityException e) { System.err.println(e); if (expectOK) error("unexpected SecurityException caught"); } }
Example #20
Source File: DocEnv.java From hottub with GNU General Public License v2.0 | 5 votes |
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 #21
Source File: DocLintTester.java From openjdk-jdk9 with GNU General Public License v2.0 | 5 votes |
void check(List<String> opts, List<File> files, boolean expectBadArgs, File refFile) throws Exception { List<String> args = new ArrayList<String>(); args.addAll(opts); for (File file: files) args.add(file.getPath()); StringWriter sw = new StringWriter(); PrintWriter pw = new PrintWriter(sw); try { new DocLint().run(pw, args.toArray(new String[args.size()])); if (expectBadArgs) error("expected exception not thrown"); } catch (BadArgs e) { if (!expectBadArgs) error("unexpected exception caught: " + e); } pw.flush(); String out = normalizeNewlines(removeFileNames(sw.toString())).trim(); if (out != null) System.err.println("Output:\n" + out); if (refFile == null) { if (!out.isEmpty()) error("unexpected output"); } else { String expect = readFile(refFile); if (!expect.equals(out)) { error("expected output not found"); System.err.println("EXPECT>>" + expect + "<<"); System.err.println(" FOUND>>" + out + "<<"); } } }
Example #22
Source File: PathsTest.java From openjdk-jdk9 with GNU General Public License v2.0 | 5 votes |
String doclint(String... args) throws BadArgs, IOException { StringWriter sw = new StringWriter(); PrintWriter pw = new PrintWriter(sw); DocLint dl = new DocLint(); dl.run(pw, args); pw.close(); String out = sw.toString(); if (!out.isEmpty()) System.err.println(out); return out; }
Example #23
Source File: RunTest.java From openjdk-jdk9 with GNU General Public License v2.0 | 5 votes |
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 #24
Source File: RunTest.java From openjdk-jdk9 with GNU General Public License v2.0 | 5 votes |
void testInit() { System.err.println("test init"); DocLint dl = new DocLint(); String name = dl.getName(); if (!Objects.equals(name, "doclint")) error("unexpected result for DocLint.getName()"); List<? extends JavaFileObject> files = Arrays.asList(createFile("Test.java", "/** &0; */ class Test{ }")); String[] goodArgs = { "-Xmsgs" }; testInit(true, goodArgs, files); String[] badArgs = { "-unknown" }; testInit(false, badArgs, files); }
Example #25
Source File: RunTest.java From openjdk-jdk9 with GNU General Public License v2.0 | 5 votes |
void testRun() throws BadArgs, IOException { System.err.println("test run(String[])"); DocLint dl = new DocLint(); String[] args = { "-help" }; ByteArrayOutputStream baos = new ByteArrayOutputStream(); PrintStream ps = new PrintStream(baos); PrintStream prev = System.out; try { System.setOut(ps); dl.run(args); } finally { System.setOut(prev); } ps.close(); String stdout = baos.toString(); StringWriter sw = new StringWriter(); PrintWriter pw = new PrintWriter(sw); dl.run(pw, args); pw.close(); String direct = sw.toString(); if (!stdout.equals(direct)) { error("unexpected output"); System.err.println("EXPECT>>" + direct + "<<"); System.err.println("FOUND>>" + stdout + "<<"); } }
Example #26
Source File: RunTest.java From openjdk-jdk9 with GNU General Public License v2.0 | 5 votes |
void testMain(boolean expectOK, String... args) { try { DocLint.main(args); if (!expectOK) error("expected SecurityException (from System.exit) not thrown"); } catch (SecurityException e) { System.err.println(e); if (expectOK) error("unexpected SecurityException caught"); } }
Example #27
Source File: DocEnv.java From openjdk-jdk9 with GNU General Public License v2.0 | 5 votes |
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 #28
Source File: WorkArounds.java From openjdk-jdk9 with GNU General Public License v2.0 | 5 votes |
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 #29
Source File: DocEnv.java From TencentKona-8 with GNU General Public License v2.0 | 5 votes |
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 #30
Source File: DocLintTester.java From openjdk-jdk8u-backup with GNU General Public License v2.0 | 5 votes |
void check(List<String> opts, List<File> files, boolean expectBadArgs, File refFile) throws Exception { List<String> args = new ArrayList<String>(); args.addAll(opts); for (File file: files) args.add(file.getPath()); StringWriter sw = new StringWriter(); PrintWriter pw = new PrintWriter(sw); try { new DocLint().run(pw, args.toArray(new String[args.size()])); if (expectBadArgs) error("expected exception not thrown"); } catch (BadArgs e) { if (!expectBadArgs) error("unexpected exception caught: " + e); } pw.flush(); String out = normalizeNewlines(removeFileNames(sw.toString())).trim(); if (out != null) System.err.println("Output:\n" + out); if (refFile == null) { if (!out.isEmpty()) error("unexpected output"); } else { String expect = readFile(refFile); if (!expect.equals(out)) { error("expected output not found"); System.err.println("EXPECT>>" + expect + "<<"); System.err.println(" FOUND>>" + out + "<<"); } } }