compare method violates its general contract exception java 7
<p>Below code throws "Java Comparison method violates its general contract" when run on Java 6. But, on Java 7 it does not throw the same exception. what is the issue?. How can this code be modified to throw the exception on Java 7 as well?.</p>

<pre><code>class ComparableScore implements Comparable&lt;ComparableScore&gt; {

    private int score;
    private String itemName;

    int getScore() {
        return score;
    }

    void setScore(int i) {
        score = i;
    }

    String getItemName() {
        return itemName;
    }

    void setItemName(String str) {
        itemName = str;
    }

    public int compareTo(ComparableScore another) {
        if (score == another.getScore())
            return this.getItemName()
                    .compareToIgnoreCase(another.getItemName());
        else if ((score) &gt; another.getScore())
            return 1;
        else
            return -1;
    }

    @Override
    public boolean equals(Object o) {
        final ComparableScore other = (ComparableScore) o;

        if (score == other.getScore()
                &amp;&amp; this.getItemName().equalsIgnoreCase(other.getItemName()))
            return true;
        else
            return false;
    }
}
</code></pre>
