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

The following examples show how to use com.sun.tools.javac.file.BaseFileObject. These examples are extracted from open source projects. 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
@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 2
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
@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
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
@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 6
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
@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
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
@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 10
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 11
@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 12
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
@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
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
@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 16
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
@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
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);
}