--- old/src/share/classes/com/sun/tools/javac/code/Types.java 2013-06-13 15:14:41.109334524 -0400 +++ new/src/share/classes/com/sun/tools/javac/code/Types.java 2013-06-13 15:14:40.984333149 -0400 @@ -1317,6 +1317,26 @@ } // + /** + * Can t and s be compared for equality? Any primitive == + * primitive or primitive == object comparisons here are an error. + * Unboxing and correct primitive == primitive comparisons are + * already dealt with in Attr.visitBinary. + * + */ + public boolean isEqualityComparable(Type s, Type t, Warner warn) { + if (t.isNumeric() && s.isNumeric()) + return true; + + boolean tPrimitive = t.isPrimitive(); + boolean sPrimitive = s.isPrimitive(); + if (!tPrimitive && !sPrimitive) { + return isCastable(s, t, warn) || isCastable(t, s, warn); + } else { + return false; + } + } + // public boolean isCastable(Type t, Type s) { return isCastable(t, s, noWarnings);