On Tue, 3 Oct 2023 13:19:18 GMT, Aggelos Biboudis <abimpou...@openjdk.org> wrote:
>> src/jdk.compiler/share/classes/com/sun/tools/javac/code/Types.java line 5052: >> >>> 5050: >>> 5051: return (source.isPrimitive() && target.isPrimitive()) && >>> 5052: ((source.hasTag(BYTE) && !target.hasTag(CHAR) || >> >> Does this mean that `byte` -> `char` is not exact? Aren't both integral >> types, thus invalidating `widening from one integral type to another` ? > > Indeed it is not unconditionally exact. byte to char combines both widening > and narrowing primitive conversions > > https://docs.oracle.com/javase/specs/jls/se8/html/jls-5.html#jls-5.1.4 Ha! Of course - the problem is not the definition of "integral type" (which includes `char`), but the fact that there's no widening from `byte` to `char`. I agree that the code (and the spec changes) do the right thing. ------------- PR Review Comment: https://git.openjdk.org/jdk/pull/15638#discussion_r1344261063