Sponsor Request: 8241100: Make Boolean, Character, Byte, and Short implement Constable
jorn.vernee at oracle.com
Wed Mar 18 14:08:35 UTC 2020
Can someone please sponsor this patch that makes Boolean, Character,
Byte, and Short implement Constable?
Having the other box types implement Constable makes them easier to use
with APIs that accept any Constable. Though I'm mostly interesting in
boolean, for which I'm currently falling back to "true" & "false"
strings, but the downside is that this also requires parsing the string
again and having to deal with random other strings.
This patch also adds the ConstantBootstraps::convert method that is used
to facilitate the conversion from int to (short|char|byte). This
currently takes a source type explicitly. In practice, it seems that
Object can always be used as a source type for the same behavior, but
explicitly specifying source and destination types seems more robust to
me in case this behavior ever changes, or we want to expand on the
supported kinds of conversion. (for instance it is currently not
possible to convert from an int to a Long directly, or from Short to
Integer, but maybe those cases could be supported in the future as well).
Testing: tier1-3 & downstream testing for my particular use case
More information about the core-libs-dev