public class Autoboxing { public boolean compare(short s, Integer i) { return i == s; //OK, i is unboxed } public boolean compare(Short s, Integer i) { return i == s; //comparing as references } void f(Integer i) { switch(i) { default: } } { Object data = 1; boolean is1 = data == 1; } //IDEADEV-5549: Short and double are convertible public static double f () { Short s = 0; return (double)s; } //IDEADEV-5613 class DumbTest { private long eventId; public int hashCode() { return ((Long) eventId).hashCode(); } } public static void main(String[] args) { Long l = 0L; Short s = 0; int d = (int)l; d = (int)s; short t = 0; Integer d1 = (Integer) t; Byte b = (Byte) t; } { { boolean cond = true; // test for JLS3 bug, see http://bugs.sun.com/bugdatabase/view_bug.do?bug_id=6888770 Byte B = 0; byte b = 0; byte value = cond ? B : b; ///////// short s = 0; Short S = 0; short rs = cond ? S : s; char c = 0; Character C = 0; char rc = cond ? C : c; boolean bb = cond ? Boolean.FALSE : true; } } }