src/share/classes/com/sun/tools/javac/comp/Check.java

changeset 377
d9febdd5ae21
parent 362
c4c424badb83
child 383
8109aa93b212
equal deleted inserted replaced
376:61c1f735df67 377:d9febdd5ae21
102 skipAnnotations = options.get("skipAnnotations") != null; 102 skipAnnotations = options.get("skipAnnotations") != null;
103 warnOnSyntheticConflicts = options.get("warnOnSyntheticConflicts") != null; 103 warnOnSyntheticConflicts = options.get("warnOnSyntheticConflicts") != null;
104 104
105 boolean verboseDeprecated = lint.isEnabled(LintCategory.DEPRECATION); 105 boolean verboseDeprecated = lint.isEnabled(LintCategory.DEPRECATION);
106 boolean verboseUnchecked = lint.isEnabled(LintCategory.UNCHECKED); 106 boolean verboseUnchecked = lint.isEnabled(LintCategory.UNCHECKED);
107 boolean verboseSunApi = lint.isEnabled(LintCategory.SUNAPI);
107 boolean enforceMandatoryWarnings = source.enforceMandatoryWarnings(); 108 boolean enforceMandatoryWarnings = source.enforceMandatoryWarnings();
108 109
109 deprecationHandler = new MandatoryWarningHandler(log, verboseDeprecated, 110 deprecationHandler = new MandatoryWarningHandler(log, verboseDeprecated,
110 enforceMandatoryWarnings, "deprecated"); 111 enforceMandatoryWarnings, "deprecated");
111 uncheckedHandler = new MandatoryWarningHandler(log, verboseUnchecked, 112 uncheckedHandler = new MandatoryWarningHandler(log, verboseUnchecked,
112 enforceMandatoryWarnings, "unchecked"); 113 enforceMandatoryWarnings, "unchecked");
114 sunApiHandler = new MandatoryWarningHandler(log, verboseSunApi,
115 enforceMandatoryWarnings, "sunapi");
113 } 116 }
114 117
115 /** Switch: generics enabled? 118 /** Switch: generics enabled?
116 */ 119 */
117 boolean allowGenerics; 120 boolean allowGenerics;
135 138
136 /** A handler for messages about unchecked or unsafe usage. 139 /** A handler for messages about unchecked or unsafe usage.
137 */ 140 */
138 private MandatoryWarningHandler uncheckedHandler; 141 private MandatoryWarningHandler uncheckedHandler;
139 142
143 /** A handler for messages about using Sun proprietary API.
144 */
145 private MandatoryWarningHandler sunApiHandler;
140 146
141 /* ************************************************************************* 147 /* *************************************************************************
142 * Errors and Warnings 148 * Errors and Warnings
143 **************************************************************************/ 149 **************************************************************************/
144 150
164 public void warnUnchecked(DiagnosticPosition pos, String msg, Object... args) { 170 public void warnUnchecked(DiagnosticPosition pos, String msg, Object... args) {
165 if (!lint.isSuppressed(LintCategory.UNCHECKED)) 171 if (!lint.isSuppressed(LintCategory.UNCHECKED))
166 uncheckedHandler.report(pos, msg, args); 172 uncheckedHandler.report(pos, msg, args);
167 } 173 }
168 174
175 /** Warn about using Sun proprietary API.
176 * @param pos Position to be used for error reporting.
177 * @param msg A string describing the problem.
178 */
179 public void warnSunApi(DiagnosticPosition pos, String msg, Object... args) {
180 if (!lint.isSuppressed(LintCategory.SUNAPI))
181 sunApiHandler.report(pos, msg, args);
182 }
183
169 /** 184 /**
170 * Report any deferred diagnostics. 185 * Report any deferred diagnostics.
171 */ 186 */
172 public void reportDeferredDiagnostics() { 187 public void reportDeferredDiagnostics() {
173 deprecationHandler.reportDeferredDiagnostic(); 188 deprecationHandler.reportDeferredDiagnostic();
174 uncheckedHandler.reportDeferredDiagnostic(); 189 uncheckedHandler.reportDeferredDiagnostic();
190 sunApiHandler.reportDeferredDiagnostic();
175 } 191 }
176 192
177 193
178 /** Report a failure to complete a class. 194 /** Report a failure to complete a class.
179 * @param pos Position to be used for error reporting. 195 * @param pos Position to be used for error reporting.

mercurial