public class DoubleNegation {
void negative(boolean b1, boolean b2, boolean b3) {
- boolean r1 = !(b1 != b2);
- boolean r2 = !!b1;
- boolean r3 = !b1 != b2;
- boolean r4 = (b1 != (b2 != b3));
- boolean r5 = (b1 != b2 != b3);
+ boolean r1 = <warning descr="Double negation in '!(b1 != b2)'">!(b1 != b2)</warning>;
+ boolean r2 = <warning descr="Double negation in '!!b1'">!!b1</warning>;
+ boolean r3 = <warning descr="Double negation in '!b1 != b2'">!b1 != b2</warning>;
+ boolean r4 = (<warning descr="Double negation in 'b1 != (b2 != b3)'">b1 != (b2 != b3)</warning>);
+ boolean r5 = (<warning descr="Double negation in 'b1 != b2 != b3'">b1 != b2 != b3</warning>);
}
}
+++ /dev/null
-<?xml version="1.0" encoding="UTF-8"?>
-<problems>
- <problem>
- <file>DoubleNegation.java</file>
- <line>6</line>
- <problem_class severity="WARNING" attribute_key="WARNING_ATTRIBUTES">Double negation</problem_class>
- <description>Double negation in <code>!(b1 != b2)</code> #loc</description>
- </problem>
-
- <problem>
- <file>DoubleNegation.java</file>
- <line>7</line>
- <problem_class severity="WARNING" attribute_key="WARNING_ATTRIBUTES">Double negation</problem_class>
- <description>Double negation in <code>!!b1</code> #loc</description>
- </problem>
-
- <problem>
- <file>DoubleNegation.java</file>
- <line>8</line>
- <problem_class severity="WARNING" attribute_key="WARNING_ATTRIBUTES">Double negation</problem_class>
- <description>Double negation in <code>!b1 != b2</code> #loc</description>
- </problem>
-
- <problem>
- <file>DoubleNegation.java</file>
- <line>9</line>
- <problem_class severity="WARNING" attribute_key="WARNING_ATTRIBUTES">Double negation</problem_class>
- <description>Double negation in <code>b1 != (b2 != b3)</code> #loc</description>
- </problem>
-
- <problem>
- <file>DoubleNegation.java</file>
- <line>10</line>
- <problem_class severity="WARNING" attribute_key="WARNING_ATTRIBUTES">Double negation</problem_class>
- <description>Double negation in <code>b1 != b2 != b3</code> #loc</description>
- </problem>
-</problems>
\ No newline at end of file
+/*
+ * Copyright 2000-2016 JetBrains s.r.o.
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
package com.siyeh.ig.controlflow;
-import com.siyeh.ig.IGInspectionTestCase;
+import com.intellij.codeInspection.InspectionProfileEntry;
+import com.siyeh.ig.LightInspectionTestCase;
+import org.jetbrains.annotations.Nullable;
-public class DoubleNegationInspectionTest
- extends IGInspectionTestCase {
+/**
+ * @author Bas Leijdekkers
+ */
+public class DoubleNegationInspectionTest extends LightInspectionTestCase {
- public void test() throws Exception {
- doTest("com/siyeh/igtest/controlflow/double_negation", new DoubleNegationInspection());
+ public void testDoubleNegation() {
+ doTest();
+ }
+
+ @Nullable
+ @Override
+ protected InspectionProfileEntry getInspection() {
+ return new DoubleNegationInspection();
}
}
\ No newline at end of file