com.sun.tools.javac.util.Log.WriterKind Java Examples
The following examples show how to use
com.sun.tools.javac.util.Log.WriterKind.
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: Start.java From openjdk-jdk9 with GNU General Public License v2.0 | 6 votes |
/** * Main program - external wrapper. In order to maintain backward * CLI compatibility, we dispatch to the old tool or the old doclet's * Start mechanism, based on the options present on the command line * with the following precedence: * 1. presence of -Xold, dispatch to old tool * 2. doclet variant, if old, dispatch to old Start * 3. taglet variant, if old, dispatch to old Start * * Thus the presence of -Xold switches the tool, soon after command files * if any, are expanded, this is performed here, noting that the messager * is available at this point in time. * The doclet/taglet tests are performed in the begin method, further on, * this is to minimize argument processing and most importantly the impact * of class loader creation, needed to detect the doclet/taglet class variants. */ @SuppressWarnings("deprecation") Result begin(String... argv) { // Preprocess @file arguments try { argv = CommandLine.parse(argv); } catch (IOException e) { error("main.cant.read", e.getMessage()); return ERROR; } if (argv.length > 0 && "-Xold".equals(argv[0])) { warn("main.legacy_api"); String[] nargv = Arrays.copyOfRange(argv, 1, argv.length); int rc = com.sun.tools.javadoc.Main.execute( messager.programName, messager.getWriter(WriterKind.ERROR), messager.getWriter(WriterKind.WARNING), messager.getWriter(WriterKind.NOTICE), OldStdDocletName, nargv); return (rc == 0) ? OK : ERROR; } return begin(Arrays.asList(argv), Collections.emptySet()); }
Example #2
Source File: Main.java From openjdk-8 with GNU General Public License v2.0 | 5 votes |
/** Print a message reporting a fatal error. */ void feMessage(Throwable ex) { log.printRawLines(ex.getMessage()); if (ex.getCause() != null && options.isSet("dev")) { ex.getCause().printStackTrace(log.getWriter(WriterKind.NOTICE)); } }
Example #3
Source File: Main.java From jdk8u60 with GNU General Public License v2.0 | 5 votes |
/** Display the location and checksum of a class. */ void showClass(String className) { PrintWriter pw = log.getWriter(WriterKind.NOTICE); pw.println("javac: show class: " + className); URL url = getClass().getResource('/' + className.replace('.', '/') + ".class"); if (url == null) pw.println(" class not found"); else { pw.println(" " + url); try { final String algorithm = "MD5"; byte[] digest; MessageDigest md = MessageDigest.getInstance(algorithm); DigestInputStream in = new DigestInputStream(url.openStream(), md); try { byte[] buf = new byte[8192]; int n; do { n = in.read(buf); } while (n > 0); digest = md.digest(); } finally { in.close(); } StringBuilder sb = new StringBuilder(); for (byte b: digest) sb.append(String.format("%02x", b)); pw.println(" " + algorithm + " checksum: " + sb); } catch (Exception e) { pw.println(" cannot compute digest: " + e); } } }
Example #4
Source File: Main.java From jdk8u60 with GNU General Public License v2.0 | 5 votes |
/** Print a message reporting a fatal error. */ void feMessage(Throwable ex) { log.printRawLines(ex.getMessage()); if (ex.getCause() != null && options.isSet("dev")) { ex.getCause().printStackTrace(log.getWriter(WriterKind.NOTICE)); } }
Example #5
Source File: Main.java From openjdk-jdk8u with GNU General Public License v2.0 | 5 votes |
/** Print a message reporting a fatal error. */ void feMessage(Throwable ex) { log.printRawLines(ex.getMessage()); if (ex.getCause() != null && options.isSet("dev")) { ex.getCause().printStackTrace(log.getWriter(WriterKind.NOTICE)); } }
Example #6
Source File: JavaCompiler.java From jdk8u60 with GNU General Public License v2.0 | 5 votes |
/** Print numbers of errors and warnings. */ public void printCount(String kind, int count) { if (count != 0) { String key; if (count == 1) key = "count." + kind; else key = "count." + kind + ".plural"; log.printLines(WriterKind.ERROR, key, String.valueOf(count)); log.flush(Log.WriterKind.ERROR); } }
Example #7
Source File: Main.java From TencentKona-8 with GNU General Public License v2.0 | 5 votes |
/** Display the location and checksum of a class. */ void showClass(String className) { PrintWriter pw = log.getWriter(WriterKind.NOTICE); pw.println("javac: show class: " + className); URL url = getClass().getResource('/' + className.replace('.', '/') + ".class"); if (url == null) pw.println(" class not found"); else { pw.println(" " + url); try { final String algorithm = "MD5"; byte[] digest; MessageDigest md = MessageDigest.getInstance(algorithm); DigestInputStream in = new DigestInputStream(url.openStream(), md); try { byte[] buf = new byte[8192]; int n; do { n = in.read(buf); } while (n > 0); digest = md.digest(); } finally { in.close(); } StringBuilder sb = new StringBuilder(); for (byte b: digest) sb.append(String.format("%02x", b)); pw.println(" " + algorithm + " checksum: " + sb); } catch (Exception e) { pw.println(" cannot compute digest: " + e); } } }
Example #8
Source File: JavaCompiler.java From TencentKona-8 with GNU General Public License v2.0 | 5 votes |
/** Print numbers of errors and warnings. */ public void printCount(String kind, int count) { if (count != 0) { String key; if (count == 1) key = "count." + kind; else key = "count." + kind + ".plural"; log.printLines(WriterKind.ERROR, key, String.valueOf(count)); log.flush(Log.WriterKind.ERROR); } }
Example #9
Source File: Main.java From openjdk-jdk8u with GNU General Public License v2.0 | 5 votes |
/** Display the location and checksum of a class. */ void showClass(String className) { PrintWriter pw = log.getWriter(WriterKind.NOTICE); pw.println("javac: show class: " + className); URL url = getClass().getResource('/' + className.replace('.', '/') + ".class"); if (url == null) pw.println(" class not found"); else { pw.println(" " + url); try { final String algorithm = "MD5"; byte[] digest; MessageDigest md = MessageDigest.getInstance(algorithm); DigestInputStream in = new DigestInputStream(url.openStream(), md); try { byte[] buf = new byte[8192]; int n; do { n = in.read(buf); } while (n > 0); digest = md.digest(); } finally { in.close(); } StringBuilder sb = new StringBuilder(); for (byte b: digest) sb.append(String.format("%02x", b)); pw.println(" " + algorithm + " checksum: " + sb); } catch (Exception e) { pw.println(" cannot compute digest: " + e); } } }
Example #10
Source File: JavaCompiler.java From openjdk-jdk8u with GNU General Public License v2.0 | 5 votes |
/** Print numbers of errors and warnings. */ public void printCount(String kind, int count) { if (count != 0) { String key; if (count == 1) key = "count." + kind; else key = "count." + kind + ".plural"; log.printLines(WriterKind.ERROR, key, String.valueOf(count)); log.flush(Log.WriterKind.ERROR); } }
Example #11
Source File: Main.java From lua-for-android with BSD 3-Clause "New" or "Revised" License | 5 votes |
/** Print a message reporting a fatal error. */ void feMessage(Throwable ex, Options options) { log.printRawLines(ex.getMessage()); if (ex.getCause() != null && options.isSet("dev")) { ex.getCause().printStackTrace(log.getWriter(WriterKind.NOTICE)); } }
Example #12
Source File: Main.java From openjdk-8 with GNU General Public License v2.0 | 5 votes |
/** Display the location and checksum of a class. */ void showClass(String className) { PrintWriter pw = log.getWriter(WriterKind.NOTICE); pw.println("javac: show class: " + className); URL url = getClass().getResource('/' + className.replace('.', '/') + ".class"); if (url == null) pw.println(" class not found"); else { pw.println(" " + url); try { final String algorithm = "MD5"; byte[] digest; MessageDigest md = MessageDigest.getInstance(algorithm); DigestInputStream in = new DigestInputStream(url.openStream(), md); try { byte[] buf = new byte[8192]; int n; do { n = in.read(buf); } while (n > 0); digest = md.digest(); } finally { in.close(); } StringBuilder sb = new StringBuilder(); for (byte b: digest) sb.append(String.format("%02x", b)); pw.println(" " + algorithm + " checksum: " + sb); } catch (Exception e) { pw.println(" cannot compute digest: " + e); } } }
Example #13
Source File: Main.java From lua-for-android with BSD 3-Clause "New" or "Revised" License | 5 votes |
/** Display the location and checksum of a class. */ void showClass(String className) { PrintWriter pw = log.getWriter(WriterKind.NOTICE); pw.println("javac: show class: " + className); URL url = getClass().getResource('/' + className.replace('.', '/') + ".class"); if (url != null) { pw.println(" " + url); } try (InputStream in = getClass().getResourceAsStream('/' + className.replace('.', '/') + ".class")) { final String algorithm = "MD5"; byte[] digest; MessageDigest md = MessageDigest.getInstance(algorithm); try (DigestInputStream din = new DigestInputStream(in, md)) { byte[] buf = new byte[8192]; int n; do { n = din.read(buf); } while (n > 0); digest = md.digest(); } StringBuilder sb = new StringBuilder(); for (byte b: digest) sb.append(String.format("%02x", b)); pw.println(" " + algorithm + " checksum: " + sb); } catch (NoSuchAlgorithmException | IOException e) { pw.println(" cannot compute digest: " + e); } }
Example #14
Source File: Option.java From lua-for-android with BSD 3-Clause "New" or "Revised" License | 5 votes |
protected void help(Log log, String descr) { String synopses = StreamSupport.stream(Arrays.asList(names)) .map(s -> helpSynopsis(s, log)) .collect(Collectors.joining(", ")); // If option synopses and description fit on a single line of reasonable length, // display using COMPACT_FORMAT if (synopses.length() < DEFAULT_SYNOPSIS_WIDTH && !descr.contains("\n") && (SMALL_INDENT.length() + DEFAULT_SYNOPSIS_WIDTH + 1 + descr.length() <= DEFAULT_MAX_LINE_LENGTH)) { log.printRawLines(WriterKind.STDOUT, String.format(COMPACT_FORMAT, synopses, descr)); return; } // If option synopses fit on a single line of reasonable length, show that; // otherwise, show 1 per line if (synopses.length() <= DEFAULT_MAX_LINE_LENGTH) { log.printRawLines(WriterKind.STDOUT, SMALL_INDENT + synopses); } else { for (String name: names) { log.printRawLines(WriterKind.STDOUT, SMALL_INDENT + helpSynopsis(name, log)); } } // Finally, show the description log.printRawLines(WriterKind.STDOUT, LARGE_INDENT + descr.replace("\n", "\n" + LARGE_INDENT)); }
Example #15
Source File: JavaCompiler.java From lua-for-android with BSD 3-Clause "New" or "Revised" License | 5 votes |
/** Print numbers of errors and warnings. */ public void printCount(String kind, int count) { if (count != 0) { String key; if (count == 1) key = "count." + kind; else key = "count." + kind + ".plural"; log.printLines(WriterKind.ERROR, key, String.valueOf(count)); log.flush(Log.WriterKind.ERROR); } }
Example #16
Source File: Main.java From openjdk-jdk8u-backup with GNU General Public License v2.0 | 5 votes |
/** Print a message reporting a fatal error. */ void feMessage(Throwable ex) { log.printRawLines(ex.getMessage()); if (ex.getCause() != null && options.isSet("dev")) { ex.getCause().printStackTrace(log.getWriter(WriterKind.NOTICE)); } }
Example #17
Source File: Main.java From openjdk-jdk8u-backup with GNU General Public License v2.0 | 5 votes |
/** Display the location and checksum of a class. */ void showClass(String className) { PrintWriter pw = log.getWriter(WriterKind.NOTICE); pw.println("javac: show class: " + className); URL url = getClass().getResource('/' + className.replace('.', '/') + ".class"); if (url == null) pw.println(" class not found"); else { pw.println(" " + url); try { final String algorithm = "MD5"; byte[] digest; MessageDigest md = MessageDigest.getInstance(algorithm); DigestInputStream in = new DigestInputStream(url.openStream(), md); try { byte[] buf = new byte[8192]; int n; do { n = in.read(buf); } while (n > 0); digest = md.digest(); } finally { in.close(); } StringBuilder sb = new StringBuilder(); for (byte b: digest) sb.append(String.format("%02x", b)); pw.println(" " + algorithm + " checksum: " + sb); } catch (Exception e) { pw.println(" cannot compute digest: " + e); } } }
Example #18
Source File: JavaCompiler.java From openjdk-jdk8u-backup with GNU General Public License v2.0 | 5 votes |
/** Print numbers of errors and warnings. */ public void printCount(String kind, int count) { if (count != 0) { String key; if (count == 1) key = "count." + kind; else key = "count." + kind + ".plural"; log.printLines(WriterKind.ERROR, key, String.valueOf(count)); log.flush(Log.WriterKind.ERROR); } }
Example #19
Source File: Main.java From openjdk-jdk9 with GNU General Public License v2.0 | 5 votes |
/** Print a message reporting a fatal error. */ void feMessage(Throwable ex, Options options) { log.printRawLines(ex.getMessage()); if (ex.getCause() != null && options.isSet("dev")) { ex.getCause().printStackTrace(log.getWriter(WriterKind.NOTICE)); } }
Example #20
Source File: Main.java From openjdk-jdk9 with GNU General Public License v2.0 | 5 votes |
/** Display the location and checksum of a class. */ void showClass(String className) { PrintWriter pw = log.getWriter(WriterKind.NOTICE); pw.println("javac: show class: " + className); URL url = getClass().getResource('/' + className.replace('.', '/') + ".class"); if (url != null) { pw.println(" " + url); } try (InputStream in = getClass().getResourceAsStream('/' + className.replace('.', '/') + ".class")) { final String algorithm = "MD5"; byte[] digest; MessageDigest md = MessageDigest.getInstance(algorithm); try (DigestInputStream din = new DigestInputStream(in, md)) { byte[] buf = new byte[8192]; int n; do { n = din.read(buf); } while (n > 0); digest = md.digest(); } StringBuilder sb = new StringBuilder(); for (byte b: digest) sb.append(String.format("%02x", b)); pw.println(" " + algorithm + " checksum: " + sb); } catch (NoSuchAlgorithmException | IOException e) { pw.println(" cannot compute digest: " + e); } }
Example #21
Source File: Option.java From openjdk-jdk9 with GNU General Public License v2.0 | 5 votes |
protected void help(Log log, String descr) { String synopses = Arrays.stream(names) .map(s -> helpSynopsis(s, log)) .collect(Collectors.joining(", ")); // If option synopses and description fit on a single line of reasonable length, // display using COMPACT_FORMAT if (synopses.length() < DEFAULT_SYNOPSIS_WIDTH && !descr.contains("\n") && (SMALL_INDENT.length() + DEFAULT_SYNOPSIS_WIDTH + 1 + descr.length() <= DEFAULT_MAX_LINE_LENGTH)) { log.printRawLines(WriterKind.STDOUT, String.format(COMPACT_FORMAT, synopses, descr)); return; } // If option synopses fit on a single line of reasonable length, show that; // otherwise, show 1 per line if (synopses.length() <= DEFAULT_MAX_LINE_LENGTH) { log.printRawLines(WriterKind.STDOUT, SMALL_INDENT + synopses); } else { for (String name: names) { log.printRawLines(WriterKind.STDOUT, SMALL_INDENT + helpSynopsis(name, log)); } } // Finally, show the description log.printRawLines(WriterKind.STDOUT, LARGE_INDENT + descr.replace("\n", "\n" + LARGE_INDENT)); }
Example #22
Source File: JavaCompiler.java From openjdk-jdk9 with GNU General Public License v2.0 | 5 votes |
/** Print numbers of errors and warnings. */ public void printCount(String kind, int count) { if (count != 0) { String key; if (count == 1) key = "count." + kind; else key = "count." + kind + ".plural"; log.printLines(WriterKind.ERROR, key, String.valueOf(count)); log.flush(Log.WriterKind.ERROR); } }
Example #23
Source File: Main.java From hottub with GNU General Public License v2.0 | 5 votes |
/** Print a message reporting a fatal error. */ void feMessage(Throwable ex) { log.printRawLines(ex.getMessage()); if (ex.getCause() != null && options.isSet("dev")) { ex.getCause().printStackTrace(log.getWriter(WriterKind.NOTICE)); } }
Example #24
Source File: Main.java From hottub with GNU General Public License v2.0 | 5 votes |
/** Display the location and checksum of a class. */ void showClass(String className) { PrintWriter pw = log.getWriter(WriterKind.NOTICE); pw.println("javac: show class: " + className); URL url = getClass().getResource('/' + className.replace('.', '/') + ".class"); if (url == null) pw.println(" class not found"); else { pw.println(" " + url); try { final String algorithm = "MD5"; byte[] digest; MessageDigest md = MessageDigest.getInstance(algorithm); DigestInputStream in = new DigestInputStream(url.openStream(), md); try { byte[] buf = new byte[8192]; int n; do { n = in.read(buf); } while (n > 0); digest = md.digest(); } finally { in.close(); } StringBuilder sb = new StringBuilder(); for (byte b: digest) sb.append(String.format("%02x", b)); pw.println(" " + algorithm + " checksum: " + sb); } catch (Exception e) { pw.println(" cannot compute digest: " + e); } } }
Example #25
Source File: JavaCompiler.java From hottub with GNU General Public License v2.0 | 5 votes |
/** Print numbers of errors and warnings. */ public void printCount(String kind, int count) { if (count != 0) { String key; if (count == 1) key = "count." + kind; else key = "count." + kind + ".plural"; log.printLines(WriterKind.ERROR, key, String.valueOf(count)); log.flush(Log.WriterKind.ERROR); } }
Example #26
Source File: Main.java From openjdk-8-source with GNU General Public License v2.0 | 5 votes |
/** Print a message reporting a fatal error. */ void feMessage(Throwable ex) { log.printRawLines(ex.getMessage()); if (ex.getCause() != null && options.isSet("dev")) { ex.getCause().printStackTrace(log.getWriter(WriterKind.NOTICE)); } }
Example #27
Source File: JavaCompiler.java From openjdk-8-source with GNU General Public License v2.0 | 5 votes |
/** Print numbers of errors and warnings. */ public void printCount(String kind, int count) { if (count != 0) { String key; if (count == 1) key = "count." + kind; else key = "count." + kind + ".plural"; log.printLines(WriterKind.ERROR, key, String.valueOf(count)); log.flush(Log.WriterKind.ERROR); } }
Example #28
Source File: Main.java From TencentKona-8 with GNU General Public License v2.0 | 5 votes |
/** Print a message reporting a fatal error. */ void feMessage(Throwable ex) { log.printRawLines(ex.getMessage()); if (ex.getCause() != null && options.isSet("dev")) { ex.getCause().printStackTrace(log.getWriter(WriterKind.NOTICE)); } }
Example #29
Source File: Main.java From hottub with GNU General Public License v2.0 | 4 votes |
/** Print a message reporting an input/output error. */ void ioMessage(Throwable ex) { log.printLines(PrefixKind.JAVAC, "msg.io"); ex.printStackTrace(log.getWriter(WriterKind.NOTICE)); }
Example #30
Source File: Main.java From hottub with GNU General Public License v2.0 | 4 votes |
/** Print a message reporting an uncaught exception from an * annotation processor. */ void pluginMessage(Throwable ex) { log.printLines(PrefixKind.JAVAC, "msg.plugin.uncaught.exception"); ex.printStackTrace(log.getWriter(WriterKind.NOTICE)); }