⭐ 欢迎来到虫虫下载站! | 📦 资源下载 📁 资源专辑 ℹ️ 关于我们
⭐ 虫虫下载站

📄 log.java

📁 GJC(Generic Java Compiler)编译器
💻 JAVA
📖 第 1 页 / 共 2 页
字号:
            printLines(errWriter, getLocalizedString("source.unavailable"));        }        finally { errWriter.flush();                } }    /**      * Print the text of a message, translating newlines approprately      *  for the platform.      */    public static void printLines(PrintWriter writer, String msg) {        int nl;        while ((nl = msg.indexOf('\n')) != -1) {            writer.println(msg.substring(0, nl));            msg = msg.substring(nl + 1);        }        if (msg.length() != 0)            writer.println(msg);    }    /**      * Print an error or warning message.      *  @param pos    The source position at which to report the message.      *  @param msg    The message to report.      */    private void printError(int pos, String msg, PrintWriter writer) {        if (pos == Position.NOPOS) {            writer.print( getText("compiler.err.error", null, null, null, null, null,                    null, null));            printLines(writer, msg);        } else {            int line = Position.line(pos);            int col = Position.column(pos);            printLines(writer, sourcename + ":" + line + ": " + msg);            printErrLine(line, col, writer);        }        writer.flush();    }    /**      * Report an error, unless another error was already reported at same      *  source position.      *  @param pos    The source position at which to report the error.      *  @param key    The error message to report.      */    public void error(int pos, String key) {        error(pos, key, null, null, null, null, null, null, null);    }    public void error(int pos, String key, String arg0) {        error(pos, key, arg0, null, null, null, null, null, null);    }    public void error(int pos, String key, String arg0, String arg1) {        error(pos, key, arg0, arg1, null, null, null, null, null);    }    public void error(int pos, String key, String arg0, String arg1, String arg2) {        error(pos, key, arg0, arg1, arg2, null, null, null, null);    }    public void error(int pos, String key, String arg0, String arg1, String arg2,            String arg3) {        error(pos, key, arg0, arg1, arg2, arg3, null, null, null);    }    public void error(int pos, String key, String arg0, String arg1, String arg2,            String arg3, String arg4) {        error(pos, key, arg0, arg1, arg2, arg3, arg4, null, null);    }    public void error(int pos, String key, String arg0, String arg1, String arg2,            String arg3, String arg4, String arg5) {        error(pos, key, arg0, arg1, arg2, arg3, arg4, arg5, null);    }    public void error(int pos, String key, String arg0, String arg1, String arg2,            String arg3, String arg4, String arg5, String arg6) {        if (nerrors < MaxErrors) {            Pair coords = new Pair(sourcename, new Integer(pos));            if (!recorded.contains(coords)) {                recorded.put(coords);                String msg = getText("compiler.err." + key, arg0, arg1, arg2, arg3,                        arg4, arg5, arg6);                printError(pos, msg, errWriter);                prompt();                nerrors++;            }        }    }    /**      * Report a warning.      *  @param pos    The source position at which to report the warning.      *  @param key    The key for the localized warning message.      */    public void warning(int pos, String key) {        warning(pos, key, null, null, null, null);    }    public void warning(int pos, String key, String arg0) {        warning(pos, key, arg0, null, null, null);    }    public void warning(int pos, String key, String arg0, String arg1) {        warning(pos, key, arg0, arg1, null, null);    }    public void warning(int pos, String key, String arg0, String arg1, String arg2) {        warning(pos, key, arg0, arg1, arg2, null);    }    public void warning(int pos, String key, String arg0, String arg1,            String arg2, String arg3) {        if (nwarnings < MaxWarnings && emitWarnings) {            String msg = getText("compiler.warn." + key, arg0, arg1, arg2, arg3,                    null, null, null);            printError(pos,                    getText("compiler.warn.warning", null, null, null, null,                    null, null, null) + msg, warnWriter);        }        nwarnings++;    }    /**      * Provide a non-fatal notification.      *  @param key     The notification to send to System.err.      */    public void note(String key) {        note(key, null);    }    public void note(String key, String arg0) {        if (emitWarnings) {            noticeWriter.print(                    getText("compiler.note.note", null, null, null, null, null,                    null, null));            String msg = getText("compiler.note." + key, arg0, null, null, null,                    null, null, null);            printLines(noticeWriter, msg);            noticeWriter.flush();        }    }    /**      * Find a localized string in the resource bundle.      *  @param key     The key for the localized string.      */    public static String getLocalizedString(String key) {        return getText("compiler.misc." + key, null, null, null, null, null,                null, null);    }    public static String getLocalizedString(String key, String arg0) {        return getText("compiler.misc." + key, arg0, null, null, null, null,                null, null);    }    public static String getLocalizedString(String key, String arg0, String arg1) {        return getText("compiler.misc." + key, arg0, arg1, null, null, null,                null, null);    }    public static String getLocalizedString(String key, String arg0, String arg1,            String arg2) {        return getText("compiler.misc." + key, arg0, arg1, arg2, null, null,                null, null);    }    public static String getLocalizedString(String key, String arg0, String arg1,            String arg2, String arg3) {        return getText("compiler.misc." + key, arg0, arg1, arg2, arg3, null,                null, null);    }    private static final String compilerRB = "com.sun.tools.javac.v8.resources.compiler";    private static ResourceBundle messageRB;    /**     * Initialize ResourceBundle.     */    private static void initResource() {        try {            messageRB = ResourceBundle.getBundle(compilerRB);        } catch (MissingResourceException e) {            throw new Error("Fatal: Resource for compiler is missing");        }    }    /**      * Get and format message string from resource.      */    public static String getText(String key, String arg0, String arg1,            String arg2, String arg3, String arg4, String arg5, String arg6) {        if (messageRB == null)            initResource();        try {            String[] args = {arg0, arg1, arg2, arg3, arg4, arg5, arg6};            return MessageFormat.format(messageRB.getString(key), args);        } catch (MissingResourceException e) {            if (arg0 == null)                arg0 = "null";            if (arg1 == null)                arg1 = "null";            if (arg2 == null)                arg2 = "null";            if (arg3 == null)                arg3 = "null";            if (arg4 == null)                arg4 = "null";            if (arg5 == null)                arg5 = "null";            if (arg6 == null)                arg6 = "null";            String[] args = {key, arg0, arg1, arg2, arg3, arg4, arg5, arg6};            String msg = "compiler message file broken: key={0} arguments={1}, {2}, {3}, {4}, {5}, {6}, {7}";            return MessageFormat.format(msg, args);        }    }    /**      * print an error or warning message:      */    private void printRawError(int pos, String msg) {        if (pos == Position.NOPOS) {            printLines(errWriter, "error: " + msg);        } else {            int line = Position.line(pos);            int col = Position.column(pos);            printLines(errWriter, sourcename + ":" + line + ": " + msg);            printErrLine(line, col, errWriter);        }        errWriter.flush();    }    /**      * report an error:      */    public void rawError(int pos, String msg) {        if (nerrors < MaxErrors) {            Pair coords = new Pair(sourcename, new Integer(pos));            if (!recorded.contains(coords)) {                recorded.put(coords);                printRawError(pos, msg);                prompt();                nerrors++;            }        }        errWriter.flush();    }    /**      * report a warning:      */    public void rawWarning(int pos, String msg) {        if (nwarnings < MaxWarnings && emitWarnings) {            printRawError(pos, "warning: " + msg);        }        nwarnings++;        errWriter.flush();    }}

⌨️ 快捷键说明

复制代码 Ctrl + C
搜索代码 Ctrl + F
全屏模式 F11
切换主题 Ctrl + Shift + D
显示快捷键 ?
增大字号 Ctrl + =
减小字号 Ctrl + -