ALL compile ok, and give the right result. So why is equality "==" incomparable, but >, <, >=, <= are comparable?
When you compare with the == operator, the compiler is assuming that you are trying to compare whether the references are pointing to the same instance. And since there is no way that a Long reference can point to something that is pointed to by an Integer reference, and vice versa, it generates a compile error.
When you compare with the other operators, the compiler is assuming that you are trying to compare the values, as there is no way to compare references in that regard. And the objects are unboxed and then compared.