On Thu, 30 Jul 2026 20:42:04 GMT, Coleen Phillimore <[email protected]> wrote:
>> Introduce an instance method, `isClassOrInterface`, to `java.lang.Class` and >> `java.lang.invoke.TypeDescriptor$OfField`. >> >> `java.lang.constant.ClassDesc` comes with an `isClassOrInterface` method. It >> turns out that such a check is frequently needed in the use of `Class` >> objects, usually as `isArray() || isPrimitive()` or `!isArray() && >> !isPrimitive()`, with 14 occurrences in various reflective code. >> >> In addition, `Class` can offer a more efficient implementation than two >> checks: it can perform a single bit pattern check to derive this result, >> making such an API more feasible. >> >> --------- >> - [x] I confirm that I make this contribution in accordance with the >> [OpenJDK Interim AI Policy](https://openjdk.org/legal/ai). > > You're right, there are a lot of these occurrences. I'll wait for this one > to be checked in and then rework > [mine](https://github.com/openjdk/jdk/pull/32086). @coleenp You should go ahead; this patch requires a CSR, which can take a while, and I know there are valhalla uses that this patch can update (in `ValueClass.isStrictInstanceField`), so I need to update anyways. ------------- PR Comment: https://git.openjdk.org/jdk/pull/32109#issuecomment-5136276495
