package com.siyeh.igtest.bugs.subtraction_in_compare_to;

public class SubtractionInCompareTo implements java.util.Comparator<SubtractionInCompareTo>
{
    private int m_foo = 3;

    public int compareTo(Object foo)
    {
        final int temp = m_foo + ((SubtractionInCompareTo)foo).m_foo;
        return <warning descr="Subtraction 'm_foo - ((SubtractionInCompareTo)foo).m_foo' in 'compareTo()' may result in overflow errors">m_foo - ((SubtractionInCompareTo)foo).m_foo</warning>;
    }


    @Override
    public int compare(SubtractionInCompareTo o1, SubtractionInCompareTo o2) {
        return <warning descr="Subtraction 'o1.m_foo - o2.m_foo' in 'compareTo()' may result in overflow errors">o1.m_foo - o2.m_foo</warning>;
    }

    {
        java.util.Comparator<String> c = (s1, s2) -> <warning descr="Subtraction 's1.length() - s2.length()' in 'compareTo()' may result in overflow errors">s1.length() - s2.length()</warning>;
    }
}

@@ -51,16 +51,65 @@
 re_to;%0A%0A
+import java.util.Map;%0Aimport java.util.HashMap;%0A%0A
 public c
@@ -818,14 +818,15 @@
 tor%3C
-String
+Integer
 %3E c 
@@ -870,39 +870,21 @@
 tion 's1
-.length() - s2.length()
+ - s2
 ' in 'co
@@ -927,16 +927,149 @@
 rors%22%3Es1
+ - s2%3C/warning%3E;%0A    %7D%0A%7D%0Aclass A implements Comparable%3CA%3E %7B%0A    final String s = %22%22;%0A    public int compareTo(A a) %7B%0A        return s
 .length(
@@ -1072,18 +1072,19 @@
 gth() - 
+a.
 s
-2
 .length(
@@ -1084,26 +1084,16 @@
 length()
-%3C/warning%3E
 ;%0A    %7D%0A
@@ -1086,16 +1086,319 @@
 ngth();%0A    %7D%0A%7D%0A
+class B implements Comparable%3CB%3E %7B%0A    final Map%3CString, String%3E map = new HashMap();%0A    public int compareTo(B b) %7B%0A        return map.size() - b.map.size();%0A    %7D%0A%7D%0Aclass C implements Comparable%3CC%3E %7B%0A    private short small = 1;%0A    public int compareTo(C c) %7B%0A        return small - c.small;%0A    %7D%0A%7D

fix test