/** * 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; }
protected int getIntEndPosition() { return (position == null ? Position.NOPOS : position.getEndPosition(source.getEndPosTable())); }
protected int getIntPosition() { return (position == null ? Position.NOPOS : position.getPreferredPosition()); }
protected int getIntStartPosition() { return (position == null ? Position.NOPOS : position.getStartPosition()); }