当前位置: 首页>>代码示例>>Java>>正文


Java DiagnosticFormatter类代码示例

本文整理汇总了Java中com.sun.tools.javac.api.DiagnosticFormatter的典型用法代码示例。如果您正苦于以下问题:Java DiagnosticFormatter类的具体用法?Java DiagnosticFormatter怎么用?Java DiagnosticFormatter使用的例子?那么, 这里精选的类代码示例或许可以为您提供帮助。


DiagnosticFormatter类属于com.sun.tools.javac.api包,在下文中一共展示了DiagnosticFormatter类的13个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。

示例1: JCDiagnostic

import com.sun.tools.javac.api.DiagnosticFormatter; //导入依赖的package包/类
/**
 * Create a diagnostic object.
 * @param formatter the formatter to use for the diagnostic
 * @param dt the type of diagnostic
 * @param lc     the lint category for the diagnostic
 * @param source the name of the source file, or null if none.
 * @param pos the character offset within the source file, if given.
 * @param key a resource key to identify the text of the diagnostic
 * @param args arguments to be included in the text of the diagnostic
 */
protected JCDiagnostic(DiagnosticFormatter<JCDiagnostic> formatter,
                   DiagnosticType dt,
                   LintCategory lc,
                   Set<DiagnosticFlag> flags,
                   DiagnosticSource source,
                   DiagnosticPosition pos,
                   String key,
                   Object... args) {
    if (source == null && pos != null && pos.getPreferredPosition() != Position.NOPOS)
        throw new IllegalArgumentException();

    this.defaultFormatter = formatter;
    this.type = dt;
    this.lintCategory = lc;
    this.flags = flags;
    this.source = source;
    this.position = pos;
    this.key = key;
    this.args = args;
}
 
开发者ID:SunburstApps,项目名称:OpenJSharp,代码行数:31,代码来源:JCDiagnostic.java

示例2: JCDiagnostic

import com.sun.tools.javac.api.DiagnosticFormatter; //导入依赖的package包/类
/**
 * Create a diagnostic object.
 * @param formatter the formatter to use for the diagnostic
 * @param diagnosticInfo the diagnostic key
 * @param lc     the lint category for the diagnostic
 * @param source the name of the source file, or null if none.
 * @param pos the character offset within the source file, if given.
 */
protected JCDiagnostic(DiagnosticFormatter<JCDiagnostic> formatter,
                   DiagnosticInfo diagnosticInfo,
                   LintCategory lc,
                   Set<DiagnosticFlag> flags,
                   DiagnosticSource source,
                   DiagnosticPosition pos) {
    if (source == null && pos != null && pos.getPreferredPosition() != Position.NOPOS)
        throw new IllegalArgumentException();

    this.defaultFormatter = formatter;
    this.diagnosticInfo = diagnosticInfo;
    this.lintCategory = lc;
    this.flags = flags;
    this.source = source;
    this.position = pos;
}
 
开发者ID:AdoptOpenJDK,项目名称:openjdk-jdk10,代码行数:25,代码来源:JCDiagnostic.java

示例3: wrap

import com.sun.tools.javac.api.DiagnosticFormatter; //导入依赖的package包/类
public static Diagnostic wrap(Diagnostic d, DiagnosticFormatter<JCDiagnostic> df) {
    if (d instanceof JCDiagnostic) {
        return new RichDiagnostic((JCDiagnostic) d, df);
    } else {
        return d;
    }
}
 
开发者ID:apache,项目名称:incubator-netbeans,代码行数:8,代码来源:CompilationInfoImpl.java

示例4: getFragmentFormatter

import com.sun.tools.javac.api.DiagnosticFormatter; //导入依赖的package包/类
@Deprecated
public static DiagnosticFormatter<JCDiagnostic> getFragmentFormatter() {
    if (fragmentFormatter == null) {
        fragmentFormatter = new BasicDiagnosticFormatter(JavacMessages.getDefaultMessages());
    }
    return fragmentFormatter;
}
 
开发者ID:tranleduy2000,项目名称:javaide,代码行数:8,代码来源:JCDiagnostic.java

