make IG test light

This commit is contained in:
Bas Leijdekkers
2017-05-19 19:12:56 +02:00
parent ceb2fee089
commit 8e6699eb44
3 changed files with 34 additions and 38 deletions
@@ -6,9 +6,9 @@ class SynchronizedOnLiteralObject {
private Character c = 'a';
void foo() {
synchronized (myInteger) {}
synchronized ("asdf") {}
synchronized ((Boolean) true) {}
synchronized (c) {}
synchronized (<warning descr="Synchronization on Integer 'myInteger' which is initialized by a literal">myInteger</warning>) {}
synchronized (<warning descr="Synchronization on String literal '\"asdf\"'">"asdf"</warning>) {}
synchronized (<warning descr="Synchronization on Boolean literal '(Boolean) true'">(Boolean) true</warning>) {}
synchronized (<warning descr="Synchronization on Character 'c' which is initialized by a literal">c</warning>) {}
}
}
@@ -1,30 +0,0 @@
<?xml version="1.0" encoding="UTF-8"?>
<problems>
<problem>
<file>SynchronizedOnLiteralObject.java</file>
<line>9</line>
<problem_class severity="WARNING" attribute_key="WARNING_ATTRIBUTES">Synchronization on an object initialized with a literal</problem_class>
<description>Synchronization on Integer &lt;code&gt;myInteger&lt;/code&gt; which is initialized by a literal #loc</description>
</problem>
<problem>
<file>SynchronizedOnLiteralObject.java</file>
<line>10</line>
<problem_class severity="WARNING" attribute_key="WARNING_ATTRIBUTES">Synchronization on an object initialized with a literal</problem_class>
<description>Synchronization on String &lt;code&gt;&quot;asdf&quot;&lt;/code&gt; which is initialized by a literal #loc</description>
</problem>
<problem>
<file>SynchronizedOnLiteralObject.java</file>
<line>11</line>
<problem_class severity="WARNING" attribute_key="WARNING_ATTRIBUTES">Synchronization on an object initialized with a literal</problem_class>
<description>Synchronization on Boolean &lt;code&gt;(Boolean) true&lt;/code&gt; which is initialized by a literal #loc</description>
</problem>
<problem>
<file>SynchronizedOnLiteralObject.java</file>
<line>12</line>
<problem_class severity="WARNING" attribute_key="WARNING_ATTRIBUTES">Synchronization on an object initialized with a literal</problem_class>
<description>Synchronization on Character &lt;code&gt;c&lt;/code&gt; which is initialized by a literal #loc</description>
</problem>
</problems>
@@ -1,10 +1,36 @@
/*
* Copyright 2000-2017 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.threading;
import com.siyeh.ig.IGInspectionTestCase;
import com.intellij.codeInspection.InspectionProfileEntry;
import com.siyeh.ig.LightInspectionTestCase;
import org.jetbrains.annotations.Nullable;
public class SynchronizedOnLiteralObjectInspectionTest extends IGInspectionTestCase {
/**
* @author Bas
*/
public class SynchronizedOnLiteralObjectInspectionTest extends LightInspectionTestCase {
public void test() throws Exception {
doTest("com/siyeh/igtest/threading/synchronized_on_literal_object", new SynchronizedOnLiteralObjectInspection());
public void testSynchronizedOnLiteralObject() {
doTest();
}
@Nullable
@Override
protected InspectionProfileEntry getInspection() {
return new SynchronizedOnLiteralObjectInspection();
}
}