com.sun.tools.javac.util.BasicDiagnosticFormatter.BasicConfiguration Java Examples

The following examples show how to use com.sun.tools.javac.util.BasicDiagnosticFormatter.BasicConfiguration. 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: BasicDiagnosticFormatter.java    From openjdk-jdk8u-backup with GNU General Public License v2.0 5 votes vote down vote up
protected String addSourceLineIfNeeded(JCDiagnostic d, String msg) {
    if (!displaySource(d))
        return msg;
    else {
        BasicConfiguration conf = getConfiguration();
        int indentSource = conf.getIndentation(DiagnosticPart.SOURCE);
        String sourceLine = "\n" + formatSourceLine(d, indentSource);
        boolean singleLine = msg.indexOf("\n") == -1;
        if (singleLine || getConfiguration().getSourcePosition() == SourcePosition.BOTTOM)
            return msg + sourceLine;
        else
            return msg.replaceFirst("\n", Matcher.quoteReplacement(sourceLine) + "\n");
    }
}
 
Example #2
Source File: BasicDiagnosticFormatter.java    From TencentKona-8 with GNU General Public License v2.0 5 votes vote down vote up
public BasicConfiguration() {
    super(EnumSet.of(DiagnosticPart.SUMMARY,
          DiagnosticPart.DETAILS,
          DiagnosticPart.SUBDIAGNOSTICS,
          DiagnosticPart.SOURCE));
    initFormat();
    initIndentation();
}
 
Example #3
Source File: BasicDiagnosticFormatter.java    From openjdk-8 with GNU General Public License v2.0 5 votes vote down vote up
protected String addSourceLineIfNeeded(JCDiagnostic d, String msg) {
    if (!displaySource(d))
        return msg;
    else {
        BasicConfiguration conf = getConfiguration();
        int indentSource = conf.getIndentation(DiagnosticPart.SOURCE);
        String sourceLine = "\n" + formatSourceLine(d, indentSource);
        boolean singleLine = msg.indexOf("\n") == -1;
        if (singleLine || getConfiguration().getSourcePosition() == SourcePosition.BOTTOM)
            return msg + sourceLine;
        else
            return msg.replaceFirst("\n", Matcher.quoteReplacement(sourceLine) + "\n");
    }
}
 
Example #4
Source File: BasicDiagnosticFormatter.java    From openjdk-8-source with GNU General Public License v2.0 5 votes vote down vote up
public BasicConfiguration() {
    super(EnumSet.of(DiagnosticPart.SUMMARY,
          DiagnosticPart.DETAILS,
          DiagnosticPart.SUBDIAGNOSTICS,
          DiagnosticPart.SOURCE));
    initFormat();
    initIndentation();
}
 
Example #5
Source File: BasicDiagnosticFormatter.java    From jdk8u60 with GNU General Public License v2.0 5 votes vote down vote up
protected String addSourceLineIfNeeded(JCDiagnostic d, String msg) {
    if (!displaySource(d))
        return msg;
    else {
        BasicConfiguration conf = getConfiguration();
        int indentSource = conf.getIndentation(DiagnosticPart.SOURCE);
        String sourceLine = "\n" + formatSourceLine(d, indentSource);
        boolean singleLine = msg.indexOf("\n") == -1;
        if (singleLine || getConfiguration().getSourcePosition() == SourcePosition.BOTTOM)
            return msg + sourceLine;
        else
            return msg.replaceFirst("\n", Matcher.quoteReplacement(sourceLine) + "\n");
    }
}
 
Example #6
Source File: BasicDiagnosticFormatter.java    From TencentKona-8 with GNU General Public License v2.0 5 votes vote down vote up
protected String addSourceLineIfNeeded(JCDiagnostic d, String msg) {
    if (!displaySource(d))
        return msg;
    else {
        BasicConfiguration conf = getConfiguration();
        int indentSource = conf.getIndentation(DiagnosticPart.SOURCE);
        String sourceLine = "\n" + formatSourceLine(d, indentSource);
        boolean singleLine = msg.indexOf("\n") == -1;
        if (singleLine || getConfiguration().getSourcePosition() == SourcePosition.BOTTOM)
            return msg + sourceLine;
        else
            return msg.replaceFirst("\n", Matcher.quoteReplacement(sourceLine) + "\n");
    }
}
 
Example #7
Source File: BasicDiagnosticFormatter.java    From jdk8u60 with GNU General Public License v2.0 5 votes vote down vote up
public BasicConfiguration() {
    super(EnumSet.of(DiagnosticPart.SUMMARY,
          DiagnosticPart.DETAILS,
          DiagnosticPart.SUBDIAGNOSTICS,
          DiagnosticPart.SOURCE));
    initFormat();
    initIndentation();
}
 
Example #8
Source File: BasicDiagnosticFormatter.java    From openjdk-8-source with GNU General Public License v2.0 5 votes vote down vote up
protected String addSourceLineIfNeeded(JCDiagnostic d, String msg) {
    if (!displaySource(d))
        return msg;
    else {
        BasicConfiguration conf = getConfiguration();
        int indentSource = conf.getIndentation(DiagnosticPart.SOURCE);
        String sourceLine = "\n" + formatSourceLine(d, indentSource);
        boolean singleLine = msg.indexOf("\n") == -1;
        if (singleLine || getConfiguration().getSourcePosition() == SourcePosition.BOTTOM)
            return msg + sourceLine;
        else
            return msg.replaceFirst("\n", Matcher.quoteReplacement(sourceLine) + "\n");
    }
}
 
Example #9
Source File: BasicDiagnosticFormatter.java    From hottub with GNU General Public License v2.0 5 votes vote down vote up
public BasicConfiguration() {
    super(EnumSet.of(DiagnosticPart.SUMMARY,
          DiagnosticPart.DETAILS,
          DiagnosticPart.SUBDIAGNOSTICS,
          DiagnosticPart.SOURCE));
    initFormat();
    initIndentation();
}
 
Example #10
Source File: BasicDiagnosticFormatter.java    From java-n-IDE-for-Android with Apache License 2.0 5 votes vote down vote up
protected String addSourceLineIfNeeded(JCDiagnostic d, String msg) {
    if (!displaySource(d))
        return msg;
    else {
        BasicConfiguration conf = getConfiguration();
        int indentSource = conf.getIndentation(DiagnosticPart.SOURCE);
        String sourceLine = "\n" + formatSourceLine(d, indentSource);
        boolean singleLine = msg.indexOf("\n") == -1;
        if (singleLine || getConfiguration().getSourcePosition() == SourcePosition.BOTTOM)
            return msg + sourceLine;
        else
            return msg.replaceFirst("\n", Matcher.quoteReplacement(sourceLine) + "\n");
    }
}
 
Example #11
Source File: BasicDiagnosticFormatter.java    From java-n-IDE-for-Android with Apache License 2.0 5 votes vote down vote up
public BasicConfiguration() {
    super(EnumSet.of(DiagnosticPart.SUMMARY,
          DiagnosticPart.DETAILS,
          DiagnosticPart.SUBDIAGNOSTICS,
          DiagnosticPart.SOURCE));
    initFormat();
    initIndentation();
}
 
Example #12
Source File: BasicDiagnosticFormatter.java    From openjdk-jdk9 with GNU General Public License v2.0 5 votes vote down vote up
public BasicConfiguration() {
    super(EnumSet.of(DiagnosticPart.SUMMARY,
          DiagnosticPart.DETAILS,
          DiagnosticPart.SUBDIAGNOSTICS,
          DiagnosticPart.SOURCE));
    initFormat();
    initIndentation();
}
 
Example #13
Source File: BasicDiagnosticFormatter.java    From openjdk-jdk8u with GNU General Public License v2.0 5 votes vote down vote up
protected String addSourceLineIfNeeded(JCDiagnostic d, String msg) {
    if (!displaySource(d))
        return msg;
    else {
        BasicConfiguration conf = getConfiguration();
        int indentSource = conf.getIndentation(DiagnosticPart.SOURCE);
        String sourceLine = "\n" + formatSourceLine(d, indentSource);
        boolean singleLine = msg.indexOf("\n") == -1;
        if (singleLine || getConfiguration().getSourcePosition() == SourcePosition.BOTTOM)
            return msg + sourceLine;
        else
            return msg.replaceFirst("\n", Matcher.quoteReplacement(sourceLine) + "\n");
    }
}
 
