Java is promoting it correctly, otherwise there would be quite a lot of code that would be problematic :-)
Section 5.1.2 of the Java language specification describes this in detail:
The following 19 specific transformations for primitive types are called expanding primitive transformations:
byte to short, int, long, float, or double short to int, long, float, or double char to int, long, float, or double int to long, float, or double long to float or double float to double
Extension of primitive transformations does not lose information about the total value of a numerical value. Indeed, conversions expanding from an integral type to another integral type and from float to double do not lose any information at all; the numerical value is stored exactly. Conversions that expand from float to double in strictfp expressions also accurately preserve the numeric value; however, such conversions that are not strictfp may lose information about the total amount of convertible value.
Converting an int or long value for a float or a long value to double can lead to a loss of precision, that is, the result may lose some of the least significant bits of the value. In this case, the resulting floating point value will be a correctly rounded version of the integer value using IEEE 754 close to the closest.
Converting from a 32-bit Java int to double (which in Java has more than 50 bits of precision) will not lose value or any precision. If the constant you are using is forcibly bound to long because of its value, you may lose precision because long has 64 bits of precision.
source share