28 import java.util.HashMap; |
28 import java.util.HashMap; |
29 import java.util.Map; |
29 import java.util.Map; |
30 import javax.tools.JavaFileObject; |
30 import javax.tools.JavaFileObject; |
31 |
31 |
32 import com.sun.tools.javac.code.Lint.LintCategory; |
32 import com.sun.tools.javac.code.Lint.LintCategory; |
|
33 import com.sun.tools.javac.util.JCDiagnostic.DiagnosticFlag; |
33 import com.sun.tools.javac.util.JCDiagnostic.DiagnosticPosition; |
34 import com.sun.tools.javac.util.JCDiagnostic.DiagnosticPosition; |
34 import com.sun.tools.javac.util.JCDiagnostic.SimpleDiagnosticPosition; |
35 import com.sun.tools.javac.util.JCDiagnostic.SimpleDiagnosticPosition; |
35 |
36 |
36 |
37 |
37 /** |
38 /** |
101 */ |
102 */ |
102 public void error(int pos, String key, Object ... args) { |
103 public void error(int pos, String key, Object ... args) { |
103 report(diags.error(source, wrap(pos), key, args)); |
104 report(diags.error(source, wrap(pos), key, args)); |
104 } |
105 } |
105 |
106 |
|
107 /** Report an error, unless another error was already reported at same |
|
108 * source position. |
|
109 * @param flag A flag to set on the diagnostic |
|
110 * @param pos The source position at which to report the error. |
|
111 * @param key The key for the localized error message. |
|
112 * @param args Fields of the error message. |
|
113 */ |
|
114 public void error(DiagnosticFlag flag, int pos, String key, Object ... args) { |
|
115 JCDiagnostic d = diags.error(source, wrap(pos), key, args); |
|
116 d.setFlag(flag); |
|
117 report(d); |
|
118 } |
|
119 |
106 /** Report a warning, unless suppressed by the -nowarn option or the |
120 /** Report a warning, unless suppressed by the -nowarn option or the |
107 * maximum number of warnings has been reached. |
121 * maximum number of warnings has been reached. |
108 * @param pos The source position at which to report the warning. |
122 * @param pos The source position at which to report the warning. |
109 * @param key The key for the localized warning message. |
123 * @param key The key for the localized warning message. |
110 * @param args Fields of the warning message. |
124 * @param args Fields of the warning message. |