コード例 #1
0
  /**
   * 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;
  }
コード例 #2
0
 protected int getIntEndPosition() {
   return (position == null ? Position.NOPOS : position.getEndPosition(source.getEndPosTable()));
 }
コード例 #3
0
 protected int getIntPosition() {
   return (position == null ? Position.NOPOS : position.getPreferredPosition());
 }
コード例 #4
0
 protected int getIntStartPosition() {
   return (position == null ? Position.NOPOS : position.getStartPosition());
 }