mirror of
https://gitflic.ru/project/openide/openide.git
synced 2026-09-27 10:03:11 +07:00
IDEA-208497 Magic constant inspection shows warning for xor
This commit is contained in:
+2
-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);
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user