Example #14
Source File: BasicDiagnosticFormatter.java    From hottub with GNU General Public License v2.0 5 votes vote down vote up
protected String addSourceLineIfNeeded(JCDiagnostic d, String msg) {
    if (!displaySource(d))
        return msg;
    else {
        BasicConfiguration conf = getConfiguration();
        int indentSource = conf.getIndentation(DiagnosticPart.SOURCE);
        String sourceLine = "\n" + formatSourceLine(d, indentSource);
        boolean singleLine = msg.indexOf("\n") == -1;
        if (singleLine || getConfiguration().getSourcePosition() == SourcePosition.BOTTOM)
            return msg + sourceLine;
        else
            return msg.replaceFirst("\n", Matcher.quoteReplacement(sourceLine) + "\n");
    }
}
 
Example #15
Source File: BasicDiagnosticFormatter.java    From openjdk-jdk8u with GNU General Public License v2.0 5 votes vote down vote up
public BasicConfiguration() {
    super(EnumSet.of(DiagnosticPart.SUMMARY,
          DiagnosticPart.DETAILS,
          DiagnosticPart.SUBDIAGNOSTICS,
          DiagnosticPart.SOURCE));
    initFormat();
    initIndentation();
}
 
Example #16
Source File: BasicDiagnosticFormatter.java    From openjdk-jdk9 with GNU General Public License v2.0 5 votes vote down vote up
protected String addSourceLineIfNeeded(JCDiagnostic d, String msg) {
    if (!displaySource(d))
        return msg;
    else {
        BasicConfiguration conf = getConfiguration();
        int indentSource = conf.getIndentation(DiagnosticPart.SOURCE);
        String sourceLine = "\n" + formatSourceLine(d, indentSource);
        boolean singleLine = !msg.contains("\n");
        if (singleLine || getConfiguration().getSourcePosition() == SourcePosition.BOTTOM)
            return msg + sourceLine;
        else
            return msg.replaceFirst("\n", Matcher.quoteReplacement(sourceLine) + "\n");
    }
}
 
Example #17
Source File: BasicDiagnosticFormatter.java    From javaide with GNU General Public License v3.0 5 votes vote down vote up
public BasicConfiguration() {
    super(EnumSet.of(DiagnosticPart.SUMMARY,
          DiagnosticPart.DETAILS,
          DiagnosticPart.SUBDIAGNOSTICS,
          DiagnosticPart.SOURCE));
    initFormat();
    initIndentation();
}
 
Example #18
Source File: BasicDiagnosticFormatter.java    From lua-for-android with BSD 3-Clause "New" or "Revised" License 5 votes vote down vote up
protected String addSourceLineIfNeeded(JCDiagnostic d, String msg) {
    if (!displaySource(d))
        return msg;
    else {
        BasicConfiguration conf = getConfiguration();
        int indentSource = conf.getIndentation(DiagnosticPart.SOURCE);
        String sourceLine = "\n" + formatSourceLine(d, indentSource);
        boolean singleLine = !msg.contains("\n");
        if (singleLine || getConfiguration().getSourcePosition() == SourcePosition.BOTTOM)
            return msg + sourceLine;
        else
            return msg.replaceFirst("\n", Matcher.quoteReplacement(sourceLine) + "\n");
    }
}
 
Example #19
Source File: BasicDiagnosticFormatter.java    From openjdk-8 with GNU General Public License v2.0 5 votes vote down vote up
public BasicConfiguration() {
    super(EnumSet.of(DiagnosticPart.SUMMARY,
          DiagnosticPart.DETAILS,
          DiagnosticPart.SUBDIAGNOSTICS,
          DiagnosticPart.SOURCE));
    initFormat();
    initIndentation();
}
 
Example #20
Source File: BasicDiagnosticFormatter.java    From openjdk-jdk8u-backup with GNU General Public License v2.0 5 votes vote down vote up
public BasicConfiguration() {
    super(EnumSet.of(DiagnosticPart.SUMMARY,
          DiagnosticPart.DETAILS,
          DiagnosticPart.SUBDIAGNOSTICS,
          DiagnosticPart.SOURCE));
    initFormat();
    initIndentation();
}
 
