RFR: 8286399: Address possibly lossy conversions in JDK Build Tools

Naoto Sato naoto at openjdk.java.net
Fri May 13 22:33:42 UTC 2022


On Fri, 13 May 2022 22:11:17 GMT, Joe Wang <joehw at openjdk.org> wrote:

>> Applied required casts for the upcoming warning. Verified by cherry-picking Adam's patch.
>
> make/jdk/src/classes/build/tools/generatebreakiteratordata/RuleBasedBreakIteratorBuilder.java line 1278:
> 
>> 1276:             state[numCategories] |= (short) END_STATE_FLAG;
>> 1277:             if (sawEarlyBreak) {
>> 1278:                 state[numCategories] |= LOOKAHEAD_STATE_FLAG;
> 
> Does this need a cast as well? and also other cases, e.g. line 1019: state[numCategories] = DONT_LOOP_FLAG;?

No, it doesn't. `LOOKAHEAD_STATE_FLAG` is defined as `0x2000` which is within the range of `short`. OTOH, `END_STATE_FLAG` is `0x8000` thus a lossy conversion.

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

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



More information about the build-dev mailing list