On Nov 7, 2017, at 12:59 PM, John Rose <john.r.r...@oracle.com> wrote: > > For condy, having the BSM validate types is a code smell > for the reason you mention. Also, when primitives (and value > types) are in the mix, people usually code the validation > incorrectly, since Class.isInstance is the wrong tool, and > the right tool is non-obvious (MHs.identity.asType).
For the record, here is a method that performs the correct conversions: https://bugs.openjdk.java.net/browse/JDK-8190982 The bug suggests that it be called Class::convert. The code itself is simple enough to cut-n-paste into your own BSMs. — John