com.sun.tools.javac.file.BaseFileObject Java Examples

The following examples show how to use com.sun.tools.javac.file.BaseFileObject. 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: AbstractDiagnosticFormatter.java    From openjdk-jdk8u-backup with GNU General Public License v2.0 5 votes vote down vote up
public String formatSource(JCDiagnostic d, boolean fullname, Locale l) {
    JavaFileObject fo = d.getSource();
    if (fo == null)
        throw new IllegalArgumentException(); // d should have source set
    if (fullname)
        return fo.getName();
    else if (fo instanceof BaseFileObject)
        return ((BaseFileObject) fo).getShortName();
    else
        return BaseFileObject.getSimpleName(fo);
}
 
Example #2
Source File: AbstractDiagnosticFormatter.java    From openjdk-8 with GNU General Public License v2.0 5 votes vote down vote up
public String formatSource(JCDiagnostic d, boolean fullname, Locale l) {
    JavaFileObject fo = d.getSource();
    if (fo == null)
        throw new IllegalArgumentException(); // d should have source set
    if (fullname)
        return fo.getName();
    else if (fo instanceof BaseFileObject)
        return ((BaseFileObject) fo).getShortName();
    else
        return BaseFileObject.getSimpleName(fo);
}
 
Example #3
Source File: RawDiagnosticFormatter.java    From openjdk-8 with GNU General Public License v2.0 5 votes vote down vote up
@Override
protected String formatArgument(JCDiagnostic diag, Object arg, Locale l) {
    String s;
    if (arg instanceof Formattable) {
        s = arg.toString();
    } else if (arg instanceof JCExpression) {
        JCExpression tree = (JCExpression)arg;
        s = "@" + tree.getStartPosition();
    } else if (arg instanceof BaseFileObject) {
        s = ((BaseFileObject) arg).getShortName();
    } else {
        s = super.formatArgument(diag, arg, null);
    }
    return (arg instanceof JCDiagnostic) ? "(" + s + ")" : s;
}
 
Example #4
Source File: AbstractDiagnosticFormatter.java    From openjdk-8-source with GNU General Public License v2.0 5 votes vote down vote up
public String formatSource(JCDiagnostic d, boolean fullname, Locale l) {
    JavaFileObject fo = d.getSource();
    if (fo == null)
        throw new IllegalArgumentException(); // d should have source set
    if (fullname)
        return fo.getName();
    else if (fo instanceof BaseFileObject)
        return ((BaseFileObject) fo).getShortName();
    else
        return BaseFileObject.getSimpleName(fo);
}
 
Example #5
Source File: RawDiagnosticFormatter.java    From openjdk-8-source with GNU General Public License v2.0 5 votes vote down vote up
@Override
protected String formatArgument(JCDiagnostic diag, Object arg, Locale l) {
    String s;
    if (arg instanceof Formattable) {
        s = arg.toString();
    } else if (arg instanceof JCExpression) {
        JCExpression tree = (JCExpression)arg;
        s = "@" + tree.getStartPosition();
    } else if (arg instanceof BaseFileObject) {
        s = ((BaseFileObject) arg).getShortName();
    } else {
        s = super.formatArgument(diag, arg, null);
    }
    return (arg instanceof JCDiagnostic) ? "(" + s + ")" : s;
}
 
Example #6
Source File: AbstractDiagnosticFormatter.java    From hottub with GNU General Public License v2.0 5 votes vote down vote up
public String formatSource(JCDiagnostic d, boolean fullname, Locale l) {
    JavaFileObject fo = d.getSource();
    if (fo == null)
        throw new IllegalArgumentException(); // d should have source set
    if (fullname)
        return fo.getName();
    else if (fo instanceof BaseFileObject)
        return ((BaseFileObject) fo).getShortName();
    else
        return BaseFileObject.getSimpleName(fo);
}
 
Example #7
Source File: RawDiagnosticFormatter.java    From hottub with GNU General Public License v2.0 5 votes vote down vote up
@Override
protected String formatArgument(JCDiagnostic diag, Object arg, Locale l) {
    String s;
    if (arg instanceof Formattable) {
        s = arg.toString();
    } else if (arg instanceof JCExpression) {
        JCExpression tree = (JCExpression)arg;
        s = "@" + tree.getStartPosition();
    } else if (arg instanceof BaseFileObject) {
        s = ((BaseFileObject) arg).getShortName();
    } else {
        s = super.formatArgument(diag, arg, null);
    }
    return (arg instanceof JCDiagnostic) ? "(" + s + ")" : s;
}
 
Example #8
Source File: AbstractDiagnosticFormatter.java    From javaide with GNU General Public License v3.0 5 votes vote down vote up
public String formatSource(JCDiagnostic d, boolean fullname, Locale l) {
    JavaFileObject fo = d.getSource();
    if (fo == null)
        throw new IllegalArgumentException(); // d should have source set
    if (fullname)
        return fo.getName();
    else if (fo instanceof BaseFileObject)
        return ((BaseFileObject) fo).getShortName();
    else
        return BaseFileObject.getSimpleName(fo);
}
 
Example #9
Source File: RawDiagnosticFormatter.java    From javaide with GNU General Public License v3.0 5 votes vote down vote up
@Override
protected String formatArgument(JCDiagnostic diag, Object arg, Locale l) {
    String s;
    if (arg instanceof Formattable)
        s = arg.toString();
    else if (arg instanceof BaseFileObject)
        s = ((BaseFileObject) arg).getShortName();
    else
        s = super.formatArgument(diag, arg, null);
    if (arg instanceof JCDiagnostic)
        return "(" + s + ")";
    else
        return s;
}
 
