Java Code Examples for org.eclipse.jdt.internal.compiler.problem.ProblemReporter#getIrritant()

The following examples show how to use org.eclipse.jdt.internal.compiler.problem.ProblemReporter#getIrritant() . You can vote up the ones you like or vote down the ones you don't like, and go to the original project or source file by following the links above each example. You may check out the related API usage on the sidebar.
Example 1
Source File: CompilationUnitDeclaration.java    From Eclipse-Postfix-Code-Completion with Eclipse Public License 1.0 6 votes vote down vote up
public boolean isSuppressed(CategorizedProblem problem) {
	if (this.suppressWarningsCount == 0) return false;
	int irritant = ProblemReporter.getIrritant(problem.getID());
	if (irritant == 0) return false;
	int start = problem.getSourceStart();
	int end = problem.getSourceEnd();
	nextSuppress: for (int iSuppress = 0, suppressCount = this.suppressWarningsCount; iSuppress < suppressCount; iSuppress++) {
		long position = this.suppressWarningScopePositions[iSuppress];
		int startSuppress = (int) (position >>> 32);
		int endSuppress = (int) position;
		if (start < startSuppress) continue nextSuppress;
		if (end > endSuppress) continue nextSuppress;
		if (this.suppressWarningIrritants[iSuppress].isSet(irritant))
			return true;
	}
	return false;
}
 
Example 2
Source File: Main.java    From Eclipse-Postfix-Code-Completion with Eclipse Public License 1.0 4 votes vote down vote up
private String getProblemOptionKey(int problemID) {
	int irritant = ProblemReporter.getIrritant(problemID);
	return CompilerOptions.optionKeyFromIrritant(irritant);
}
 
Example 3
Source File: CorrectionEngine.java    From Eclipse-Postfix-Code-Completion with Eclipse Public License 1.0 3 votes vote down vote up
/**
 * Returns a token which can be used to suppress a given warning using
 * <code>@SuppressWarnings</code> annotation, for a given problem ID
 * ({@link IProblem }). If a particular problem is not suppressable,
 * <code>null</code> will be returned.
 * <p>
 * <b>Note:</b> <code>@SuppressWarnings</code> can only suppress warnings,
 * which means that if some problems got promoted to ERROR using custom compiler
 * settings ({@link IJavaProject#setOption(String, String)}), the
 * <code>@SuppressWarnings</code> annotation will be ineffective.
 * </p>
 * <p>
 * <b>Note:</b> <code>@SuppressWarnings</code> can be argumented with
 * <code>"all"</code> so as to suppress all possible warnings at once.
 * </p>
 * <p>
 * <b>Note:</b> The tokens returned are not necessarily standardized across Java
 * compilers. If you were to use one of these tokens in an @SuppressWarnings
 * annotation in the Java source code, the effects (if any) may vary from
 * compiler to compiler.
 * </p>
 * @param problemID
 *         the ID of a given warning to suppress
 * @return a String which can be used in <code>@SuppressWarnings</code> annotation,
 * or <code>null</code> if unable to suppress this warning.
 * @since 3.1
 */
public static String getWarningToken(int problemID){
	int irritant = ProblemReporter.getIrritant(problemID);
	if (irritant != 0) {
		return CompilerOptions.warningTokenFromIrritant(irritant);
	}
	return null;
}