Example #21
Source File: BasicDiagnosticFormatter.java    From lua-for-android with BSD 3-Clause "New" or "Revised" License 5 votes vote down vote up
public BasicConfiguration() {
    super(EnumSet.of(DiagnosticPart.SUMMARY,
          DiagnosticPart.DETAILS,
          DiagnosticPart.SUBDIAGNOSTICS,
          DiagnosticPart.SOURCE));
    initFormat();
    initIndentation();
}
 
Example #22
Source File: BasicDiagnosticFormatter.java    From javaide with GNU General Public License v3.0 5 votes vote down vote up
protected String addSourceLineIfNeeded(JCDiagnostic d, String msg) {
    if (!displaySource(d))
        return msg;
    else {
        BasicConfiguration conf = getConfiguration();
        int indentSource = conf.getIndentation(DiagnosticPart.SOURCE);
        String sourceLine = "\n" + formatSourceLine(d, indentSource);
        boolean singleLine = msg.indexOf("\n") == -1;
        if (singleLine || getConfiguration().getSourcePosition() == SourcePosition.BOTTOM)
            return msg + sourceLine;
        else
            return msg.replaceFirst("\n", Matcher.quoteReplacement(sourceLine) + "\n");
    }
}
 
Example #23
Source File: BasicDiagnosticFormatter.java    From openjdk-8-source with GNU General Public License v2.0 4 votes vote down vote up
@SuppressWarnings("fallthrough")
public BasicConfiguration(Options options) {
    super(options, EnumSet.of(DiagnosticPart.SUMMARY,
                    DiagnosticPart.DETAILS,
                    DiagnosticPart.SUBDIAGNOSTICS,
                    DiagnosticPart.SOURCE));
    initFormat();
    initIndentation();
    if (options.isSet("oldDiags"))
        initOldFormat();
    String fmt = options.get("diagsFormat");
    if (fmt != null) {
        if (fmt.equals("OLD"))
            initOldFormat();
        else
            initFormats(fmt);
    }
    String srcPos = null;
    if ((((srcPos = options.get("sourcePosition")) != null)) &&
            srcPos.equals("bottom"))
            setSourcePosition(SourcePosition.BOTTOM);
    else
        setSourcePosition(SourcePosition.AFTER_SUMMARY);
    String indent = options.get("diagsIndentation");
    if (indent != null) {
        String[] levels = indent.split("\\|");
        try {
            switch (levels.length) {
                case 5:
                    setIndentation(DiagnosticPart.JLS,
                            Integer.parseInt(levels[4]));
                case 4:
                    setIndentation(DiagnosticPart.SUBDIAGNOSTICS,
                            Integer.parseInt(levels[3]));
                case 3:
                    setIndentation(DiagnosticPart.SOURCE,
                            Integer.parseInt(levels[2]));
                case 2:
                    setIndentation(DiagnosticPart.DETAILS,
                            Integer.parseInt(levels[1]));
                default:
                    setIndentation(DiagnosticPart.SUMMARY,
                            Integer.parseInt(levels[0]));
            }
        }
        catch (NumberFormatException ex) {
            initIndentation();
        }
    }
}
 
Example #24
Source File: BasicDiagnosticFormatter.java    From openjdk-8-source with GNU General Public License v2.0 4 votes vote down vote up
@Override
public BasicConfiguration getConfiguration() {
    //the following cast is always safe - see init
    return (BasicConfiguration)super.getConfiguration();
}
 
Example #25
Source File: BasicDiagnosticFormatter.java    From hottub with GNU General Public License v2.0 4 votes vote down vote up
@Override
public BasicConfiguration getConfiguration() {
    //the following cast is always safe - see init
    return (BasicConfiguration)super.getConfiguration();
}
 
Example #26
Source File: BasicDiagnosticFormatter.java    From javaide with GNU General Public License v3.0 4 votes vote down vote up
@Override
public BasicConfiguration getConfiguration() {
    //the following cast is always safe - see init
    return (BasicConfiguration)super.getConfiguration();
}
 
Example #27
Source File: BasicDiagnosticFormatter.java    From openjdk-8 with GNU General Public License v2.0 4 votes vote down vote up
@Override
public BasicConfiguration getConfiguration() {
    //the following cast is always safe - see init
    return (BasicConfiguration)super.getConfiguration();
}
 
