For example passing 2.5d and 2f to a calculation expected to return Integer seems fine to me, and I would expect the result of (int) (2.5d * 2f) to be 5.
This is OK as you’ve written it, because the narrowing type conversion is explicit. But that’s not the case in the examples we’re considering. For example, Java doesn’t let you write:
And quite rightly so. Your example of ?1 * ?2 is actually the exceptional case because here both sides of the numeric operator have unknown types, so no type can be inferred. |