summaryrefslogtreecommitdiff
path: root/plugins/InspectionGadgets/test/com/siyeh/igtest
diff options
context:
space:
mode:
authorTor Norbye <tnorbye@google.com>2014-03-06 17:27:18 -0800
committerTor Norbye <tnorbye@google.com>2014-03-06 17:30:32 -0800
commit814f829cd44c28c7045e08b15bd7ee08890cbd80 (patch)
tree1c108337a1607788da5f8b6deb061558401d095d /plugins/InspectionGadgets/test/com/siyeh/igtest
parentb557fdbb754e1d9f6b222ecb426785beb112db04 (diff)
downloadidea-814f829cd44c28c7045e08b15bd7ee08890cbd80.tar.gz
Merge idea133 into master
This CL merges the following CLs from aosp/idea133 into aosp/master. dabd634b Snapshot e2750ea61032f2a041cb012bb7b90cffa0deba73 from idea/133.124 of git://git.jetbrains.org/idea/community.git 29ab773f Make default test target run Android specific tests 967117a7 Merge "Make default test target run Android specific tests" into idea133 1eb71f20 Bump memory settings for unit tests b13ea0d4 Don't bind the delete key to restoring property in layout editor a20ccfa9 Add Gradle import module 0980f4a2 Add gradle-import to build script cee6f8ca Fix Gradle notification lookup on Windows. 8668e1be Snapshot 020d29497847701e84e383d965abf543b80758e2 from idea/133.370 of git://git.jetbrains.org/idea/community.git 18f77669 Merge remote-tracking branch 'aosp/snapshot-master' into merge 36ac8cba Update from Guava 13.0.1 to Guava 15 4d451f93 Update libraries to lombok 0.2.2 ee06b1d0 Remove lint-cli dependency from the idea project ab73dade Updater: add unit tests. dd558b6e Updater: on Windows, add "Retry" on file op failures. f2f7178a Snapshot c11f3ac9bbde3f85d1f837ec3eb48a395ed7dd10 from idea/133.471 of git://git.jetbrains.org/idea/community.git 5e4c77db Merge remote-tracking branch 'aosp/snapshot-master' into merge 8d957349 Fix junit.jar path in updater project. 58c3e0ae Include cloud tools tests in default test group 63cd9779 Temporarily disable errors in project structure dialog e2d6089d Snapshot b9931c55d2175b6552f90b2225eb09c13bd6dfed from idea/133.609 of git://git.jetbrains.org/idea/community.git 031a291e Merge remote-tracking branch 'aosp/snapshot-master' into merge ea628d6e Remove versions from Info.plist 809cb3e7 Snapshot 9e6329d622cc9649c9c035f28faddc29564a5b7a from idea/133.696 of git://git.jetbrains.org/idea/community.git d6cfe6ec Merge remote-tracking branch 'aosp/snapshot-master' into merge 38f8c6f0 Gracefully handle build.gradle files in modules without a configured JDK 70ae6f2a Snapshot dc1944e804515a346297e368c3b9c35a203c9912 from idea/133.818 of git://git.jetbrains.org/idea/community.git ac91a6de Merge remote-tracking branch 'aosp/snapshot-master' into merge 2f51d957 Gradle: respect build classpath order and use both classes and sources jars if available 0ecdb509 Snapshot c50a8ad26a72432f26e39046d6a6f21fd7a190ee from idea/134.1160 of git://git.jetbrains.org/idea/community.git e8c22ad7 Merge remote-tracking branch 'aosp/snapshot-master' into merge 72253f7d Turn off android framework detection 93f77ee6 Temporarily remove GCT tests 88f318c9 Snapshot 34f078c3452e79ba209d28a551962857e0970e5d from idea/134.1342 of git://git.jetbrains.org/idea/community.git afb54e4b Merge remote-tracking branch 'aosp/snapshot-master' into merge 4dc795dc Fix updater UI tests. 57a49ed1 Studio patch: more logging. aa614ee0 table greyer (ability to disable a table) 5c571417 Use Gradle model prebuilts v0.9.0 in Studio. cb38c25d build script: Run jarjar on the updater f273ca07 Add App Engine templates dir to build 7607404f Removed android-builder library from Studio (not needed.) 8f29b4eb Merge idea133 changes into master Change-Id: I12231f26e886dbf5e2e5ac0b1c4bfe18f274d78f
Diffstat (limited to 'plugins/InspectionGadgets/test/com/siyeh/igtest')
-rw-r--r--plugins/InspectionGadgets/test/com/siyeh/igtest/abstraction/ParameterOfConcreteClassInspection.java24
-rw-r--r--plugins/InspectionGadgets/test/com/siyeh/igtest/abstraction/declare_collection_as_interface/DeclareCollectionAsInterface.java (renamed from plugins/InspectionGadgets/test/com/siyeh/igtest/abstraction/declare_collection_as_interface/DeclareCollectionsAsInterfaceInspection.java)12
-rw-r--r--plugins/InspectionGadgets/test/com/siyeh/igtest/abstraction/declare_collection_as_interface/expected.xml24
-rw-r--r--plugins/InspectionGadgets/test/com/siyeh/igtest/abstraction/magic_number/MagicNumber.java16
-rw-r--r--plugins/InspectionGadgets/test/com/siyeh/igtest/abstraction/magic_number/expected.xml16
-rw-r--r--plugins/InspectionGadgets/test/com/siyeh/igtest/abstraction/weaken_type/TypeMayBeWeakened.java30
-rw-r--r--plugins/InspectionGadgets/test/com/siyeh/igtest/abstraction/weaken_type/expected.xml7
-rw-r--r--plugins/InspectionGadgets/test/com/siyeh/igtest/bugs/DuplicateCondition.java8
-rw-r--r--plugins/InspectionGadgets/test/com/siyeh/igtest/bugs/EqualsBetweenInconvertibleTypesInspection.java11
-rw-r--r--plugins/InspectionGadgets/test/com/siyeh/igtest/bugs/StaticCallOnSubclass.java17
-rw-r--r--plugins/InspectionGadgets/test/com/siyeh/igtest/bugs/array_equality/ArrayEquality.java10
-rw-r--r--plugins/InspectionGadgets/test/com/siyeh/igtest/bugs/mismatched_array_read_write/MismatchedArrayReadWrite.java62
-rw-r--r--plugins/InspectionGadgets/test/com/siyeh/igtest/bugs/mismatched_array_read_write/expected.xml8
-rw-r--r--plugins/InspectionGadgets/test/com/siyeh/igtest/bugs/number_equality/NumberEquality.java10
-rw-r--r--plugins/InspectionGadgets/test/com/siyeh/igtest/bugs/suspicious_array_cast/SuspiciousArrayCast.java6
-rw-r--r--plugins/InspectionGadgets/test/com/siyeh/igtest/bugs/variable_not_used_inside_if/VariableNotUsedInsideIf.java5
-rw-r--r--plugins/InspectionGadgets/test/com/siyeh/igtest/bugs/variable_not_used_inside_if/expected.xml8
-rw-r--r--plugins/InspectionGadgets/test/com/siyeh/igtest/classlayout/ClassInitializerInspection.java13
-rw-r--r--plugins/InspectionGadgets/test/com/siyeh/igtest/classlayout/class_initializer/Anonymous.java15
-rw-r--r--plugins/InspectionGadgets/test/com/siyeh/igtest/classlayout/class_initializer/NoConstructor.java3
-rw-r--r--plugins/InspectionGadgets/test/com/siyeh/igtest/classlayout/class_initializer/Simple.java8
-rw-r--r--plugins/InspectionGadgets/test/com/siyeh/igtest/classlayout/final_method_in_final_class/FinalMethodInFinalClass.java9
-rw-r--r--plugins/InspectionGadgets/test/com/siyeh/igtest/classlayout/final_method_in_final_class/expected.xml7
-rw-r--r--plugins/InspectionGadgets/test/com/siyeh/igtest/classlayout/noop_method_in_abstract_class/NoopMethodInAbstractClass.java2
-rw-r--r--plugins/InspectionGadgets/test/com/siyeh/igtest/cloneable/clone_calls_constructors/CloneCallsConstructors.java9
-rw-r--r--plugins/InspectionGadgets/test/com/siyeh/igtest/dependency/cyclic_class_dependency/expected.xml44
-rw-r--r--plugins/InspectionGadgets/test/com/siyeh/igtest/dependency/cyclic_class_dependency/src/Cyclic.java29
-rw-r--r--plugins/InspectionGadgets/test/com/siyeh/igtest/dependency/cyclic_package_dependency/expected.xml16
-rw-r--r--plugins/InspectionGadgets/test/com/siyeh/igtest/dependency/cyclic_package_dependency/src/a/Independent.java11
-rw-r--r--plugins/InspectionGadgets/test/com/siyeh/igtest/dependency/cyclic_package_dependency/src/a/a/A.java4
-rw-r--r--plugins/InspectionGadgets/test/com/siyeh/igtest/dependency/cyclic_package_dependency/src/b/Cycle1.java30
-rw-r--r--plugins/InspectionGadgets/test/com/siyeh/igtest/dependency/cyclic_package_dependency/src/c/Cycle2.java30
-rw-r--r--plugins/InspectionGadgets/test/com/siyeh/igtest/errorhandling/error_rethrown/ErrorRethrown.java30
-rw-r--r--plugins/InspectionGadgets/test/com/siyeh/igtest/errorhandling/error_rethrown/expected.xml16
-rw-r--r--plugins/InspectionGadgets/test/com/siyeh/igtest/exceptionHandling/ErrorRethrownInspection.java44
-rw-r--r--plugins/InspectionGadgets/test/com/siyeh/igtest/exceptionHandling/ThreadDeathRethrownInspection.java26
-rw-r--r--plugins/InspectionGadgets/test/com/siyeh/igtest/inheritance/extends_concrete_collection/ExtendsConcreteCollection.java17
-rw-r--r--plugins/InspectionGadgets/test/com/siyeh/igtest/inheritance/redundant_method_override/RedundantMethodOverride.java31
-rw-r--r--plugins/InspectionGadgets/test/com/siyeh/igtest/initialization/Base.java8
-rw-r--r--plugins/InspectionGadgets/test/com/siyeh/igtest/initialization/OverriddenMethodCallInConstructor.java8
-rw-r--r--plugins/InspectionGadgets/test/com/siyeh/igtest/initialization/Overrider.java8
-rw-r--r--plugins/InspectionGadgets/test/com/siyeh/igtest/initialization/overridden_method_call_during_object_construction/OverriddenMethodCallDuringObjectConstruction.java36
-rw-r--r--plugins/InspectionGadgets/test/com/siyeh/igtest/internationalization/implicit_default_charset_usage/ImplicitDefaultCharsetUsage.java40
-rw-r--r--plugins/InspectionGadgets/test/com/siyeh/igtest/internationalization/simple_date_format_without_locale/SimpleDateFormatWithoutLocale.java12
-rw-r--r--plugins/InspectionGadgets/test/com/siyeh/igtest/internationalization/unnecessary_unicode_escape/UnnecessaryUnicodeEscape.java4
-rw-r--r--plugins/InspectionGadgets/test/com/siyeh/igtest/j2me/PrivateMemberAccessBetweenOuterAndInnerClass.java16
-rw-r--r--plugins/InspectionGadgets/test/com/siyeh/igtest/j2me/private_member_access_between_outer_and_inner_class/PrivateMemberAccessBetweenOuterAndInnerClass.java14
-rw-r--r--plugins/InspectionGadgets/test/com/siyeh/igtest/j2me/private_member_access_between_outer_and_inner_class/Simple.java21
-rw-r--r--plugins/InspectionGadgets/test/com/siyeh/igtest/junit/misordered_assert_equals_parameters/Simple.java16
-rw-r--r--plugins/InspectionGadgets/test/com/siyeh/igtest/junit/use_of_obsolete_assert/ObsoleteAssert.java8
-rw-r--r--plugins/InspectionGadgets/test/com/siyeh/igtest/migration/method_can_be_variable_arity_method/MethodCanBeVariableArity.java8
-rw-r--r--plugins/InspectionGadgets/test/com/siyeh/igtest/migration/method_can_be_variable_arity_method/expected.xml7
-rw-r--r--plugins/InspectionGadgets/test/com/siyeh/igtest/migration/unnecessary_unboxing/UnnecessaryUnboxing.java4
-rw-r--r--plugins/InspectionGadgets/test/com/siyeh/igtest/naming/abstract_class_naming_convention/Simple.java4
-rw-r--r--plugins/InspectionGadgets/test/com/siyeh/igtest/numeric/pointless_arithmetic_expression/PointlessArithmeticExpression.java22
-rw-r--r--plugins/InspectionGadgets/test/com/siyeh/igtest/numeric/pointless_arithmetic_expression/expected.xml27
-rw-r--r--plugins/InspectionGadgets/test/com/siyeh/igtest/numeric/unnecessary_explicit_numeric_cast/UnnecessaryExplicitNumericCast.java14
-rw-r--r--plugins/InspectionGadgets/test/com/siyeh/igtest/numeric/unnecessary_explicit_numeric_cast/expected.xml7
-rw-r--r--plugins/InspectionGadgets/test/com/siyeh/igtest/packaging/disjoint_package/expected.xml4
-rw-r--r--plugins/InspectionGadgets/test/com/siyeh/igtest/packaging/disjoint_package/extends_implements_reference/Ferrari.java11
-rw-r--r--plugins/InspectionGadgets/test/com/siyeh/igtest/performance/CollectionsMustHaveInitialCapacityInspection.java40
-rw-r--r--plugins/InspectionGadgets/test/com/siyeh/igtest/performance/StringBufferMustHaveInitialCapacityInspection.java21
-rw-r--r--plugins/InspectionGadgets/test/com/siyeh/igtest/performance/boolean_constructor/expected.xml4
-rw-r--r--plugins/InspectionGadgets/test/com/siyeh/igtest/performance/inner_class_may_be_static/InnerClassMayBeStaticInspection.java42
-rw-r--r--plugins/InspectionGadgets/test/com/siyeh/igtest/performance/inner_class_may_be_static/expected.xml47
-rw-r--r--plugins/InspectionGadgets/test/com/siyeh/igtest/performance/method_may_be_static/A.java6
-rw-r--r--plugins/InspectionGadgets/test/com/siyeh/igtest/performance/method_may_be_static/expected.xml6
-rw-r--r--plugins/InspectionGadgets/test/com/siyeh/igtest/performance/object_allocation_in_loop/ObjectAllocationInLoop.java10
-rw-r--r--plugins/InspectionGadgets/test/com/siyeh/igtest/performance/string_buffer_must_have_initial_capacity/StringBufferMustHaveInitialCapacity.java13
-rw-r--r--plugins/InspectionGadgets/test/com/siyeh/igtest/security/ArchaicSystemPropertiesAccessInspection.java10
-rw-r--r--plugins/InspectionGadgets/test/com/siyeh/igtest/style/unnecessarily_qualified_statically_imported_element/methodRef/expected.xml2
-rw-r--r--plugins/InspectionGadgets/test/com/siyeh/igtest/style/unnecessarily_qualified_statically_imported_element/methodRef/src/Test.java8
-rw-r--r--plugins/InspectionGadgets/test/com/siyeh/igtest/style/unnecessary_parentheses/UnnecessaryParenthesesInspection.java8
-rw-r--r--plugins/InspectionGadgets/test/com/siyeh/igtest/style/unnecessary_tostring/UnnecessaryToString.java11
-rw-r--r--plugins/InspectionGadgets/test/com/siyeh/igtest/style/unqualified_inner_class_access/Test.java7
-rw-r--r--plugins/InspectionGadgets/test/com/siyeh/igtest/style/unqualified_inner_class_access/expected.xml6
-rw-r--r--plugins/InspectionGadgets/test/com/siyeh/igtest/threading/defaultRun/LambdaExpr.java6
-rw-r--r--plugins/InspectionGadgets/test/com/siyeh/igtest/threading/defaultRun/expected.xml1
-rw-r--r--plugins/InspectionGadgets/test/com/siyeh/igtest/visibility/TypeParameterHidesVisibleTypeInspection.java13
79 files changed, 929 insertions, 299 deletions
diff --git a/plugins/InspectionGadgets/test/com/siyeh/igtest/abstraction/ParameterOfConcreteClassInspection.java b/plugins/InspectionGadgets/test/com/siyeh/igtest/abstraction/ParameterOfConcreteClassInspection.java
deleted file mode 100644
index aef80ccc2eb5..000000000000
--- a/plugins/InspectionGadgets/test/com/siyeh/igtest/abstraction/ParameterOfConcreteClassInspection.java
+++ /dev/null
@@ -1,24 +0,0 @@
-package com.siyeh.igtest.abstraction;
-
-import com.siyeh.igtest.classlayout.AbstractClass;
-import com.siyeh.igtest.classlayout.ConstantInterface;
-
-public class ParameterOfConcreteClassInspection
-{
-
-
- private Object foo(Object bar)
- {
- return null;
- }
-
- private static AbstractClass barangus(AbstractClass baz)
- {
- return null;
- }
-
- private static ConstantInterface barangus(ConstantInterface baz)
- {
- return null;
- }
-}
diff --git a/plugins/InspectionGadgets/test/com/siyeh/igtest/abstraction/declare_collection_as_interface/DeclareCollectionsAsInterfaceInspection.java b/plugins/InspectionGadgets/test/com/siyeh/igtest/abstraction/declare_collection_as_interface/DeclareCollectionAsInterface.java
index 23329c6d42ac..1e04a2ab41c6 100644
--- a/plugins/InspectionGadgets/test/com/siyeh/igtest/abstraction/declare_collection_as_interface/DeclareCollectionsAsInterfaceInspection.java
+++ b/plugins/InspectionGadgets/test/com/siyeh/igtest/abstraction/declare_collection_as_interface/DeclareCollectionAsInterface.java
@@ -2,13 +2,13 @@ package com.siyeh.igtest.abstraction.declare_collection_as_interface;
import java.util.*;
-public class DeclareCollectionsAsInterfaceInspection
+public class DeclareCollectionAsInterface
{
private HashMap<String, String> m_mapThree = new HashMap<String, String>(2);
private HashMap m_setOne = new HashMap(2);
private Map m_setTwo = new HashMap(2);
- public DeclareCollectionsAsInterfaceInspection()
+ public DeclareCollectionAsInterface()
{
m_setOne.put("foo", "foo");
m_setTwo.put("bar", "bar");
@@ -47,4 +47,12 @@ public class DeclareCollectionsAsInterfaceInspection
HashMap theRoad() {
return null;
}
+
+ void makeItRight() {
+ ArrayList list22 = new ArrayList();
+ System.out.println(list22.get(0));
+
+ ArrayList<String> list33 = new ArrayList();
+ System.out.println(list33.get(0));
+ }
}
diff --git a/plugins/InspectionGadgets/test/com/siyeh/igtest/abstraction/declare_collection_as_interface/expected.xml b/plugins/InspectionGadgets/test/com/siyeh/igtest/abstraction/declare_collection_as_interface/expected.xml
index 40b14989373a..8c108ed1ef1a 100644
--- a/plugins/InspectionGadgets/test/com/siyeh/igtest/abstraction/declare_collection_as_interface/expected.xml
+++ b/plugins/InspectionGadgets/test/com/siyeh/igtest/abstraction/declare_collection_as_interface/expected.xml
@@ -2,37 +2,51 @@
<problems>
<problem>
- <file>DeclareCollectionsAsInterfaceInspection.java</file>
+ <file>DeclareCollectionAsInterface.java</file>
<line>8</line>
<problem_class severity="WARNING" attribute_key="WARNING_ATTRIBUTES">Collection declared by class, not interface</problem_class>
<description>Declaration of &lt;code&gt;HashMap&lt;/code&gt; should probably be weakened to 'java.util.Map' #loc</description>
</problem>
<problem>
- <file>DeclareCollectionsAsInterfaceInspection.java</file>
+ <file>DeclareCollectionAsInterface.java</file>
<line>25</line>
<problem_class severity="WARNING" attribute_key="WARNING_ATTRIBUTES">Collection declared by class, not interface</problem_class>
<description>Declaration of &lt;code&gt;HashMap&lt;/code&gt; should probably be weakened to 'java.util.Map' #loc</description>
</problem>
<problem>
- <file>DeclareCollectionsAsInterfaceInspection.java</file>
+ <file>DeclareCollectionAsInterface.java</file>
<line>19</line>
<problem_class severity="WARNING" attribute_key="WARNING_ATTRIBUTES">Collection declared by class, not interface</problem_class>
<description>Declaration of &lt;code&gt;HashMap&lt;/code&gt; should probably be weakened to 'java.util.Map' #loc</description>
</problem>
<problem>
- <file>DeclareCollectionsAsInterfaceInspection.java</file>
+ <file>DeclareCollectionAsInterface.java</file>
<line>37</line>
<problem_class severity="WARNING" attribute_key="WARNING_ATTRIBUTES">Collection declared by class, not interface</problem_class>
<description>Declaration of &lt;code&gt;HashMap&lt;/code&gt; should probably be weakened to 'java.util.Map' #loc</description>
</problem>
<problem>
- <file>DeclareCollectionsAsInterfaceInspection.java</file>
+ <file>DeclareCollectionAsInterface.java</file>
<line>47</line>
<problem_class severity="WARNING" attribute_key="WARNING_ATTRIBUTES">Collection declared by class, not interface</problem_class>
<description>Declaration of &lt;code&gt;HashMap&lt;/code&gt; should probably be weakened to 'java.util.Map' #loc</description>
</problem>
+
+ <problem>
+ <file>DeclareCollectionAsInterface.java</file>
+ <line>52</line>
+ <problem_class severity="WARNING" attribute_key="WARNING_ATTRIBUTES">Collection declared by class, not interface</problem_class>
+ <description>Declaration of &lt;code&gt;ArrayList&lt;/code&gt; should probably be weakened to 'java.util.List' #loc</description>
+ </problem>
+
+ <problem>
+ <file>DeclareCollectionAsInterface.java</file>
+ <line>55</line>
+ <problem_class severity="WARNING" attribute_key="WARNING_ATTRIBUTES">Collection declared by class, not interface</problem_class>
+ <description>Declaration of &lt;code&gt;ArrayList&lt;/code&gt; should probably be weakened to 'java.util.List' #loc</description>
+ </problem>
</problems> \ No newline at end of file
diff --git a/plugins/InspectionGadgets/test/com/siyeh/igtest/abstraction/magic_number/MagicNumber.java b/plugins/InspectionGadgets/test/com/siyeh/igtest/abstraction/magic_number/MagicNumber.java
index 77fda329900e..c8733dacc3e0 100644
--- a/plugins/InspectionGadgets/test/com/siyeh/igtest/abstraction/magic_number/MagicNumber.java
+++ b/plugins/InspectionGadgets/test/com/siyeh/igtest/abstraction/magic_number/MagicNumber.java
@@ -1,20 +1,20 @@
package com.siyeh.igtest.abstraction.magic_number;
-import java.util.Set;
-import java.util.HashSet;
+import java.util.List;
+import java.util.ArrayList;
@Size(max = 15)
public class MagicNumber
{
private static final int s_foo = 400;
- private int m_foo = 400;
+ private int m_foo = -400;
private static int s_foo2 = 400;
- private final int m_foo2 = 400;
- private static final Set s_set = new HashSet(400);
+ private final int m_foo2 = -(-(400));
+ private static final List s_set = new ArrayList(400);
public static void main(String[] args)
{
- final Set set = new HashSet(400);
+ final List set = new ArrayList(400);
set.toString();
}
@@ -36,6 +36,10 @@ public class MagicNumber
result = 29 * result + m_foo2;
return result;
}
+
+ void foo() {
+ final int value = 101 * 55;
+ }
}
@interface Size {
int max();
diff --git a/plugins/InspectionGadgets/test/com/siyeh/igtest/abstraction/magic_number/expected.xml b/plugins/InspectionGadgets/test/com/siyeh/igtest/abstraction/magic_number/expected.xml
index fc8efb569919..acfeb033aeeb 100644
--- a/plugins/InspectionGadgets/test/com/siyeh/igtest/abstraction/magic_number/expected.xml
+++ b/plugins/InspectionGadgets/test/com/siyeh/igtest/abstraction/magic_number/expected.xml
@@ -4,27 +4,27 @@
<file>MagicNumber.java</file>
<line>10</line>
<problem_class severity="WARNING" attribute_key="WARNING_ATTRIBUTES">&quot;Magic number&quot;</problem_class>
- <description>Magic number &lt;code&gt;400&lt;/code&gt; #loc</description>
+ <description>Magic number &lt;code&gt;-400&lt;/code&gt; #loc</description>
</problem>
<problem>
<file>MagicNumber.java</file>
- <line>17</line>
+ <line>11</line>
<problem_class severity="WARNING" attribute_key="WARNING_ATTRIBUTES">&quot;Magic number&quot;</problem_class>
<description>Magic number &lt;code&gt;400&lt;/code&gt; #loc</description>
</problem>
<problem>
<file>MagicNumber.java</file>
- <line>12</line>
- <problem_class severity="WARNING" attribute_key="WARNING_ATTRIBUTES">&quot;Magic number&quot;</problem_class>
- <description>Magic number &lt;code&gt;400&lt;/code&gt; #loc</description>
+ <line>41</line>
+ <problem_class severity="WARNING" attribute_key="WARNING_ATTRIBUTES">Magic number</problem_class>
+ <description>Magic number &lt;code&gt;101&lt;/code&gt; #loc</description>
</problem>
<problem>
<file>MagicNumber.java</file>
- <line>11</line>
- <problem_class severity="WARNING" attribute_key="WARNING_ATTRIBUTES">&quot;Magic number&quot;</problem_class>
- <description>Magic number &lt;code&gt;400&lt;/code&gt; #loc</description>
+ <line>41</line>
+ <problem_class severity="WARNING" attribute_key="WARNING_ATTRIBUTES">Magic number</problem_class>
+ <description>Magic number &lt;code&gt;55&lt;/code&gt; #loc</description>
</problem>
</problems> \ No newline at end of file
diff --git a/plugins/InspectionGadgets/test/com/siyeh/igtest/abstraction/weaken_type/TypeMayBeWeakened.java b/plugins/InspectionGadgets/test/com/siyeh/igtest/abstraction/weaken_type/TypeMayBeWeakened.java
index 74b93d69d4be..aeb2e1a5f811 100644
--- a/plugins/InspectionGadgets/test/com/siyeh/igtest/abstraction/weaken_type/TypeMayBeWeakened.java
+++ b/plugins/InspectionGadgets/test/com/siyeh/igtest/abstraction/weaken_type/TypeMayBeWeakened.java
@@ -120,4 +120,34 @@ public class TypeMayBeWeakened {
Integer simpleConditional(Boolean condition, Integer value1, Integer value2) {
return condition ? value1 : value2;
}
+
+ private static <T, V extends T> java.util.concurrent.atomic.AtomicReference<T> nullSafeReference(java.util.concurrent.atomic.AtomicReference<T> ref, V value) {
+ if (ref != null) ref.set(value);
+ return ref;
+ }
+}
+class MyClass {
+
+ public MyClass(java.util.Date date, String[] classNames) {}
+
+ static MyClass readMyClass(final ObjectInputStream objectInput) {
+ final long time = objectInput.readLong();
+ final int size = objectInput.readInt();
+ final String[] classNames = new String[size];
+ for (int i = 0; i < size; i++) {
+ classNames[i] = objectInput.readUTF();
+ }
+ return new MyClass(new java.util.Date(time), classNames);
+ }
+}
+interface DataInput {
+ long readLong();
+ int readInt();
+ String readUTF();
+}
+abstract class ObjectInputStream implements DataInput {
+
+ public String readUTF() {
+ return null;
+ }
} \ No newline at end of file
diff --git a/plugins/InspectionGadgets/test/com/siyeh/igtest/abstraction/weaken_type/expected.xml b/plugins/InspectionGadgets/test/com/siyeh/igtest/abstraction/weaken_type/expected.xml
index 599595a7163a..577f33646869 100644
--- a/plugins/InspectionGadgets/test/com/siyeh/igtest/abstraction/weaken_type/expected.xml
+++ b/plugins/InspectionGadgets/test/com/siyeh/igtest/abstraction/weaken_type/expected.xml
@@ -23,6 +23,13 @@
</problem>
<problem>
+ <file>TypeMayBeWeakened.java</file>
+ <line>133</line>
+ <problem_class severity="WARNING" attribute_key="WARNING_ATTRIBUTES">Type may be weakened</problem_class>
+ <description>Type of parameter &lt;code&gt;objectInput&lt;/code&gt; may be weakened to 'com.siyeh.igtest.abstraction.weaken_type.DataInput' #loc</description>
+ </problem>
+
+ <problem>
<file>AutoClosableTest.java</file>
<line>34</line>
<problem_class severity="WARNING" attribute_key="WARNING_ATTRIBUTES">Type may be weakened</problem_class>
diff --git a/plugins/InspectionGadgets/test/com/siyeh/igtest/bugs/DuplicateCondition.java b/plugins/InspectionGadgets/test/com/siyeh/igtest/bugs/DuplicateCondition.java
index ef41c37869bd..aad58b54108e 100644
--- a/plugins/InspectionGadgets/test/com/siyeh/igtest/bugs/DuplicateCondition.java
+++ b/plugins/InspectionGadgets/test/com/siyeh/igtest/bugs/DuplicateCondition.java
@@ -16,4 +16,12 @@ public class DuplicateCondition {
{
return true;
}
+
+ void incompleteCode(String s) {
+ if (s.contains(A)) {
+
+ } else if (s.contains(B)) {
+
+ }
+ }
}
diff --git a/plugins/InspectionGadgets/test/com/siyeh/igtest/bugs/EqualsBetweenInconvertibleTypesInspection.java b/plugins/InspectionGadgets/test/com/siyeh/igtest/bugs/EqualsBetweenInconvertibleTypesInspection.java
deleted file mode 100644
index 5a99f5bbd026..000000000000
--- a/plugins/InspectionGadgets/test/com/siyeh/igtest/bugs/EqualsBetweenInconvertibleTypesInspection.java
+++ /dev/null
@@ -1,11 +0,0 @@
-package com.siyeh.igtest.bugs;
-
-public class EqualsBetweenInconvertibleTypesInspection {
-
- public void foo()
- {
- final Integer foo = new Integer(3);
- final Double bar = new Double(3);
- foo.equals(bar);
- }
-}
diff --git a/plugins/InspectionGadgets/test/com/siyeh/igtest/bugs/StaticCallOnSubclass.java b/plugins/InspectionGadgets/test/com/siyeh/igtest/bugs/StaticCallOnSubclass.java
deleted file mode 100644
index 55dfea251b93..000000000000
--- a/plugins/InspectionGadgets/test/com/siyeh/igtest/bugs/StaticCallOnSubclass.java
+++ /dev/null
@@ -1,17 +0,0 @@
-package com.siyeh.igtest.bugs;
-
-import com.siyeh.igtest.abstraction.StaticCallOnSubclassChild;
-
-public class StaticCallOnSubclass {
-
- public void foo() throws InterruptedException {
- Thread.sleep(1000L);
- InnerThread.sleep(1000L, 1000);
- final int priority = InnerThread.MAX_PRIORITY;
- StaticCallOnSubclassChild.foo();
- }
-
- class InnerThread extends Thread
- {
- }
-}
diff --git a/plugins/InspectionGadgets/test/com/siyeh/igtest/bugs/array_equality/ArrayEquality.java b/plugins/InspectionGadgets/test/com/siyeh/igtest/bugs/array_equality/ArrayEquality.java
new file mode 100644
index 000000000000..02efd15c143e
--- /dev/null
+++ b/plugins/InspectionGadgets/test/com/siyeh/igtest/bugs/array_equality/ArrayEquality.java
@@ -0,0 +1,10 @@
+class ArrayEquality {
+
+ boolean a(String[] a, String[] b) {
+ return a <warning descr="Array objects are compared using '==', not 'Arrays.equals()'">==</warning> b;
+ }
+
+ boolean b(Number[] n) {
+ return n == null;
+ }
+} \ No newline at end of file
diff --git a/plugins/InspectionGadgets/test/com/siyeh/igtest/bugs/mismatched_array_read_write/MismatchedArrayReadWrite.java b/plugins/InspectionGadgets/test/com/siyeh/igtest/bugs/mismatched_array_read_write/MismatchedArrayReadWrite.java
index 7594b6e91756..8175fcc730a4 100644
--- a/plugins/InspectionGadgets/test/com/siyeh/igtest/bugs/mismatched_array_read_write/MismatchedArrayReadWrite.java
+++ b/plugins/InspectionGadgets/test/com/siyeh/igtest/bugs/mismatched_array_read_write/MismatchedArrayReadWrite.java
@@ -117,3 +117,65 @@ class Test{
return null;
}
}
+class Bug {
+ // Example 1
+ public void test1() {
+ final java.util.List<long[]> results = new java.util.ArrayList<>();
+ for (int i = 0; i < 10; i++) {
+ results.add(new long[3]);
+ }
+
+ for (int i = 0; i < results.size(); i++) {
+ final long[] longs = results.get(i); // <-- Contents of array 'longs' are written to, but never read
+ for (int j = 0; j < 3; j++) {
+ longs[j] = i * j;
+ }
+ }
+
+ for (long[] result : results) {
+ for (long l : result) {
+ System.out.println(l);
+ }
+ }
+ }
+
+ // Example 2
+ private int[] _ints = {0};
+
+ public void print() {
+ for (int i : _ints) {
+ System.out.println(i);
+ }
+ }
+
+ public void test2() {
+ final Bug bug = new Bug();
+ final int[] ints = bug._ints; // <-- Contents of array 'ints' are written to, but never read
+ ints[0] = 1;
+ bug.print();
+ }
+}
+class Toster
+{
+ private static final int MAX = 1;
+
+ public static void main(String[] args)
+ {
+ new Toster().run();
+ }
+
+ private int[][] values = new int[][] { {new java.util.Random().nextInt()}, {new java.util.Random().nextInt()} };
+
+ private void run()
+ {
+ for (int j = new java.util.Random().nextInt(values.length); j < new java.util.Random().nextInt(values.length); j++)
+ {
+ int[] array = values[j]; //IDEA says here: contents of array 'array' are written to, but never used
+
+ for (int i = 0; i < MAX; i++)
+ {
+ array[i] = new java.util.Random().nextInt();
+ }
+ }
+ }
+} \ No newline at end of file
diff --git a/plugins/InspectionGadgets/test/com/siyeh/igtest/bugs/mismatched_array_read_write/expected.xml b/plugins/InspectionGadgets/test/com/siyeh/igtest/bugs/mismatched_array_read_write/expected.xml
index c1b9fc0fdffa..9acc1e37c320 100644
--- a/plugins/InspectionGadgets/test/com/siyeh/igtest/bugs/mismatched_array_read_write/expected.xml
+++ b/plugins/InspectionGadgets/test/com/siyeh/igtest/bugs/mismatched_array_read_write/expected.xml
@@ -63,12 +63,4 @@
<description>Contents of array &lt;code&gt;barzoom&lt;/code&gt; are written to, but never read #loc</description>
</problem>
- <problem>
- <file>MismatchedArrayReadWrite.java</file>
- <line>61</line>
- <problem_class severity="WARNING" attribute_key="WARNING_ATTRIBUTES">Mismatched read and write of array</problem_class>
- <description>Contents of array &lt;code&gt;rowData&lt;/code&gt; are written to, but never read #loc</description>
- </problem>
-
-
</problems> \ No newline at end of file
diff --git a/plugins/InspectionGadgets/test/com/siyeh/igtest/bugs/number_equality/NumberEquality.java b/plugins/InspectionGadgets/test/com/siyeh/igtest/bugs/number_equality/NumberEquality.java
new file mode 100644
index 000000000000..45ed54a480dc
--- /dev/null
+++ b/plugins/InspectionGadgets/test/com/siyeh/igtest/bugs/number_equality/NumberEquality.java
@@ -0,0 +1,10 @@
+class NumberEquality {
+
+ boolean f(Integer i, Integer j) {
+ return i <warning descr="Number objects are compared using '==', not 'equals()'">==</warning> j;
+ }
+
+ boolean g(Integer i) {
+ return i == null;
+ }
+} \ No newline at end of file
diff --git a/plugins/InspectionGadgets/test/com/siyeh/igtest/bugs/suspicious_array_cast/SuspiciousArrayCast.java b/plugins/InspectionGadgets/test/com/siyeh/igtest/bugs/suspicious_array_cast/SuspiciousArrayCast.java
index 6eb91bd28a3d..e55bd7b3951c 100644
--- a/plugins/InspectionGadgets/test/com/siyeh/igtest/bugs/suspicious_array_cast/SuspiciousArrayCast.java
+++ b/plugins/InspectionGadgets/test/com/siyeh/igtest/bugs/suspicious_array_cast/SuspiciousArrayCast.java
@@ -8,4 +8,10 @@ class SuspiciousArrayCast {
private Number[] getNumbers() {
return new Number[]{1L, 2L, 4L};
}
+
+ void f() {
+ java.util.List ssList = new java.util.LinkedList();
+ ssList.add("a");
+ String[] sArray = (String[]) ssList.toArray(new String[ssList.size()]);
+ }
} \ No newline at end of file
diff --git a/plugins/InspectionGadgets/test/com/siyeh/igtest/bugs/variable_not_used_inside_if/VariableNotUsedInsideIf.java b/plugins/InspectionGadgets/test/com/siyeh/igtest/bugs/variable_not_used_inside_if/VariableNotUsedInsideIf.java
index c6d13025555d..33925cea2eec 100644
--- a/plugins/InspectionGadgets/test/com/siyeh/igtest/bugs/variable_not_used_inside_if/VariableNotUsedInsideIf.java
+++ b/plugins/InspectionGadgets/test/com/siyeh/igtest/bugs/variable_not_used_inside_if/VariableNotUsedInsideIf.java
@@ -61,4 +61,9 @@ public class VariableNotUsedInsideIf {
private int someValue() {
return 0;
}
+
+ void perenthesis(String[] args)
+ {
+ String message = (args == null) ? "not null" : "null";
+ }
} \ No newline at end of file
diff --git a/plugins/InspectionGadgets/test/com/siyeh/igtest/bugs/variable_not_used_inside_if/expected.xml b/plugins/InspectionGadgets/test/com/siyeh/igtest/bugs/variable_not_used_inside_if/expected.xml
index 603a54209ebd..c3a2f7643220 100644
--- a/plugins/InspectionGadgets/test/com/siyeh/igtest/bugs/variable_not_used_inside_if/expected.xml
+++ b/plugins/InspectionGadgets/test/com/siyeh/igtest/bugs/variable_not_used_inside_if/expected.xml
@@ -41,4 +41,12 @@
<problem_class severity="WARNING" attribute_key="WARNING_ATTRIBUTES">Reference checked for 'null' is not used inside 'if'</problem_class>
<description>&lt;code&gt;x&lt;/code&gt; checked for 'null' is not used inside conditional #loc</description>
</problem>
+
+ <problem>
+ <file>VariableNotUsedInsideIf.java</file>
+ <line>67</line>
+ <problem_class severity="WARNING" attribute_key="WARNING_ATTRIBUTES">Reference checked for 'null' is not used inside 'if'</problem_class>
+ <description>&lt;code&gt;args&lt;/code&gt; checked for 'null' is not used inside conditional #loc</description>
+ </problem>
+
</problems> \ No newline at end of file
diff --git a/plugins/InspectionGadgets/test/com/siyeh/igtest/classlayout/ClassInitializerInspection.java b/plugins/InspectionGadgets/test/com/siyeh/igtest/classlayout/ClassInitializerInspection.java
deleted file mode 100644
index dff8a694cb27..000000000000
--- a/plugins/InspectionGadgets/test/com/siyeh/igtest/classlayout/ClassInitializerInspection.java
+++ /dev/null
@@ -1,13 +0,0 @@
-package com.siyeh.igtest.classlayout;
-
-public class ClassInitializerInspection {
- static private int foo;
-
- static {
- foo = 3;
- }
-
- {
- foo = 3;
- }
-}
diff --git a/plugins/InspectionGadgets/test/com/siyeh/igtest/classlayout/class_initializer/Anonymous.java b/plugins/InspectionGadgets/test/com/siyeh/igtest/classlayout/class_initializer/Anonymous.java
new file mode 100644
index 000000000000..943e3882c0c4
--- /dev/null
+++ b/plugins/InspectionGadgets/test/com/siyeh/igtest/classlayout/class_initializer/Anonymous.java
@@ -0,0 +1,15 @@
+package classlayout.class_initializer;
+
+class Anonymous {
+
+ void foo() {
+ new Object() {
+
+ int i;
+
+ {
+ i = 9;
+ }
+ };
+ }
+} \ No newline at end of file
diff --git a/plugins/InspectionGadgets/test/com/siyeh/igtest/classlayout/class_initializer/NoConstructor.java b/plugins/InspectionGadgets/test/com/siyeh/igtest/classlayout/class_initializer/NoConstructor.java
new file mode 100644
index 000000000000..d52b1c27f95b
--- /dev/null
+++ b/plugins/InspectionGadgets/test/com/siyeh/igtest/classlayout/class_initializer/NoConstructor.java
@@ -0,0 +1,3 @@
+package com.siyeh.igtest.classlayout.class_initializer;
+
+public class NoConstructor {{}} \ No newline at end of file
diff --git a/plugins/InspectionGadgets/test/com/siyeh/igtest/classlayout/class_initializer/Simple.java b/plugins/InspectionGadgets/test/com/siyeh/igtest/classlayout/class_initializer/Simple.java
new file mode 100644
index 000000000000..4f1e690cc71e
--- /dev/null
+++ b/plugins/InspectionGadgets/test/com/siyeh/igtest/classlayout/class_initializer/Simple.java
@@ -0,0 +1,8 @@
+package com.siyeh.igtest.classlayout.class_initializer;
+
+public class Simple {
+
+ <warning descr="Non-'static' initializer">{</warning>}
+
+ Simple() {}
+} \ No newline at end of file
diff --git a/plugins/InspectionGadgets/test/com/siyeh/igtest/classlayout/final_method_in_final_class/FinalMethodInFinalClass.java b/plugins/InspectionGadgets/test/com/siyeh/igtest/classlayout/final_method_in_final_class/FinalMethodInFinalClass.java
index db6845890dc9..f0bbb90a37f9 100644
--- a/plugins/InspectionGadgets/test/com/siyeh/igtest/classlayout/final_method_in_final_class/FinalMethodInFinalClass.java
+++ b/plugins/InspectionGadgets/test/com/siyeh/igtest/classlayout/final_method_in_final_class/FinalMethodInFinalClass.java
@@ -23,3 +23,12 @@ enum Fat {
public final void eatCarbohydrates() {}
}
+final class Soup {
+ @java.lang.SafeVarargs
+ private final void foo(java.util.Collection<String>... args) {
+ // ...
+ }
+
+ @java.lang.SafeVarargs
+ private static final void bar(java.util.Collection<Integer>... args) {}
+}
diff --git a/plugins/InspectionGadgets/test/com/siyeh/igtest/classlayout/final_method_in_final_class/expected.xml b/plugins/InspectionGadgets/test/com/siyeh/igtest/classlayout/final_method_in_final_class/expected.xml
index ab27c0a7baf7..ffba162b7995 100644
--- a/plugins/InspectionGadgets/test/com/siyeh/igtest/classlayout/final_method_in_final_class/expected.xml
+++ b/plugins/InspectionGadgets/test/com/siyeh/igtest/classlayout/final_method_in_final_class/expected.xml
@@ -7,5 +7,12 @@
<problem_class severity="WARNING" attribute_key="WARNING_ATTRIBUTES">'final' method in 'final' class</problem_class>
<description>Method declared &lt;code&gt;final&lt;/code&gt; in 'final' class #loc</description>
</problem>
+
+ <problem>
+ <file>FinalMethodInFinalClass.java</file>
+ <line>33</line>
+ <problem_class severity="WARNING" attribute_key="WARNING_ATTRIBUTES">'final' method in 'final' class</problem_class>
+ <description>Method declared &lt;code&gt;final&lt;/code&gt; in 'final' class #loc</description>
+ </problem>
</problems> \ No newline at end of file
diff --git a/plugins/InspectionGadgets/test/com/siyeh/igtest/classlayout/noop_method_in_abstract_class/NoopMethodInAbstractClass.java b/plugins/InspectionGadgets/test/com/siyeh/igtest/classlayout/noop_method_in_abstract_class/NoopMethodInAbstractClass.java
index 214152da741d..19d2adb6f91b 100644
--- a/plugins/InspectionGadgets/test/com/siyeh/igtest/classlayout/noop_method_in_abstract_class/NoopMethodInAbstractClass.java
+++ b/plugins/InspectionGadgets/test/com/siyeh/igtest/classlayout/noop_method_in_abstract_class/NoopMethodInAbstractClass.java
@@ -5,4 +5,6 @@ abstract class NoopMethodInAbstractClass {
void foo() {}
native int bar();
+
+ final void noop() {}
} \ No newline at end of file
diff --git a/plugins/InspectionGadgets/test/com/siyeh/igtest/cloneable/clone_calls_constructors/CloneCallsConstructors.java b/plugins/InspectionGadgets/test/com/siyeh/igtest/cloneable/clone_calls_constructors/CloneCallsConstructors.java
new file mode 100644
index 000000000000..84696ac60cbe
--- /dev/null
+++ b/plugins/InspectionGadgets/test/com/siyeh/igtest/cloneable/clone_calls_constructors/CloneCallsConstructors.java
@@ -0,0 +1,9 @@
+package com.siyeh.igtest.cloneable.clone_calls_constructors;
+
+class CloneCallsConstructors implements Cloneable {
+
+ @Override
+ protected Object clone() throws CloneNotSupportedException {
+ return new <warning descr="'clone()' creates new 'CloneCallsConstructors' instances">CloneCallsConstructors</warning>();
+ }
+} \ No newline at end of file
diff --git a/plugins/InspectionGadgets/test/com/siyeh/igtest/dependency/cyclic_class_dependency/expected.xml b/plugins/InspectionGadgets/test/com/siyeh/igtest/dependency/cyclic_class_dependency/expected.xml
new file mode 100644
index 000000000000..4e19f4850c1b
--- /dev/null
+++ b/plugins/InspectionGadgets/test/com/siyeh/igtest/dependency/cyclic_class_dependency/expected.xml
@@ -0,0 +1,44 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<problems>
+ <problem>
+ <file>Cyclic.java</file>
+ <line>9</line>
+ <problem_class severity="WARNING" attribute_key="WARNING_ATTRIBUTES">Cyclic class dependency</problem_class>
+ <description>Class 'anonymous (java.lang.Object)' is cyclically dependent on 3 other classes</description>
+ </problem>
+
+ <problem>
+ <file>Cyclic.java</file>
+ <line>17</line>
+ <problem_class severity="WARNING" attribute_key="WARNING_ATTRIBUTES">Cyclic class dependency</problem_class>
+ <description>Class 'Base' is cyclically dependent on classes 'com.siyeh.igtest.dependency.cyclic_class_dependency.src.Cyclic' and 'com.siyeh.igtest.dependency.cyclic_class_dependency.src.Top'</description>
+ </problem>
+
+ <problem>
+ <file>Cyclic.java</file>
+ <line>29</line>
+ <problem_class severity="WARNING" attribute_key="WARNING_ATTRIBUTES">Cyclic class dependency</problem_class>
+ <description>Class 'Coffee' is cyclically dependent on class 'com.siyeh.igtest.dependency.cyclic_class_dependency.src.FiveOClock'</description>
+ </problem>
+
+ <problem>
+ <file>Cyclic.java</file>
+ <line>25</line>
+ <problem_class severity="WARNING" attribute_key="WARNING_ATTRIBUTES">Cyclic class dependency</problem_class>
+ <description>Class 'FiveOClock' is cyclically dependent on class 'com.siyeh.igtest.dependency.cyclic_class_dependency.src.Coffee'</description>
+ </problem>
+
+ <problem>
+ <file>Cyclic.java</file>
+ <line>22</line>
+ <problem_class severity="WARNING" attribute_key="WARNING_ATTRIBUTES">Cyclic class dependency</problem_class>
+ <description>Class 'Top' is cyclically dependent on classes 'com.siyeh.igtest.dependency.cyclic_class_dependency.src.Base' and 'com.siyeh.igtest.dependency.cyclic_class_dependency.src.Cyclic'</description>
+ </problem>
+
+ <problem>
+ <file>Cyclic.java</file>
+ <line>6</line>
+ <problem_class severity="WARNING" attribute_key="WARNING_ATTRIBUTES">Cyclic class dependency</problem_class>
+ <description>Class 'Cyclic' is cyclically dependent on classes 'com.siyeh.igtest.dependency.cyclic_class_dependency.src.Base' and 'com.siyeh.igtest.dependency.cyclic_class_dependency.src.Top'</description>
+ </problem>
+</problems> \ No newline at end of file
diff --git a/plugins/InspectionGadgets/test/com/siyeh/igtest/dependency/cyclic_class_dependency/src/Cyclic.java b/plugins/InspectionGadgets/test/com/siyeh/igtest/dependency/cyclic_class_dependency/src/Cyclic.java
new file mode 100644
index 000000000000..e0f9cf48061a
--- /dev/null
+++ b/plugins/InspectionGadgets/test/com/siyeh/igtest/dependency/cyclic_class_dependency/src/Cyclic.java
@@ -0,0 +1,29 @@
+package com.siyeh.igtest.dependency.cyclic_class_dependency.src;
+
+/**
+ * @author Bas Leijdekkers
+ */
+public class Cyclic extends Base {
+
+ Cyclic() {
+ new Object() {{
+ foo();
+ }};
+ }
+
+ void foo() {}
+
+}
+class Base {
+ void a() {
+ Top.m();
+ }
+}
+class Top extends Cyclic {
+ public static void m() {}
+}
+interface FiveOClock {
+ void m(Coffee c);
+
+}
+interface Coffee extends FiveOClock {}
diff --git a/plugins/InspectionGadgets/test/com/siyeh/igtest/dependency/cyclic_package_dependency/expected.xml b/plugins/InspectionGadgets/test/com/siyeh/igtest/dependency/cyclic_package_dependency/expected.xml
new file mode 100644
index 000000000000..beb3b7cb12ba
--- /dev/null
+++ b/plugins/InspectionGadgets/test/com/siyeh/igtest/dependency/cyclic_package_dependency/expected.xml
@@ -0,0 +1,16 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<problems>
+ <problem>
+ <entry_point TYPE="package" FQNAME="c" />
+ <problem_class>Cyclic package dependency</problem_class>
+ <hints />
+ <description>Package 'c' is cyclically dependent on package 'b'</description>
+ </problem>
+
+ <problem>
+ <entry_point TYPE="package" FQNAME="b" />
+ <problem_class>Cyclic package dependency</problem_class>
+ <hints />
+ <description>Package 'b' is cyclically dependent on package 'c'</description>
+ </problem>
+</problems> \ No newline at end of file
diff --git a/plugins/InspectionGadgets/test/com/siyeh/igtest/dependency/cyclic_package_dependency/src/a/Independent.java b/plugins/InspectionGadgets/test/com/siyeh/igtest/dependency/cyclic_package_dependency/src/a/Independent.java
new file mode 100644
index 000000000000..b8c2cd4323f4
--- /dev/null
+++ b/plugins/InspectionGadgets/test/com/siyeh/igtest/dependency/cyclic_package_dependency/src/a/Independent.java
@@ -0,0 +1,11 @@
+package a;
+
+import a.a.A;
+
+public class Independent {
+
+ void foo() {
+ System.out.println(new String());
+ A a = new A;
+ }
+}
diff --git a/plugins/InspectionGadgets/test/com/siyeh/igtest/dependency/cyclic_package_dependency/src/a/a/A.java b/plugins/InspectionGadgets/test/com/siyeh/igtest/dependency/cyclic_package_dependency/src/a/a/A.java
new file mode 100644
index 000000000000..e796ed96f50b
--- /dev/null
+++ b/plugins/InspectionGadgets/test/com/siyeh/igtest/dependency/cyclic_package_dependency/src/a/a/A.java
@@ -0,0 +1,4 @@
+package com.siyeh.igtest.dependency.cyclic_package_dependency.src.a.a;
+
+public class A {
+}
diff --git a/plugins/InspectionGadgets/test/com/siyeh/igtest/dependency/cyclic_package_dependency/src/b/Cycle1.java b/plugins/InspectionGadgets/test/com/siyeh/igtest/dependency/cyclic_package_dependency/src/b/Cycle1.java
new file mode 100644
index 000000000000..d61590b7247b
--- /dev/null
+++ b/plugins/InspectionGadgets/test/com/siyeh/igtest/dependency/cyclic_package_dependency/src/b/Cycle1.java
@@ -0,0 +1,30 @@
+/*
+ * Copyright 2000-2013 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 b;
+
+import c.Cycle2;
+
+/**
+ * @author Bas Leijdekkers
+ */
+public class Cycle1 {
+
+ public void a() {}
+
+ void b(Cycle2 c) {
+ c.b();
+ }
+}
diff --git a/plugins/InspectionGadgets/test/com/siyeh/igtest/dependency/cyclic_package_dependency/src/c/Cycle2.java b/plugins/InspectionGadgets/test/com/siyeh/igtest/dependency/cyclic_package_dependency/src/c/Cycle2.java
new file mode 100644
index 000000000000..39aa6d92d5da
--- /dev/null
+++ b/plugins/InspectionGadgets/test/com/siyeh/igtest/dependency/cyclic_package_dependency/src/c/Cycle2.java
@@ -0,0 +1,30 @@
+/*
+ * Copyright 2000-2013 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 c;
+
+import b.Cycle1;
+
+/**
+ * @author Bas Leijdekkers
+ */
+public class Cycle2 {
+
+ public void b() {}
+
+ void c(Cycle1 c) {
+ c.a();
+ }
+}
diff --git a/plugins/InspectionGadgets/test/com/siyeh/igtest/errorhandling/error_rethrown/ErrorRethrown.java b/plugins/InspectionGadgets/test/com/siyeh/igtest/errorhandling/error_rethrown/ErrorRethrown.java
new file mode 100644
index 000000000000..440035a140c5
--- /dev/null
+++ b/plugins/InspectionGadgets/test/com/siyeh/igtest/errorhandling/error_rethrown/ErrorRethrown.java
@@ -0,0 +1,30 @@
+package com.siyeh.igtest.errorhandling.error_rethrown;
+
+public class ErrorRethrown
+{
+ public void foo()
+ {
+ try {
+ System.out.println("foo");
+ } catch (Error e) {
+ e.printStackTrace();
+ }
+ try {
+ System.out.println("foo");
+ } catch (Error e) {
+ e.printStackTrace();
+ throw e;
+ }
+ try {
+ System.out.println("foo");
+ } catch (AssertionError e) {
+ e.printStackTrace();
+ throw e;
+ }
+ try {
+ System.out.println("foo");
+ } catch (AssertionError e) {
+ e.printStackTrace();
+ }
+ }
+}
diff --git a/plugins/InspectionGadgets/test/com/siyeh/igtest/errorhandling/error_rethrown/expected.xml b/plugins/InspectionGadgets/test/com/siyeh/igtest/errorhandling/error_rethrown/expected.xml
new file mode 100644
index 000000000000..decb0cd59086
--- /dev/null
+++ b/plugins/InspectionGadgets/test/com/siyeh/igtest/errorhandling/error_rethrown/expected.xml
@@ -0,0 +1,16 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<problems>
+ <problem>
+ <file>ErrorRethrown.java</file>
+ <line>11</line>
+ <problem_class severity="WARNING" attribute_key="WARNING_ATTRIBUTES">'java.lang.Error' not rethrown</problem_class>
+ <description>Error &lt;code&gt;e&lt;/code&gt; not rethrown #loc</description>
+ </problem>
+
+ <problem>
+ <file>ErrorRethrown.java</file>
+ <line>39</line>
+ <problem_class severity="WARNING" attribute_key="WARNING_ATTRIBUTES">'java.lang.Error' not rethrown</problem_class>
+ <description>Error &lt;code&gt;e&lt;/code&gt; not rethrown #loc</description>
+ </problem>
+</problems> \ No newline at end of file
diff --git a/plugins/InspectionGadgets/test/com/siyeh/igtest/exceptionHandling/ErrorRethrownInspection.java b/plugins/InspectionGadgets/test/com/siyeh/igtest/exceptionHandling/ErrorRethrownInspection.java
deleted file mode 100644
index 6dcba83d5d06..000000000000
--- a/plugins/InspectionGadgets/test/com/siyeh/igtest/exceptionHandling/ErrorRethrownInspection.java
+++ /dev/null
@@ -1,44 +0,0 @@
-package com.siyeh.igtest.exceptionHandling;
-
-public class ErrorRethrownInspection
-{
- public void foo()
- {
- try
- {
- System.out.println("foo");
- }
- catch(Error e)
- {
- e.printStackTrace();
- }
-
- try
- {
- System.out.println("foo");
- }
- catch(Error e)
- {
- e.printStackTrace();
- throw e;
- }
-
- try
- {
- System.out.println("foo");
- }
- catch(OutOfMemoryError e)
- {
- e.printStackTrace();
- throw e;
- }
- try
- {
- System.out.println("foo");
- }
- catch(OutOfMemoryError e)
- {
- e.printStackTrace();
- }
- }
-}
diff --git a/plugins/InspectionGadgets/test/com/siyeh/igtest/exceptionHandling/ThreadDeathRethrownInspection.java b/plugins/InspectionGadgets/test/com/siyeh/igtest/exceptionHandling/ThreadDeathRethrownInspection.java
deleted file mode 100644
index 1a262c8759b0..000000000000
--- a/plugins/InspectionGadgets/test/com/siyeh/igtest/exceptionHandling/ThreadDeathRethrownInspection.java
+++ /dev/null
@@ -1,26 +0,0 @@
-package com.siyeh.igtest.exceptionHandling;
-
-public class ThreadDeathRethrownInspection
-{
- public void foo()
- {
- try
- {
- System.out.println("foo");
- }
- catch(ThreadDeath e)
- {
- e.printStackTrace();
- }
-
- try
- {
- System.out.println("foo");
- }
- catch(ThreadDeath e)
- {
- e.printStackTrace();
- throw e;
- }
- }
-}
diff --git a/plugins/InspectionGadgets/test/com/siyeh/igtest/inheritance/extends_concrete_collection/ExtendsConcreteCollection.java b/plugins/InspectionGadgets/test/com/siyeh/igtest/inheritance/extends_concrete_collection/ExtendsConcreteCollection.java
new file mode 100644
index 000000000000..bceca3b7549f
--- /dev/null
+++ b/plugins/InspectionGadgets/test/com/siyeh/igtest/inheritance/extends_concrete_collection/ExtendsConcreteCollection.java
@@ -0,0 +1,17 @@
+package com.siyeh.igtest.inheritance.extends_concrete_collection;
+
+import java.util.ArrayDeque;
+import java.util.ArrayList;
+import java.util.LinkedHashMap;
+import java.util.Map;
+
+class <warning descr="Class 'ExtendsConcreteCollection' explicitly extends 'java.util.ArrayList'">ExtendsConcreteCollection</warning> extends ArrayList {
+
+}
+class MyMap extends LinkedHashMap<String, String> {
+ @Override
+ protected boolean removeEldestEntry(Map.Entry<String, String> eldest) {
+ return true;
+ }
+}
+class <warning descr="Class 'MyDeque' explicitly extends 'java.util.ArrayDeque'">MyDeque</warning> extends ArrayDeque {} \ No newline at end of file
diff --git a/plugins/InspectionGadgets/test/com/siyeh/igtest/inheritance/redundant_method_override/RedundantMethodOverride.java b/plugins/InspectionGadgets/test/com/siyeh/igtest/inheritance/redundant_method_override/RedundantMethodOverride.java
new file mode 100644
index 000000000000..797cab3c9f13
--- /dev/null
+++ b/plugins/InspectionGadgets/test/com/siyeh/igtest/inheritance/redundant_method_override/RedundantMethodOverride.java
@@ -0,0 +1,31 @@
+package redundant_method_override;
+
+public class RedundantMethodOverride extends S {
+
+ @Override
+ void <warning descr="Method 'foo()' is identical to its super method">foo</warning>() {
+ System.out.println();
+ }
+
+ void bar() {
+ System.out.println();
+ }
+
+ public void m() {
+ System.out.println();
+ }
+}
+class S {
+
+ void foo() {
+ System.out.println();
+ }
+
+ synchronized void bar() {
+ System.out.println();
+ }
+
+ void m() {
+ System.out.println();
+ }
+} \ No newline at end of file
diff --git a/plugins/InspectionGadgets/test/com/siyeh/igtest/initialization/Base.java b/plugins/InspectionGadgets/test/com/siyeh/igtest/initialization/Base.java
deleted file mode 100644
index cd02633194e1..000000000000
--- a/plugins/InspectionGadgets/test/com/siyeh/igtest/initialization/Base.java
+++ /dev/null
@@ -1,8 +0,0 @@
-package com.siyeh.igtest.initialization;
-
-public class Base {
-
- public void foo() {
-
- }
-}
diff --git a/plugins/InspectionGadgets/test/com/siyeh/igtest/initialization/OverriddenMethodCallInConstructor.java b/plugins/InspectionGadgets/test/com/siyeh/igtest/initialization/OverriddenMethodCallInConstructor.java
deleted file mode 100644
index a1cd58a99c57..000000000000
--- a/plugins/InspectionGadgets/test/com/siyeh/igtest/initialization/OverriddenMethodCallInConstructor.java
+++ /dev/null
@@ -1,8 +0,0 @@
-package com.siyeh.igtest.initialization;
-
-public class OverriddenMethodCallInConstructor extends Base {
-
- OverriddenMethodCallInConstructor() {
- foo();
- }
-}
diff --git a/plugins/InspectionGadgets/test/com/siyeh/igtest/initialization/Overrider.java b/plugins/InspectionGadgets/test/com/siyeh/igtest/initialization/Overrider.java
deleted file mode 100644
index e244bec5c2eb..000000000000
--- a/plugins/InspectionGadgets/test/com/siyeh/igtest/initialization/Overrider.java
+++ /dev/null
@@ -1,8 +0,0 @@
-package com.siyeh.igtest.initialization;
-
-public class Overrider extends OverriddenMethodCallInConstructor {
-
- public void foo() {
- System.out.println();
- }
-} \ No newline at end of file
diff --git a/plugins/InspectionGadgets/test/com/siyeh/igtest/initialization/overridden_method_call_during_object_construction/OverriddenMethodCallDuringObjectConstruction.java b/plugins/InspectionGadgets/test/com/siyeh/igtest/initialization/overridden_method_call_during_object_construction/OverriddenMethodCallDuringObjectConstruction.java
new file mode 100644
index 000000000000..83762a627ecf
--- /dev/null
+++ b/plugins/InspectionGadgets/test/com/siyeh/igtest/initialization/overridden_method_call_during_object_construction/OverriddenMethodCallDuringObjectConstruction.java
@@ -0,0 +1,36 @@
+package initialization.overridden_method_call_during_object_construction;
+
+public class OverriddenMethodCallDuringObjectConstruction extends Base {
+ OverriddenMethodCallDuringObjectConstruction o;
+ {
+ try {
+ o = (OverriddenMethodCallDuringObjectConstruction)<warning descr="Call to overridden method 'clone()' during object construction">clone</warning>();
+ }
+ catch (CloneNotSupportedException e) {
+ throw new RuntimeException(e);
+ }
+ }
+
+ OverriddenMethodCallDuringObjectConstruction() {
+ <warning descr="Call to overridden method 'foo()' during object construction">foo</warning>();
+ }
+
+ @Override
+ protected Object clone() throws CloneNotSupportedException {
+ return super.clone();
+ }
+}
+class Base implements Cloneable {
+ public void foo() {}
+}
+class Overrider extends OverriddenMethodCallDuringObjectConstruction {
+ public void foo() {
+ System.out.println();
+ }
+
+ @Override
+ protected Object clone() throws CloneNotSupportedException {
+ return super.clone();
+ }
+}
+
diff --git a/plugins/InspectionGadgets/test/com/siyeh/igtest/internationalization/implicit_default_charset_usage/ImplicitDefaultCharsetUsage.java b/plugins/InspectionGadgets/test/com/siyeh/igtest/internationalization/implicit_default_charset_usage/ImplicitDefaultCharsetUsage.java
new file mode 100644
index 000000000000..17dd59eadf7a
--- /dev/null
+++ b/plugins/InspectionGadgets/test/com/siyeh/igtest/internationalization/implicit_default_charset_usage/ImplicitDefaultCharsetUsage.java
@@ -0,0 +1,40 @@
+package com.siyeh.igtest.internationalization.implicit_default_charset_usage;
+
+import java.io.*;
+import java.util.ArrayList;
+import java.util.Formatter;
+import java.util.Locale;
+import java.util.Scanner;
+
+class ImplicitDefaultCharsetUsage {
+
+ void f() throws IOException {
+ final byte[] bytes = "asdf".<warning descr="Call to 'getBytes()' uses the platform's default charset">getBytes</warning>();
+ "asdf".getBytes("");
+ new String();
+ new String("asdfas");
+ new String(new byte[10], "asdf");
+ new <warning descr="'new String()' call uses the platform's default charset">String</warning>(new byte[10]);
+ new <warning descr="'new String()' call uses the platform's default charset">String</warning>(new byte[10], 1, 9);
+ new <warning descr="'new InputStreamReader()' call uses the platform's default charset">InputStreamReader</warning>(null);
+ new InputStreamReader(null, "utf-8");
+ new <warning descr="'new OutputStreamWriter()' call uses the platform's default charset">OutputStreamWriter</warning>(null);
+ new OutputStreamWriter(null, "utf-8");
+ new <warning descr="'new FileReader()' call uses the platform's default charset">FileReader</warning>("asdf");
+ new <warning descr="'new FileWriter()' call uses the platform's default charset">FileWriter</warning>((String)null);
+ new <warning descr="'new PrintStream()' call uses the platform's default charset">PrintStream</warning>((OutputStream)null);
+ new PrintStream("filename", "utf-8");
+ new PrintStream("filename");
+ new PrintWriter((Writer)null);
+ new PrintWriter("filename", "utf-8");
+ new <warning descr="'new PrintWriter()' call uses the platform's default charset">PrintWriter</warning>("filename");
+ new <warning descr="'new Formatter()' call uses the platform's default charset">Formatter</warning>(new FileOutputStream("null"));
+ new Formatter(new FileOutputStream("null"), "utf-8");
+ new Formatter(new FileOutputStream("null"), "utf-8", Locale.getDefault());
+ new Formatter(System.out);
+ new <warning descr="'new Scanner()' call uses the platform's default charset">Scanner</warning>(new FileInputStream("null"));
+ new Scanner(new FileInputStream("null"), "utf-8");
+ new Scanner("string input");
+ new ArrayList(10);
+ }
+} \ No newline at end of file
diff --git a/plugins/InspectionGadgets/test/com/siyeh/igtest/internationalization/simple_date_format_without_locale/SimpleDateFormatWithoutLocale.java b/plugins/InspectionGadgets/test/com/siyeh/igtest/internationalization/simple_date_format_without_locale/SimpleDateFormatWithoutLocale.java
new file mode 100644
index 000000000000..17f9c309a9ae
--- /dev/null
+++ b/plugins/InspectionGadgets/test/com/siyeh/igtest/internationalization/simple_date_format_without_locale/SimpleDateFormatWithoutLocale.java
@@ -0,0 +1,12 @@
+package com.siyeh.igtest.internationalization.simple_date_format_without_locale;
+
+import java.text.SimpleDateFormat;
+import java.util.Locale;
+
+class SimpleDateFormatWithoutLocale {
+
+ void m() {
+ new <warning descr="Instantiating a 'SimpleDateFormat' without specifying a Locale in an internationalized context">SimpleDateFormat</warning>("yyyy");
+ new SimpleDateFormat("yyyy", Locale.getDefault());
+ }
+} \ No newline at end of file
diff --git a/plugins/InspectionGadgets/test/com/siyeh/igtest/internationalization/unnecessary_unicode_escape/UnnecessaryUnicodeEscape.java b/plugins/InspectionGadgets/test/com/siyeh/igtest/internationalization/unnecessary_unicode_escape/UnnecessaryUnicodeEscape.java
index b258b177cc23..14f8daa04656 100644
--- a/plugins/InspectionGadgets/test/com/siyeh/igtest/internationalization/unnecessary_unicode_escape/UnnecessaryUnicodeEscape.java
+++ b/plugins/InspectionGadgets/test/com/siyeh/igtest/internationalization/unnecessary_unicode_escape/UnnecessaryUnicodeEscape.java
@@ -3,4 +3,8 @@ package com.siyeh.igtest.internationalization.unnecessary_unicode_escape;
class UnnecessaryUnicodeEscape {
// <warning descr="Unicode escape sequence '\uuuuuu0061' can be replaced with 'a'">\uuuuuu0061</warning><warning descr="Unicode escape sequence '\u0062' can be replaced with 'b'">\u0062</warning>
// control char & not representable char: \u0010 \u00e4
+}
+@SuppressWarnings("UnnecessaryUnicodeEscape")
+class Suppress {
+ String s = "\u0062";
} \ No newline at end of file
diff --git a/plugins/InspectionGadgets/test/com/siyeh/igtest/j2me/PrivateMemberAccessBetweenOuterAndInnerClass.java b/plugins/InspectionGadgets/test/com/siyeh/igtest/j2me/PrivateMemberAccessBetweenOuterAndInnerClass.java
deleted file mode 100644
index d5c6f7576cda..000000000000
--- a/plugins/InspectionGadgets/test/com/siyeh/igtest/j2me/PrivateMemberAccessBetweenOuterAndInnerClass.java
+++ /dev/null
@@ -1,16 +0,0 @@
-package com.siyeh.igtest.j2me;
-
-import java.awt.*;
-
-
-public class PrivateMemberAccessBetweenOuterAndInnerClass {
- private String caption = "Button";
-
- private void initialize() {
- Button btn = new Button(caption) {
- public void foo() {
- System.out.println(caption);
- }
- };
- }
-}
diff --git a/plugins/InspectionGadgets/test/com/siyeh/igtest/j2me/private_member_access_between_outer_and_inner_class/PrivateMemberAccessBetweenOuterAndInnerClass.java b/plugins/InspectionGadgets/test/com/siyeh/igtest/j2me/private_member_access_between_outer_and_inner_class/PrivateMemberAccessBetweenOuterAndInnerClass.java
new file mode 100644
index 000000000000..a0ebd068824b
--- /dev/null
+++ b/plugins/InspectionGadgets/test/com/siyeh/igtest/j2me/private_member_access_between_outer_and_inner_class/PrivateMemberAccessBetweenOuterAndInnerClass.java
@@ -0,0 +1,14 @@
+package com.siyeh.igtest.j2me.private_member_access_between_outer_and_inner_class;
+
+public class PrivateMemberAccessBetweenOuterAndInnerClass {
+ private String caption = "Button";
+
+ private void initialize() {
+ System.out.println(caption);
+ Object btn = new Object() {
+ public void foo() {
+ System.out.println(<warning descr="Access to private member of class 'PrivateMemberAccessBetweenOuterAndInnerClass'">caption</warning>);
+ }
+ };
+ }
+}
diff --git a/plugins/InspectionGadgets/test/com/siyeh/igtest/j2me/private_member_access_between_outer_and_inner_class/Simple.java b/plugins/InspectionGadgets/test/com/siyeh/igtest/j2me/private_member_access_between_outer_and_inner_class/Simple.java
new file mode 100644
index 000000000000..72143f8acf86
--- /dev/null
+++ b/plugins/InspectionGadgets/test/com/siyeh/igtest/j2me/private_member_access_between_outer_and_inner_class/Simple.java
@@ -0,0 +1,21 @@
+package com.siyeh.igtest.j2me.private_member_access_between_outer_and_inner_class;
+
+public class Simple {
+
+ private int i;
+
+ private Simple() {}
+
+ private void foo() {}
+
+ class Inner {{
+ new <warning descr="Access to private member of class 'Simple'">Simple</warning>();
+ System.out.println(<warning descr="Access to private member of class 'Simple'">i</warning>);
+ <warning descr="Access to private member of class 'Simple'">foo</warning>();
+ }}
+}
+class Other {
+ void foo(Simple o) {
+ System.out.println(o.<error descr="'i' has private access in 'com.siyeh.igtest.j2me.private_member_access_between_outer_and_inner_class.Simple'">i</error>);
+ }
+} \ No newline at end of file
diff --git a/plugins/InspectionGadgets/test/com/siyeh/igtest/junit/misordered_assert_equals_parameters/Simple.java b/plugins/InspectionGadgets/test/com/siyeh/igtest/junit/misordered_assert_equals_parameters/Simple.java
new file mode 100644
index 000000000000..e4497c605c80
--- /dev/null
+++ b/plugins/InspectionGadgets/test/com/siyeh/igtest/junit/misordered_assert_equals_parameters/Simple.java
@@ -0,0 +1,16 @@
+import org.junit.Assert;
+
+class Simple {
+
+ public static final int EXPECTED = -9;
+
+ private class BeanCreator {
+
+ public BeanCreator withQuery(int s) {
+ Assert.<warning descr="Arguments to 'assertEquals()' in wrong order">assertEquals</warning>(s, -1);
+ Assert.<warning descr="Arguments to 'assertSame()' in wrong order">assertSame</warning>(s, EXPECTED);
+ junit.framework.Assert.<warning descr="Arguments to 'failNotEquals()' in wrong order">failNotEquals</warning>("asdfasd", s, EXPECTED);
+ return null;
+ }
+ }
+} \ No newline at end of file
diff --git a/plugins/InspectionGadgets/test/com/siyeh/igtest/junit/use_of_obsolete_assert/ObsoleteAssert.java b/plugins/InspectionGadgets/test/com/siyeh/igtest/junit/use_of_obsolete_assert/ObsoleteAssert.java
new file mode 100644
index 000000000000..4087eb8d7bbf
--- /dev/null
+++ b/plugins/InspectionGadgets/test/com/siyeh/igtest/junit/use_of_obsolete_assert/ObsoleteAssert.java
@@ -0,0 +1,8 @@
+package com.siyeh.igtest.junit.use_of_obsolete_assert;
+
+public class ObsoleteAssert {
+
+ public void testMe(int s) {
+ junit.framework.Assert.<warning descr="Call to 'assertEquals()' from 'junit.framework.Assert' should be replaced with call to method from 'org.junit.Assert'">assertEquals</warning>("asdfasd", -1, s);
+ }
+}
diff --git a/plugins/InspectionGadgets/test/com/siyeh/igtest/migration/method_can_be_variable_arity_method/MethodCanBeVariableArity.java b/plugins/InspectionGadgets/test/com/siyeh/igtest/migration/method_can_be_variable_arity_method/MethodCanBeVariableArity.java
index db74d0cfc230..34b698fc0d13 100644
--- a/plugins/InspectionGadgets/test/com/siyeh/igtest/migration/method_can_be_variable_arity_method/MethodCanBeVariableArity.java
+++ b/plugins/InspectionGadgets/test/com/siyeh/igtest/migration/method_can_be_variable_arity_method/MethodCanBeVariableArity.java
@@ -24,4 +24,12 @@ class Sub extends MethodCanBeVariableArity {
public void convertMe(String[] ss) {
super.convertMe(ss);
}
+}
+class Annotated {
+ public void nullable(@org.jetbrains.annotations.Nullable String[] ss) {}
+
+ void m(String[] ss) {}
+}
+interface X {
+ void m(String[] ss);
} \ No newline at end of file
diff --git a/plugins/InspectionGadgets/test/com/siyeh/igtest/migration/method_can_be_variable_arity_method/expected.xml b/plugins/InspectionGadgets/test/com/siyeh/igtest/migration/method_can_be_variable_arity_method/expected.xml
index 128a5b6fca7d..8158e874e01d 100644
--- a/plugins/InspectionGadgets/test/com/siyeh/igtest/migration/method_can_be_variable_arity_method/expected.xml
+++ b/plugins/InspectionGadgets/test/com/siyeh/igtest/migration/method_can_be_variable_arity_method/expected.xml
@@ -8,4 +8,11 @@
<description>&lt;code&gt;convertMe()&lt;/code&gt; can be converted to variable arity method</description>
</problem>
+ <problem>
+ <file>MethodCanBeVariableArity.java</file>
+ <line>34</line>
+ <problem_class severity="WARNING" attribute_key="WARNING_ATTRIBUTES">Method can be variable arity method</problem_class>
+ <description>&lt;code&gt;m()&lt;/code&gt; can be converted to variable arity method #loc</description>
+ </problem>
+
</problems> \ No newline at end of file
diff --git a/plugins/InspectionGadgets/test/com/siyeh/igtest/migration/unnecessary_unboxing/UnnecessaryUnboxing.java b/plugins/InspectionGadgets/test/com/siyeh/igtest/migration/unnecessary_unboxing/UnnecessaryUnboxing.java
index a73273dc24c5..366d21ddbae8 100644
--- a/plugins/InspectionGadgets/test/com/siyeh/igtest/migration/unnecessary_unboxing/UnnecessaryUnboxing.java
+++ b/plugins/InspectionGadgets/test/com/siyeh/igtest/migration/unnecessary_unboxing/UnnecessaryUnboxing.java
@@ -39,4 +39,8 @@ public class UnnecessaryUnboxing {
System.out.println((byte)b.byteValue());
}
+
+ byte cast(Integer v) {
+ return (byte)v.intValue();
+ }
} \ No newline at end of file
diff --git a/plugins/InspectionGadgets/test/com/siyeh/igtest/naming/abstract_class_naming_convention/Simple.java b/plugins/InspectionGadgets/test/com/siyeh/igtest/naming/abstract_class_naming_convention/Simple.java
new file mode 100644
index 000000000000..fdb4e7533b7d
--- /dev/null
+++ b/plugins/InspectionGadgets/test/com/siyeh/igtest/naming/abstract_class_naming_convention/Simple.java
@@ -0,0 +1,4 @@
+package com.siyeh.igtest.naming.abstract_class_naming_convention;
+
+public abstract class <warning descr="Abstract class name 'Simple' is too short">Simple</warning> {
+}
diff --git a/plugins/InspectionGadgets/test/com/siyeh/igtest/numeric/pointless_arithmetic_expression/PointlessArithmeticExpression.java b/plugins/InspectionGadgets/test/com/siyeh/igtest/numeric/pointless_arithmetic_expression/PointlessArithmeticExpression.java
index d71e960908bd..5f6231d91802 100644
--- a/plugins/InspectionGadgets/test/com/siyeh/igtest/numeric/pointless_arithmetic_expression/PointlessArithmeticExpression.java
+++ b/plugins/InspectionGadgets/test/com/siyeh/igtest/numeric/pointless_arithmetic_expression/PointlessArithmeticExpression.java
@@ -88,4 +88,26 @@ public class PointlessArithmeticExpression
double floatsOrDoubles() {
return 123.001 % 1.0;
}
+
+ void more(int i) {
+ System.out.println(i / i);
+ System.out.println(i - i);
+ System.out.println(i % i);
+ }
}
+class Main {
+ private static final int CONST = 9;
+ int i;
+ Main(int i) {
+ this.i = i;
+ }
+
+ static int doo() {
+ return new Main(1).i - new Main(0).i;
+ }
+
+ int fly(int i) {
+ final Main main = new Main(12);
+ return (CONST + (new Main(5).i) * 8) - (Main.CONST + new Main(5).i * (8));
+ }
+} \ No newline at end of file
diff --git a/plugins/InspectionGadgets/test/com/siyeh/igtest/numeric/pointless_arithmetic_expression/expected.xml b/plugins/InspectionGadgets/test/com/siyeh/igtest/numeric/pointless_arithmetic_expression/expected.xml
index 8d6ce07b29da..84ac4f27ddd1 100644
--- a/plugins/InspectionGadgets/test/com/siyeh/igtest/numeric/pointless_arithmetic_expression/expected.xml
+++ b/plugins/InspectionGadgets/test/com/siyeh/igtest/numeric/pointless_arithmetic_expression/expected.xml
@@ -120,4 +120,31 @@
<description>&lt;code&gt;i &lt; Integer.MIN_VALUE&lt;/code&gt; can be replaced with 'false' #loc</description>
</problem>
+ <problem>
+ <file>PointlessArithmeticExpression.java</file>
+ <line>93</line>
+ <problem_class severity="WARNING" attribute_key="WARNING_ATTRIBUTES">Pointless arithmetic expression</problem_class>
+ <description>&lt;code&gt;i / i&lt;/code&gt; can be replaced with '1' #loc</description>
+ </problem>
+
+ <problem>
+ <file>PointlessArithmeticExpression.java</file>
+ <line>94</line>
+ <problem_class severity="WARNING" attribute_key="WARNING_ATTRIBUTES">Pointless arithmetic expression</problem_class>
+ <description>&lt;code&gt;i - i&lt;/code&gt; can be replaced with '0' #loc</description>
+ </problem>
+
+ <problem>
+ <file>PointlessArithmeticExpression.java</file>
+ <line>95</line>
+ <problem_class severity="WARNING" attribute_key="WARNING_ATTRIBUTES">Pointless arithmetic expression</problem_class>
+ <description>&lt;code&gt;i % i&lt;/code&gt; can be replaced with '0' #loc</description>
+ </problem>
+
+ <problem>
+ <file>PointlessArithmeticExpression.java</file>
+ <line>111</line>
+ <problem_class severity="WARNING" attribute_key="WARNING_ATTRIBUTES">Pointless arithmetic expression</problem_class>
+ <description>&lt;code&gt;(CONST + (new Main(5).i) * 8) - (Main.CONST + new Main(5).i * (8))&lt;/code&gt; can be replaced with '0' #loc</description>
+ </problem>
</problems> \ No newline at end of file
diff --git a/plugins/InspectionGadgets/test/com/siyeh/igtest/numeric/unnecessary_explicit_numeric_cast/UnnecessaryExplicitNumericCast.java b/plugins/InspectionGadgets/test/com/siyeh/igtest/numeric/unnecessary_explicit_numeric_cast/UnnecessaryExplicitNumericCast.java
index 9468de1baf32..a625c87f7062 100644
--- a/plugins/InspectionGadgets/test/com/siyeh/igtest/numeric/unnecessary_explicit_numeric_cast/UnnecessaryExplicitNumericCast.java
+++ b/plugins/InspectionGadgets/test/com/siyeh/igtest/numeric/unnecessary_explicit_numeric_cast/UnnecessaryExplicitNumericCast.java
@@ -53,4 +53,18 @@ public class UnnecessaryExplicitNumericCast {
float x = 2;
target((int) x); // this line complains: 'x' unnecessarily cast to 'int'
}
+
+ void a(float angleFromTo) {
+ float f = (float) Math.cos(0.5) * 1.0f; // necessary
+ final long l = (long) i() * 9L;
+ float angle2 = angleFromTo + (float) (Math.PI / 2);
+ }
+
+ int i() {
+ return 10;
+ }
+
+ boolean redundantTypeCast(long l) {
+ return 0L == (long)l;
+ }
}
diff --git a/plugins/InspectionGadgets/test/com/siyeh/igtest/numeric/unnecessary_explicit_numeric_cast/expected.xml b/plugins/InspectionGadgets/test/com/siyeh/igtest/numeric/unnecessary_explicit_numeric_cast/expected.xml
index 19f2cadeff52..1e24f7ab3d58 100644
--- a/plugins/InspectionGadgets/test/com/siyeh/igtest/numeric/unnecessary_explicit_numeric_cast/expected.xml
+++ b/plugins/InspectionGadgets/test/com/siyeh/igtest/numeric/unnecessary_explicit_numeric_cast/expected.xml
@@ -100,4 +100,11 @@
<problem_class severity="WARNING" attribute_key="NOT_USED_ELEMENT_ATTRIBUTES">Unnecessary explicit numeric cast</problem_class>
<description>''b'' unnecessarily cast to &lt;code&gt;int&lt;/code&gt; #loc</description>
</problem>
+
+ <problem>
+ <file>UnnecessaryExplicitNumericCast.java</file>
+ <line>59</line>
+ <problem_class severity="WARNING" attribute_key="NOT_USED_ELEMENT_ATTRIBUTES">Unnecessary explicit numeric cast</problem_class>
+ <description>'i()' unnecessarily cast to &lt;code&gt;long&lt;/code&gt; #loc</description>
+ </problem>
</problems> \ No newline at end of file
diff --git a/plugins/InspectionGadgets/test/com/siyeh/igtest/packaging/disjoint_package/expected.xml b/plugins/InspectionGadgets/test/com/siyeh/igtest/packaging/disjoint_package/expected.xml
new file mode 100644
index 000000000000..e8f00e82629f
--- /dev/null
+++ b/plugins/InspectionGadgets/test/com/siyeh/igtest/packaging/disjoint_package/expected.xml
@@ -0,0 +1,4 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<problems>
+
+</problems> \ No newline at end of file
diff --git a/plugins/InspectionGadgets/test/com/siyeh/igtest/packaging/disjoint_package/extends_implements_reference/Ferrari.java b/plugins/InspectionGadgets/test/com/siyeh/igtest/packaging/disjoint_package/extends_implements_reference/Ferrari.java
new file mode 100644
index 000000000000..716e2a3a9acc
--- /dev/null
+++ b/plugins/InspectionGadgets/test/com/siyeh/igtest/packaging/disjoint_package/extends_implements_reference/Ferrari.java
@@ -0,0 +1,11 @@
+package extends_implements_reference;
+
+public class Ferrari implements Car {
+ public void start() {}
+}
+interface Car {
+ void start();
+}
+class Factory<T extends Car> {
+ T create();
+} \ No newline at end of file
diff --git a/plugins/InspectionGadgets/test/com/siyeh/igtest/performance/CollectionsMustHaveInitialCapacityInspection.java b/plugins/InspectionGadgets/test/com/siyeh/igtest/performance/CollectionsMustHaveInitialCapacityInspection.java
deleted file mode 100644
index 56e19ae5e399..000000000000
--- a/plugins/InspectionGadgets/test/com/siyeh/igtest/performance/CollectionsMustHaveInitialCapacityInspection.java
+++ /dev/null
@@ -1,40 +0,0 @@
-package com.siyeh.igtest.performance;
-
-import java.io.IOException;
-import java.util.*;
-
-public class CollectionsMustHaveInitialCapacityInspection
-{
- public CollectionsMustHaveInitialCapacityInspection()
- {
- }
-
- public void foo() throws IOException
- {
- // new HashMap<String, String>();
- // new HashMap<String, String>(3);
-
- new HashMap();
- new HashMap(3);
-
- new WeakHashMap();
- new WeakHashMap(3);
-
- new HashSet();
- new HashSet(3);
-
- new Hashtable();
- new Hashtable(3);
-
- new BitSet();
- new BitSet(3);
-
- new Vector();
- new Vector(3);
-
- new ArrayList();
- new ArrayList(3);
-
-
- }
-} \ No newline at end of file
diff --git a/plugins/InspectionGadgets/test/com/siyeh/igtest/performance/StringBufferMustHaveInitialCapacityInspection.java b/plugins/InspectionGadgets/test/com/siyeh/igtest/performance/StringBufferMustHaveInitialCapacityInspection.java
deleted file mode 100644
index 7fe4ae3ae367..000000000000
--- a/plugins/InspectionGadgets/test/com/siyeh/igtest/performance/StringBufferMustHaveInitialCapacityInspection.java
+++ /dev/null
@@ -1,21 +0,0 @@
-package com.siyeh.igtest.performance;
-
-import java.io.IOException;
-
-public class StringBufferMustHaveInitialCapacityInspection
-{
- public StringBufferMustHaveInitialCapacityInspection()
- {
- }
-
- public void foo() throws IOException
- {
- new StringBuffer();
- new StringBuffer(3);
- new StringBuffer("foo");
- new StringBuilder();
- new StringBuilder(3);
- new StringBuilder("foo");
-
- }
-} \ No newline at end of file
diff --git a/plugins/InspectionGadgets/test/com/siyeh/igtest/performance/boolean_constructor/expected.xml b/plugins/InspectionGadgets/test/com/siyeh/igtest/performance/boolean_constructor/expected.xml
index d7cc45f68716..f7bc79d46bc1 100644
--- a/plugins/InspectionGadgets/test/com/siyeh/igtest/performance/boolean_constructor/expected.xml
+++ b/plugins/InspectionGadgets/test/com/siyeh/igtest/performance/boolean_constructor/expected.xml
@@ -4,14 +4,14 @@
<file>BooleanConstructor.java</file>
<line>7</line>
<problem_class severity="WARNING" attribute_key="WARNING_ATTRIBUTES">Boolean constructor call</problem_class>
- <description>Boolean constructor call &lt;code&gt;new Boolean(b)&lt;/code&gt; #loc</description>
+ <description>Boolean constructor call #loc</description>
</problem>
<problem>
<file>BooleanConstructor.java</file>
<line>8</line>
<problem_class severity="WARNING" attribute_key="WARNING_ATTRIBUTES">Boolean constructor call</problem_class>
- <description>Boolean constructor call &lt;code&gt;new Boolean(true)&lt;/code&gt; #loc</description>
+ <description>Boolean constructor call #loc</description>
</problem>
</problems> \ No newline at end of file
diff --git a/plugins/InspectionGadgets/test/com/siyeh/igtest/performance/inner_class_may_be_static/InnerClassMayBeStaticInspection.java b/plugins/InspectionGadgets/test/com/siyeh/igtest/performance/inner_class_may_be_static/InnerClassMayBeStaticInspection.java
index 7b14d866331f..0db367ce4757 100644
--- a/plugins/InspectionGadgets/test/com/siyeh/igtest/performance/inner_class_may_be_static/InnerClassMayBeStaticInspection.java
+++ b/plugins/InspectionGadgets/test/com/siyeh/igtest/performance/inner_class_may_be_static/InnerClassMayBeStaticInspection.java
@@ -44,16 +44,54 @@ class D {
void foo() {
new Object() {
class Y {}
- }
+ };
}
}
class StaticInnerClass {
private int foo;
+ int bar;
public class Baz extends StaticInnerClass {
Baz() {
foo = -1;
}
}
-} \ No newline at end of file
+ class C extends StaticInnerClass {{
+ bar = 1;
+ }}
+}
+class SomeBeanUnitTest {
+
+ private class BeanCreator {
+
+ public BeanCreator withQuery() {
+ return null;
+ }
+ }
+}
+class Outer {
+ class A { // may not be static
+ B b;
+ }
+ class B extends A {} // may not be static
+
+ class C { // may be static
+ D b;
+ class D extends C {}
+ }
+
+ static class E {
+ G.F b;
+ class G { // may be static
+ class F extends E {}
+ }
+ }
+
+ class H { // may be static
+ J.I b;
+ class J {
+ class I extends H {}
+ }
+ }
+}
diff --git a/plugins/InspectionGadgets/test/com/siyeh/igtest/performance/inner_class_may_be_static/expected.xml b/plugins/InspectionGadgets/test/com/siyeh/igtest/performance/inner_class_may_be_static/expected.xml
index 20b5383fd3da..0eb4ed32494c 100644
--- a/plugins/InspectionGadgets/test/com/siyeh/igtest/performance/inner_class_may_be_static/expected.xml
+++ b/plugins/InspectionGadgets/test/com/siyeh/igtest/performance/inner_class_may_be_static/expected.xml
@@ -1,9 +1,44 @@
<?xml version="1.0" encoding="UTF-8"?>
<problems>
- <problem>
- <file>InnerClassMayBeStaticInspection.java</file>
- <line>6</line>
- <problem_class severity="WARNING" attribute_key="WARNING_ATTRIBUTES">Inner class may be 'static'</problem_class>
- <description>Inner class &lt;code&gt;Nested&lt;/code&gt; may be 'static' #loc</description>
- </problem>
+ <problem>
+ <file>InnerClassMayBeStaticInspection.java</file>
+ <line>6</line>
+ <problem_class severity="WARNING" attribute_key="WARNING_ATTRIBUTES">Inner class may be 'static'</problem_class>
+ <description>Inner class &lt;code&gt;Nested&lt;/code&gt; may be 'static' #loc</description>
+ </problem>
+
+ <problem>
+ <file>InnerClassMayBeStaticInspection.java</file>
+ <line>60</line>
+ <problem_class severity="WARNING" attribute_key="WARNING_ATTRIBUTES">Inner class may be 'static'</problem_class>
+ <description>Inner class &lt;code&gt;C&lt;/code&gt; may be 'static' #loc</description>
+ </problem>
+
+ <problem>
+ <file>InnerClassMayBeStaticInspection.java</file>
+ <line>66</line>
+ <problem_class severity="WARNING" attribute_key="WARNING_ATTRIBUTES">Inner class may be 'static'</problem_class>
+ <description>Inner class &lt;code&gt;BeanCreator&lt;/code&gt; may be 'static' #loc</description>
+ </problem>
+
+ <problem>
+ <file>InnerClassMayBeStaticInspection.java</file>
+ <line>79</line>
+ <problem_class severity="WARNING" attribute_key="WARNING_ATTRIBUTES">Inner class may be 'static'</problem_class>
+ <description>Inner class &lt;code&gt;C&lt;/code&gt; may be 'static' #loc</description>
+ </problem>
+
+ <problem>
+ <file>InnerClassMayBeStaticInspection.java</file>
+ <line>86</line>
+ <problem_class severity="WARNING" attribute_key="WARNING_ATTRIBUTES">Inner class may be 'static'</problem_class>
+ <description>Inner class &lt;code&gt;G&lt;/code&gt; may be 'static' #loc</description>
+ </problem>
+
+ <problem>
+ <file>InnerClassMayBeStaticInspection.java</file>
+ <line>91</line>
+ <problem_class severity="WARNING" attribute_key="WARNING_ATTRIBUTES">Inner class may be 'static'</problem_class>
+ <description>Inner class &lt;code&gt;H&lt;/code&gt; may be 'static' #loc</description>
+ </problem>
</problems> \ No newline at end of file
diff --git a/plugins/InspectionGadgets/test/com/siyeh/igtest/performance/method_may_be_static/A.java b/plugins/InspectionGadgets/test/com/siyeh/igtest/performance/method_may_be_static/A.java
index 94bb4a36e7d2..d0417da116db 100644
--- a/plugins/InspectionGadgets/test/com/siyeh/igtest/performance/method_may_be_static/A.java
+++ b/plugins/InspectionGadgets/test/com/siyeh/igtest/performance/method_may_be_static/A.java
@@ -36,4 +36,10 @@ class D extends C implements Surprise {
}
interface Surprise {
int getInt();
+}
+
+interface FromJava8 {
+ default void foo() {
+ System.out.println();
+ }
} \ No newline at end of file
diff --git a/plugins/InspectionGadgets/test/com/siyeh/igtest/performance/method_may_be_static/expected.xml b/plugins/InspectionGadgets/test/com/siyeh/igtest/performance/method_may_be_static/expected.xml
index bb2af8f97c9c..63fe5d9bb4b5 100644
--- a/plugins/InspectionGadgets/test/com/siyeh/igtest/performance/method_may_be_static/expected.xml
+++ b/plugins/InspectionGadgets/test/com/siyeh/igtest/performance/method_may_be_static/expected.xml
@@ -6,5 +6,11 @@
<problem_class severity="WARNING" attribute_key="WARNING_ATTRIBUTES">Method may be 'static'</problem_class>
<description>Method &lt;code&gt;g()&lt;/code&gt; may be 'static' #loc</description>
</problem>
+ <problem>
+ <file>A.java</file>
+ <line>42</line>
+ <problem_class severity="WARNING" attribute_key="WARNING_ATTRIBUTES">Method may be 'static'</problem_class>
+ <description>Method &lt;code&gt;foo()&lt;/code&gt; may be 'static' #loc</description>
+ </problem>
</problems> \ No newline at end of file
diff --git a/plugins/InspectionGadgets/test/com/siyeh/igtest/performance/object_allocation_in_loop/ObjectAllocationInLoop.java b/plugins/InspectionGadgets/test/com/siyeh/igtest/performance/object_allocation_in_loop/ObjectAllocationInLoop.java
new file mode 100644
index 000000000000..58581dfe2e3a
--- /dev/null
+++ b/plugins/InspectionGadgets/test/com/siyeh/igtest/performance/object_allocation_in_loop/ObjectAllocationInLoop.java
@@ -0,0 +1,10 @@
+package com.siyeh.igtest.performance.object_allocation_in_loop;
+
+class ObjectAllocationInLoop {
+
+ void m() {
+ while (true) {
+ new <warning descr="Object allocation 'new Object()' in loop">Object</warning>();
+ }
+ }
+} \ No newline at end of file
diff --git a/plugins/InspectionGadgets/test/com/siyeh/igtest/performance/string_buffer_must_have_initial_capacity/StringBufferMustHaveInitialCapacity.java b/plugins/InspectionGadgets/test/com/siyeh/igtest/performance/string_buffer_must_have_initial_capacity/StringBufferMustHaveInitialCapacity.java
new file mode 100644
index 000000000000..ad367250dba4
--- /dev/null
+++ b/plugins/InspectionGadgets/test/com/siyeh/igtest/performance/string_buffer_must_have_initial_capacity/StringBufferMustHaveInitialCapacity.java
@@ -0,0 +1,13 @@
+package com.siyeh.igtest.performance.string_buffer_must_have_initial_capacity;
+
+class StringBufferMustHaveInitialCapacity {
+
+ void m() {
+ new <warning descr="'new StringBuffer()' without initial capacity">StringBuffer</warning>();
+ new StringBuffer(3);
+ new StringBuffer("foo");
+ new <warning descr="'new StringBuilder()' without initial capacity">StringBuilder</warning>();
+ new StringBuilder(3);
+ new StringBuilder("foo"); }
+
+} \ No newline at end of file
diff --git a/plugins/InspectionGadgets/test/com/siyeh/igtest/security/ArchaicSystemPropertiesAccessInspection.java b/plugins/InspectionGadgets/test/com/siyeh/igtest/security/ArchaicSystemPropertiesAccessInspection.java
deleted file mode 100644
index bb0721ad2d80..000000000000
--- a/plugins/InspectionGadgets/test/com/siyeh/igtest/security/ArchaicSystemPropertiesAccessInspection.java
+++ /dev/null
@@ -1,10 +0,0 @@
-package com.siyeh.igtest.security;
-
-public class ArchaicSystemPropertiesAccessInspection{
- public void foo(){
- System.getProperties();
- System.getProperty("foo");
- Integer.getInteger("foo");
- Boolean.getBoolean("foo");
- }
-}
diff --git a/plugins/InspectionGadgets/test/com/siyeh/igtest/style/unnecessarily_qualified_statically_imported_element/methodRef/expected.xml b/plugins/InspectionGadgets/test/com/siyeh/igtest/style/unnecessarily_qualified_statically_imported_element/methodRef/expected.xml
new file mode 100644
index 000000000000..4704d91e891d
--- /dev/null
+++ b/plugins/InspectionGadgets/test/com/siyeh/igtest/style/unnecessarily_qualified_statically_imported_element/methodRef/expected.xml
@@ -0,0 +1,2 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<problems/> \ No newline at end of file
diff --git a/plugins/InspectionGadgets/test/com/siyeh/igtest/style/unnecessarily_qualified_statically_imported_element/methodRef/src/Test.java b/plugins/InspectionGadgets/test/com/siyeh/igtest/style/unnecessarily_qualified_statically_imported_element/methodRef/src/Test.java
new file mode 100644
index 000000000000..cf83f93c82f6
--- /dev/null
+++ b/plugins/InspectionGadgets/test/com/siyeh/igtest/style/unnecessarily_qualified_statically_imported_element/methodRef/src/Test.java
@@ -0,0 +1,8 @@
+import static java.lang.Character.toLowerCase;
+
+public class StaticImport {
+
+ void example() {
+ "".codePoints().map(Character::toLowerCase);
+ }
+} \ No newline at end of file
diff --git a/plugins/InspectionGadgets/test/com/siyeh/igtest/style/unnecessary_parentheses/UnnecessaryParenthesesInspection.java b/plugins/InspectionGadgets/test/com/siyeh/igtest/style/unnecessary_parentheses/UnnecessaryParenthesesInspection.java
index 70695c4e1fff..555bf464523e 100644
--- a/plugins/InspectionGadgets/test/com/siyeh/igtest/style/unnecessary_parentheses/UnnecessaryParenthesesInspection.java
+++ b/plugins/InspectionGadgets/test/com/siyeh/igtest/style/unnecessary_parentheses/UnnecessaryParenthesesInspection.java
@@ -112,4 +112,12 @@ public class UnnecessaryParenthesesInspection
Object info = new Object[]{"abc"};
String s = (String)((Object[])info)[0];
}
+
+ void zz() {
+ int a = 10;
+ int b = 20;
+
+ final int i = a * ((b + 2) / 3); // no warn
+ final int j = a * ((b + 2) % 3); // no warn
+ }
}
diff --git a/plugins/InspectionGadgets/test/com/siyeh/igtest/style/unnecessary_tostring/UnnecessaryToString.java b/plugins/InspectionGadgets/test/com/siyeh/igtest/style/unnecessary_tostring/UnnecessaryToString.java
index 6482a19423bc..155b24f4755a 100644
--- a/plugins/InspectionGadgets/test/com/siyeh/igtest/style/unnecessary_tostring/UnnecessaryToString.java
+++ b/plugins/InspectionGadgets/test/com/siyeh/igtest/style/unnecessary_tostring/UnnecessaryToString.java
@@ -35,4 +35,15 @@ public class UnnecessaryToString {
static void foo(String s) {
System.out.println(s);
}
+
+ class A {
+ public String toString() {
+ return "A";
+ }
+ }
+ class B extends A {
+ public String toString() {
+ return "B" + super.toString();
+ }
+ }
} \ No newline at end of file
diff --git a/plugins/InspectionGadgets/test/com/siyeh/igtest/style/unqualified_inner_class_access/Test.java b/plugins/InspectionGadgets/test/com/siyeh/igtest/style/unqualified_inner_class_access/Test.java
index c32ed5249be8..a12fa73e1fba 100644
--- a/plugins/InspectionGadgets/test/com/siyeh/igtest/style/unqualified_inner_class_access/Test.java
+++ b/plugins/InspectionGadgets/test/com/siyeh/igtest/style/unqualified_inner_class_access/Test.java
@@ -1,7 +1,7 @@
package com.siyeh.igtest.style.unqualified_inner_class_access;
import java.util.Map.Entry;
-
+import com.siyeh.igtest.style.unqualified_inner_class_access.A.X;
public class Test<T> {
private Class<Entry> entryClass;
@@ -22,4 +22,9 @@ class A {
}
class B extends A {
void foo(X x) {}
+}
+class C {
+ void m(X x) {
+ new A().new X();
+ }
} \ No newline at end of file
diff --git a/plugins/InspectionGadgets/test/com/siyeh/igtest/style/unqualified_inner_class_access/expected.xml b/plugins/InspectionGadgets/test/com/siyeh/igtest/style/unqualified_inner_class_access/expected.xml
index 2bc83c222f5c..2e6c566fd7e3 100644
--- a/plugins/InspectionGadgets/test/com/siyeh/igtest/style/unqualified_inner_class_access/expected.xml
+++ b/plugins/InspectionGadgets/test/com/siyeh/igtest/style/unqualified_inner_class_access/expected.xml
@@ -21,4 +21,10 @@
<description>&lt;code&gt;Entry&lt;/code&gt; is not qualified with outer class #loc</description>
</problem>
+ <problem>
+ <file>Test.java</file>
+ <line>27</line>
+ <problem_class severity="WARNING" attribute_key="WARNING_ATTRIBUTES">Unqualified inner class access</problem_class>
+ <description>&lt;code&gt;X&lt;/code&gt; is not qualified with outer class #loc</description>
+ </problem>
</problems> \ No newline at end of file
diff --git a/plugins/InspectionGadgets/test/com/siyeh/igtest/threading/defaultRun/LambdaExpr.java b/plugins/InspectionGadgets/test/com/siyeh/igtest/threading/defaultRun/LambdaExpr.java
new file mode 100644
index 000000000000..453a9e956bbc
--- /dev/null
+++ b/plugins/InspectionGadgets/test/com/siyeh/igtest/threading/defaultRun/LambdaExpr.java
@@ -0,0 +1,6 @@
+package com.siyeh.igtest.threading.defaultRun;
+class Test {
+ {
+ new Thread(() -> System.out.println("hello")).start();
+ }
+} \ No newline at end of file
diff --git a/plugins/InspectionGadgets/test/com/siyeh/igtest/threading/defaultRun/expected.xml b/plugins/InspectionGadgets/test/com/siyeh/igtest/threading/defaultRun/expected.xml
new file mode 100644
index 000000000000..216a575c3ed4
--- /dev/null
+++ b/plugins/InspectionGadgets/test/com/siyeh/igtest/threading/defaultRun/expected.xml
@@ -0,0 +1 @@
+<problems/> \ No newline at end of file
diff --git a/plugins/InspectionGadgets/test/com/siyeh/igtest/visibility/TypeParameterHidesVisibleTypeInspection.java b/plugins/InspectionGadgets/test/com/siyeh/igtest/visibility/TypeParameterHidesVisibleTypeInspection.java
deleted file mode 100644
index b5faef7702d5..000000000000
--- a/plugins/InspectionGadgets/test/com/siyeh/igtest/visibility/TypeParameterHidesVisibleTypeInspection.java
+++ /dev/null
@@ -1,13 +0,0 @@
-package com.siyeh.igtest.visibility;
-import java.util.*;
-
-public abstract class TypeParameterHidesVisibleTypeInspection<List> {
- private Map map = new HashMap();
-
- public abstract List foo();
-
- public abstract <Set> Set bar();
- public abstract <TypeParameterHidesVisibleTypeInspection> TypeParameterHidesVisibleTypeInspection baz();
- public abstract <InputStream> InputStream baz3();
- public abstract <A> A baz2();
-}