Commit c48baf0d authored by Tagir Valeev's avatar Tagir Valeev
Browse files

IDEA-208497 Magic constant inspection shows warning for xor

parent d3e23bbb
Branches unavailable Tags unavailable
No related merge requests found
Showing with 3 additions and 1 deletion
+3 -1
......@@ -695,7 +695,8 @@ public class MagicConstantInspection extends AbstractBaseJavaLocalInspectionTool
if (same(expression, minusOne, manager)) return true;
if (expression instanceof PsiPolyadicExpression) {
IElementType tokenType = ((PsiPolyadicExpression)expression).getOperationTokenType();
if (JavaTokenType.OR.equals(tokenType) || JavaTokenType.AND.equals(tokenType) || JavaTokenType.PLUS.equals(tokenType)) {
if (JavaTokenType.OR.equals(tokenType) || JavaTokenType.XOR.equals(tokenType) ||
JavaTokenType.AND.equals(tokenType) || JavaTokenType.PLUS.equals(tokenType)) {
for (PsiExpression operand : ((PsiPolyadicExpression)expression).getOperands()) {
if (!isAllowed(operand, scope, allowedValues, manager, visited)) return false;
}
......
......@@ -266,5 +266,6 @@ public class X {
void font(@MagicConstant(flags = {FontType.PLAIN, FontType.BOLD, FontType.ITALIC}) int x) {
// 0 is not allowed despite the fact that it's flags parameter
font(<warning descr="Should be one of: FontType.PLAIN, FontType.BOLD, FontType.ITALIC or their combination">0</warning>);
font(x ^ FontType.BOLD);
}
}
Supports Markdown
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment