RFR: 8286391: Address possibly lossy conversions in jdk.compiler

Maurizio Cimadamore mcimadamore at openjdk.java.net
Mon May 23 10:27:56 UTC 2022


On Wed, 11 May 2022 13:20:02 GMT, Adam Sotona <asotona at openjdk.org> wrote:

> This is a part of addressing of all possibly lossy conversions in compound assignments across JDK sources.
> Two cases have been found in jdk.compiler and they are addressed by this patch.
> One case in ClassWriter is resolved by changing local variable from char to int type to avoid multiple implicit and explicit conversions.
> Second case in Code is resolved by making the implicit conversion from int to char explicit.
> 
> Please review.
> 
> Thanks,
> Adam

Looks good. One possible fix for `adjustFlags` could be to declare all the public facing flags (e.g. ABSTRACT, INTERFACE, ...) to use a char/short instead of an int, so that the downstream code could be made tighter if required. But maybe we should attempt that as part of a more general revamp of the flag code.

-------------

Marked as reviewed by mcimadamore (Reviewer).

PR: https://git.openjdk.java.net/jdk/pull/8652


More information about the compiler-dev mailing list