--- old/src/java.desktop/share/classes/java/awt/image/ColorModel.java 2016-04-13 13:49:42.731441000 +0530 +++ new/src/java.desktop/share/classes/java/awt/image/ColorModel.java 2016-04-13 13:49:42.135143000 +0530 @@ -31,7 +31,7 @@ import sun.java2d.cmm.CMSManager; import sun.java2d.cmm.ColorTransform; import sun.java2d.cmm.PCMM; -import java.awt.Toolkit; +import java.util.Arrays; import java.util.Collections; import java.util.Map; import java.util.WeakHashMap; @@ -1449,6 +1449,7 @@ * is an instance of {@code ColorModel} and equals this * {@code ColorModel}; {@code false} otherwise. */ + @Override public boolean equals(Object obj) { if (!(obj instanceof ColorModel)) { return false; @@ -1487,23 +1488,16 @@ * * @return a hash code for this ColorModel. */ + @Override public int hashCode() { - - int result = 0; - - result = (supportsAlpha ? 2 : 3) + - (isAlphaPremultiplied ? 4 : 5) + - pixel_bits * 6 + - transparency * 7 + - numComponents * 8; - - if (nBits != null) { - for (int i = 0; i < numComponents; i++) { - result = result + nBits[i] * (i + 9); - } - } - - return result; + int hash = 7; + hash = 89 * hash + this.pixel_bits; + hash = 89 * hash + Arrays.hashCode(this.nBits); + hash = 89 * hash + this.transparency; + hash = 89 * hash + (this.supportsAlpha ? 1 : 0); + hash = 89 * hash + (this.isAlphaPremultiplied ? 1 : 0); + hash = 89 * hash + this.numComponents; + return hash; } /**