The CSR for this patch is now Approved, so it looks like this patch is
ready to be sponsored.
Here are the relevant links again.
Bug: https://bugs.openjdk.java.net/browse/JDK-8241100
CSR: https://bugs.openjdk.java.net/browse/JDK-8241667
Patch: http://cr.openjdk.java.net/~jvernee/8241100/webrev.04/
Thanks,
Jorn
On 18/03/2020 15:08, Jorn Vernee wrote:
Hi,
Can someone please sponsor this patch that makes Boolean, Character,
Byte, and Short implement Constable?
Bug: https://bugs.openjdk.java.net/browse/JDK-8241100
Webrev: http://cr.openjdk.java.net/~jvernee/8241100/webrev.00/
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
Thanks,
Jorn