Example #28
Source File: BasicDiagnosticFormatter.java    From openjdk-8 with GNU General Public License v2.0 4 votes vote down vote up
@SuppressWarnings("fallthrough")
public BasicConfiguration(Options options) {
    super(options, EnumSet.of(DiagnosticPart.SUMMARY,
                    DiagnosticPart.DETAILS,
                    DiagnosticPart.SUBDIAGNOSTICS,
                    DiagnosticPart.SOURCE));
    initFormat();
    initIndentation();
    if (options.isSet("oldDiags"))
        initOldFormat();
    String fmt = options.get("diagsFormat");
    if (fmt != null) {
        if (fmt.equals("OLD"))
            initOldFormat();
        else
            initFormats(fmt);
    }
    String srcPos = null;
    if ((((srcPos = options.get("sourcePosition")) != null)) &&
            srcPos.equals("bottom"))
            setSourcePosition(SourcePosition.BOTTOM);
    else
        setSourcePosition(SourcePosition.AFTER_SUMMARY);
    String indent = options.get("diagsIndentation");
    if (indent != null) {
        String[] levels = indent.split("\\|");
        try {
            switch (levels.length) {
                case 5:
                    setIndentation(DiagnosticPart.JLS,
                            Integer.parseInt(levels[4]));
                case 4:
                    setIndentation(DiagnosticPart.SUBDIAGNOSTICS,
                            Integer.parseInt(levels[3]));
                case 3:
                    setIndentation(DiagnosticPart.SOURCE,
                            Integer.parseInt(levels[2]));
                case 2:
                    setIndentation(DiagnosticPart.DETAILS,
                            Integer.parseInt(levels[1]));
                default:
                    setIndentation(DiagnosticPart.SUMMARY,
                            Integer.parseInt(levels[0]));
            }
        }
        catch (NumberFormatException ex) {
            initIndentation();
        }
    }
}
 
Example #29
Source File: BasicDiagnosticFormatter.java    From openjdk-jdk8u-backup with GNU General Public License v2.0 4 votes vote down vote up
@Override
public BasicConfiguration getConfiguration() {
    //the following cast is always safe - see init
    return (BasicConfiguration)super.getConfiguration();
}
 
Example #30
Source File: BasicDiagnosticFormatter.java    From openjdk-jdk8u-backup with GNU General Public License v2.0 4 votes vote down vote up
@SuppressWarnings("fallthrough")
public BasicConfiguration(Options options) {
    super(options, EnumSet.of(DiagnosticPart.SUMMARY,
                    DiagnosticPart.DETAILS,
                    DiagnosticPart.SUBDIAGNOSTICS,
                    DiagnosticPart.SOURCE));
    initFormat();
    initIndentation();
    if (options.isSet("oldDiags"))
        initOldFormat();
    String fmt = options.get("diagsFormat");
    if (fmt != null) {
        if (fmt.equals("OLD"))
            initOldFormat();
        else
            initFormats(fmt);
    }
    String srcPos = null;
    if ((((srcPos = options.get("sourcePosition")) != null)) &&
            srcPos.equals("bottom"))
            setSourcePosition(SourcePosition.BOTTOM);
    else
        setSourcePosition(SourcePosition.AFTER_SUMMARY);
    String indent = options.get("diagsIndentation");
    if (indent != null) {
        String[] levels = indent.split("\\|");
        try {
            switch (levels.length) {
                case 5:
                    setIndentation(DiagnosticPart.JLS,
                            Integer.parseInt(levels[4]));
                case 4:
                    setIndentation(DiagnosticPart.SUBDIAGNOSTICS,
                            Integer.parseInt(levels[3]));
                case 3:
                    setIndentation(DiagnosticPart.SOURCE,
                            Integer.parseInt(levels[2]));
                case 2:
                    setIndentation(DiagnosticPart.DETAILS,
                            Integer.parseInt(levels[1]));
                default:
                    setIndentation(DiagnosticPart.SUMMARY,
                            Integer.parseInt(levels[0]));
            }
        }
        catch (NumberFormatException ex) {
            initIndentation();
        }
    }
}