示例5: JCDiagnostic

import com.sun.tools.javac.api.DiagnosticFormatter; //导入依赖的package包/类
/**
 * Create a diagnostic object.
 * @param fomatter the formatter to use for the diagnostic
 * @param dt the type of diagnostic
 * @param lc     the lint category for the diagnostic
 * @param source the name of the source file, or null if none.
 * @param pos the character offset within the source file, if given.
 * @param key a resource key to identify the text of the diagnostic
 * @param args arguments to be included in the text of the diagnostic
 */
protected JCDiagnostic(DiagnosticFormatter<JCDiagnostic> formatter,
                   DiagnosticType dt,
                   LintCategory lc,
                   Set<DiagnosticFlag> flags,
                   DiagnosticSource source,
                   DiagnosticPosition pos,
                   String key,
                   Object... args) {
    if (source == null && pos != null && pos.getPreferredPosition() != Position.NOPOS)
        throw new IllegalArgumentException();

    this.defaultFormatter = formatter;
    this.type = dt;
    this.lintCategory = lc;
    this.flags = flags;
    this.source = source;
    this.position = pos;
    this.key = key;
        this.args = args;

    int n = (pos == null ? Position.NOPOS : pos.getPreferredPosition());
    if (n == Position.NOPOS || source == null)
        line = column = -1;
    else {
        line = source.getLineNumber(n);
        column = source.getColumnNumber(n, true);
    }
}
 
开发者ID:tranleduy2000,项目名称:javaide,代码行数:39,代码来源:JCDiagnostic.java

示例6: testThroughFormatterFormat

import com.sun.tools.javac.api.DiagnosticFormatter; //导入依赖的package包/类
public void testThroughFormatterFormat() throws IOException {
    final JavaCompiler tool = ToolProvider.getSystemJavaCompiler();
    DiagnosticChecker dc = new DiagnosticChecker("compiler.err.prob.found.req");
    JavacTask ct = (JavacTask)tool.getTask(null, null, dc, null, null, Arrays.asList(new JavaSource()));
    ct.analyze();
    DiagnosticFormatter<JCDiagnostic> formatter =
            Log.instance(((JavacTaskImpl) ct).getContext()).getDiagnosticFormatter();
    String msg = formatter.formatMessage(dc.diag, Locale.getDefault());
    //no redundant package qualifiers
    Assert.check(msg.indexOf("java.") == -1, msg);
}
 
开发者ID:AdoptOpenJDK,项目名称:openjdk-jdk10,代码行数:12,代码来源:T7116676.java

示例7: JCDiagnostic

import com.sun.tools.javac.api.DiagnosticFormatter; //导入依赖的package包/类
/**
 * Create a diagnostic object.
 * @param formatter the formatter to use for the diagnostic
 * @param dt the type of diagnostic
 * @param lc     the lint category for the diagnostic
 * @param source the name of the source file, or null if none.
 * @param pos the character offset within the source file, if given.
 * @param key a resource key to identify the text of the diagnostic
 * @param args arguments to be included in the text of the diagnostic
 */
protected JCDiagnostic(DiagnosticFormatter<JCDiagnostic> formatter,
                   DiagnosticType dt,
                   LintCategory lc,
                   Set<DiagnosticFlag> flags,
                   DiagnosticSource source,
                   DiagnosticPosition pos,
                   String key,
                   Object... args) {
    if (source == null && pos != null && pos.getPreferredPosition() != Position.NOPOS)
        throw new IllegalArgumentException();

    this.defaultFormatter = formatter;
    this.type = dt;
    this.lintCategory = lc;
    this.flags = flags;
    this.source = source;
    this.position = pos;
    this.key = key;
    this.args = args;

    int n = (pos == null ? Position.NOPOS : pos.getPreferredPosition());
    if (n == Position.NOPOS || source == null)
        line = column = -1;
    else {
        line = source.getLineNumber(n);
        column = source.getColumnNumber(n, true);
    }
}
 
开发者ID:RedlineResearch,项目名称:OLD-OpenJDK8,代码行数:39,代码来源:JCDiagnostic.java

