Post

@EclipseJavaIDE No. The overflow is neither detected during compile time nor does it change the type from Integer to long in any way and is thus irrelevant for overload resolution
English

@EclipseJavaIDE @java i think the more interesting thing is that Integer.MAX_VALUE+1 equals Integer.MIN_VALUE and vice versa. Ohhhh feel the #nerdgasm of #2scomplement
English

@EclipseJavaIDE Integer.MAX_VALUE + 1 should overflow but still be an integer, so "No".
English

@EclipseJavaIDE NO... When overloading the compiler will do the following checks
[1] check Exact match by type. (if not found)
[2] check larger primitive type. (if not found)
[3] check Autoboxed type (if not)
[4] use Varargs... (ELAV)
English

@EclipseJavaIDE @java No, overflow on Max value, will still be ints, no longs
English

@EclipseJavaIDE @java No
Overflowing an integer type doesn't cast it to a long
English

@EclipseJavaIDE The result is No because :
1) Integer.MAX_VALUE+1 => Integer.MIN_VALUE
Integer.MIN_VALUE-1 => Integer.MAX_VALUE
2) Autoboxing is preferred than ellipsis argument
English

@EclipseJavaIDE @java I think No, overflow does not make it long. It is int again.
English

@EclipseJavaIDE @EclipseFdn Yes, Integer.MAX_VALUE + 1 is automatically a long value
English

@EclipseJavaIDE That's evil 😀
I think it's "No". The constant value 1 is int, so I think it will rollover on Integer. There is no longs values to cast to long.
English
























