title: Java: removing "Comparable is a raw type" warning
body: <p>Suppose I have a method called foo taking 2 Object as parameter. Both objects are of the same type and both implements comparable interface.</p>
  
  <pre><code>void foo(Object first, Object second){
  
      if (!first.getClass().isInstance(second))   //first and second of the same type
          return;
  
      Comparable firstComparable = (Comparable)first;  //WARNING
      Comparable secondComparable = (Comparable)second;  //WARNING
  
      int diff = firstComparable.compareTo(secondComparable);  //WARNING
  }
  </code></pre>
  
  <p>The first 2 warning are:</p>
  
  <blockquote>
    <p>Comparable is a raw type. References to generic type Comparable
    should be parameterized</p>
  </blockquote>
  
  <p>The last warning:</p>
  
  <blockquote>
    <p>Type safety: The method compareTo(Object) belongs to the raw type
    Comparable. References to   generic type Comparable should be
    parameterized</p>
  </blockquote>
  
  <p>How could I refactor my code in order to remove these warnings?</p>
  
  <p>EDIT:
  Can I do that without changing foo method's signature?</p>