示例8: JCDiagnostic

import com.sun.tools.javac.api.DiagnosticFormatter; //导入依赖的package包/类
/**
 * Create a diagnostic object.
 * @param fomatter the formatter to use for the diagnostic
 * @param dt the type of diagnostic
 * @param lc     the lint category for the diagnostic
 * @param source the name of the source file, or null if none.
 * @param pos the character offset within the source file, if given.
 * @param key a resource key to identify the text of the diagnostic
 * @param args arguments to be included in the text of the diagnostic
 */
protected JCDiagnostic(DiagnosticFormatter<JCDiagnostic> formatter,
                   DiagnosticType dt,
                   LintCategory lc,
                   Set<DiagnosticFlag> flags,
                   DiagnosticSource source,
                   DiagnosticPosition pos,
                   String key,
                   Object... args) {
    if (source == null && pos != null && pos.getPreferredPosition() != Position.NOPOS)
        throw new IllegalArgumentException();

    this.defaultFormatter = formatter;
    this.type = dt;
    this.lintCategory = lc;
    this.flags = flags;
    this.source = source;
    this.position = pos;
    this.key = key;
    this.args = args;

    int n = (pos == null ? Position.NOPOS : pos.getPreferredPosition());
    if (n == Position.NOPOS || source == null)
        line = column = -1;
    else {
        line = source.getLineNumber(n);
        column = source.getColumnNumber(n, true);
    }
}
 
开发者ID:sebastianoe,项目名称:s4j,代码行数:39,代码来源:JCDiagnostic.java

示例9: report

import com.sun.tools.javac.api.DiagnosticFormatter; //导入依赖的package包/类
@Override
public void report(Diagnostic<? extends JavaFileObject> diagnostic) {
  DiagnosticFormatter<JCDiagnostic> formatter = Log.instance(context).getDiagnosticFormatter();
  Locale locale = JavacMessages.instance(context).getCurrentLocale();
  String formatted = formatter.format((JCDiagnostic) diagnostic, locale);
  diagnostics.add(new FormattedDiagnostic(diagnostic, formatted));
}
 
开发者ID:bazelbuild,项目名称:bazel,代码行数:8,代码来源:FormattedDiagnostic.java

示例10: RichDiagnostic

import com.sun.tools.javac.api.DiagnosticFormatter; //导入依赖的package包/类
public RichDiagnostic(JCDiagnostic delegate, DiagnosticFormatter<JCDiagnostic> formatter) {
    this.delegate = delegate;
    this.formatter = formatter;
}
 
开发者ID:apache,项目名称:incubator-netbeans,代码行数:5,代码来源:CompilationInfoImpl.java

示例11: getDiagnosticFormatter

import com.sun.tools.javac.api.DiagnosticFormatter; //导入依赖的package包/类
/**
 * Get the current diagnostic formatter.
 */
public DiagnosticFormatter<JCDiagnostic> getDiagnosticFormatter() {
    return diagFormatter;
}
 
开发者ID:tranleduy2000,项目名称:javaide,代码行数:7,代码来源:Log.java

示例12: setDiagnosticFormatter

import com.sun.tools.javac.api.DiagnosticFormatter; //导入依赖的package包/类
/**
 * Set the current diagnostic formatter.
 */
public void setDiagnosticFormatter(DiagnosticFormatter<JCDiagnostic> diagFormatter) {
    this.diagFormatter = diagFormatter;
}
 
开发者ID:tranleduy2000,项目名称:javaide,代码行数:7,代码来源:Log.java

示例13: getDiagnosticFormatter

import com.sun.tools.javac.api.DiagnosticFormatter; //导入依赖的package包/类
/** Get the current diagnostic formatter.
 */
public DiagnosticFormatter<JCDiagnostic> getDiagnosticFormatter() {
    return diagFormatter;
}
 
开发者ID:SunburstApps,项目名称:OpenJSharp,代码行数:6,代码来源:Log.java


注:本文中的com.sun.tools.javac.api.DiagnosticFormatter类示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。