Example #10
Source File: RawDiagnosticFormatter.java    From TencentKona-8 with GNU General Public License v2.0 5 votes vote down vote up
@Override
protected String formatArgument(JCDiagnostic diag, Object arg, Locale l) {
    String s;
    if (arg instanceof Formattable) {
        s = arg.toString();
    } else if (arg instanceof JCExpression) {
        JCExpression tree = (JCExpression)arg;
        s = "@" + tree.getStartPosition();
    } else if (arg instanceof BaseFileObject) {
        s = ((BaseFileObject) arg).getShortName();
    } else {
        s = super.formatArgument(diag, arg, null);
    }
    return (arg instanceof JCDiagnostic) ? "(" + s + ")" : s;
}
 
Example #11
Source File: RawDiagnosticFormatter.java    From openjdk-jdk8u-backup with GNU General Public License v2.0 5 votes vote down vote up
@Override
protected String formatArgument(JCDiagnostic diag, Object arg, Locale l) {
    String s;
    if (arg instanceof Formattable) {
        s = arg.toString();
    } else if (arg instanceof JCExpression) {
        JCExpression tree = (JCExpression)arg;
        s = "@" + tree.getStartPosition();
    } else if (arg instanceof BaseFileObject) {
        s = ((BaseFileObject) arg).getShortName();
    } else {
        s = super.formatArgument(diag, arg, null);
    }
    return (arg instanceof JCDiagnostic) ? "(" + s + ")" : s;
}
 
Example #12
Source File: AbstractDiagnosticFormatter.java    From openjdk-jdk8u with GNU General Public License v2.0 5 votes vote down vote up
public String formatSource(JCDiagnostic d, boolean fullname, Locale l) {
    JavaFileObject fo = d.getSource();
    if (fo == null)
        throw new IllegalArgumentException(); // d should have source set
    if (fullname)
        return fo.getName();
    else if (fo instanceof BaseFileObject)
        return ((BaseFileObject) fo).getShortName();
    else
        return BaseFileObject.getSimpleName(fo);
}
 
Example #13
Source File: RawDiagnosticFormatter.java    From openjdk-jdk8u with GNU General Public License v2.0 5 votes vote down vote up
@Override
protected String formatArgument(JCDiagnostic diag, Object arg, Locale l) {
    String s;
    if (arg instanceof Formattable) {
        s = arg.toString();
    } else if (arg instanceof JCExpression) {
        JCExpression tree = (JCExpression)arg;
        s = "@" + tree.getStartPosition();
    } else if (arg instanceof BaseFileObject) {
        s = ((BaseFileObject) arg).getShortName();
    } else {
        s = super.formatArgument(diag, arg, null);
    }
    return (arg instanceof JCDiagnostic) ? "(" + s + ")" : s;
}
 
Example #14
Source File: AbstractDiagnosticFormatter.java    From java-n-IDE-for-Android with Apache License 2.0 5 votes vote down vote up
public String formatSource(JCDiagnostic d, boolean fullname, Locale l) {
    JavaFileObject fo = d.getSource();
    if (fo == null)
        throw new IllegalArgumentException(); // d should have source set
    if (fullname)
        return fo.getName();
    else if (fo instanceof BaseFileObject)
        return ((BaseFileObject) fo).getShortName();
    else
        return BaseFileObject.getSimpleName(fo);
}
 
Example #15
Source File: RawDiagnosticFormatter.java    From java-n-IDE-for-Android with Apache License 2.0 5 votes vote down vote up
@Override
protected String formatArgument(JCDiagnostic diag, Object arg, Locale l) {
    String s;
    if (arg instanceof Formattable)
        s = arg.toString();
    else if (arg instanceof BaseFileObject)
        s = ((BaseFileObject) arg).getShortName();
    else
        s = super.formatArgument(diag, arg, null);
    if (arg instanceof JCDiagnostic)
        return "(" + s + ")";
    else
        return s;
}
 
Example #16
Source File: AbstractDiagnosticFormatter.java    From jdk8u60 with GNU General Public License v2.0 5 votes vote down vote up
public String formatSource(JCDiagnostic d, boolean fullname, Locale l) {
    JavaFileObject fo = d.getSource();
    if (fo == null)
        throw new IllegalArgumentException(); // d should have source set
    if (fullname)
        return fo.getName();
    else if (fo instanceof BaseFileObject)
        return ((BaseFileObject) fo).getShortName();
    else
        return BaseFileObject.getSimpleName(fo);
}
 
Example #17
Source File: RawDiagnosticFormatter.java    From jdk8u60 with GNU General Public License v2.0 5 votes vote down vote up
@Override
protected String formatArgument(JCDiagnostic diag, Object arg, Locale l) {
    String s;
    if (arg instanceof Formattable) {
        s = arg.toString();
    } else if (arg instanceof JCExpression) {
        JCExpression tree = (JCExpression)arg;
        s = "@" + tree.getStartPosition();
    } else if (arg instanceof BaseFileObject) {
        s = ((BaseFileObject) arg).getShortName();
    } else {
        s = super.formatArgument(diag, arg, null);
    }
    return (arg instanceof JCDiagnostic) ? "(" + s + ")" : s;
}
 
Example #18
Source File: AbstractDiagnosticFormatter.java    From TencentKona-8 with GNU General Public License v2.0 5 votes vote down vote up
public String formatSource(JCDiagnostic d, boolean fullname, Locale l) {
    JavaFileObject fo = d.getSource();
    if (fo == null)
        throw new IllegalArgumentException(); // d should have source set
    if (fullname)
        return fo.getName();
    else if (fo instanceof BaseFileObject)
        return ((BaseFileObject) fo).getShortName();
    else
        return BaseFileObject.getSimpleName(fo);
}