On Thu, 16 Mar 2023 18:40:12 GMT, Chen Liang <li...@openjdk.org> wrote:
>> https://github.com/openjdk/jdk/pull/13033#issuecomment-1470857327 >> >> Add a test to validate that all constants in ConstantDescs can be resolved >> with a minimally-trusted lookup, and select constants represent the objects >> they claim to be. > > Chen Liang has updated the pull request incrementally with one additional > commit since the last revision: > > Switch to DataProvider > There should probably also be tests for the > [`DirectMethodHandleDesc`](https://docs.oracle.com/en/java/javase/19/docs/api/java.base/java/lang/constant/DirectMethodHandleDesc.html) > fields which inspect the > [`MethodHandleInfo`](https://docs.oracle.com/en/java/javase/19/docs/api/java.base/java/lang/invoke/MethodHandleInfo.html) > obtained using [`MethodHandles::reflectAs(Class, > MethodHandle)`](https://docs.oracle.com/en/java/javase/19/docs/api/java.base/java/lang/invoke/MethodHandles.html#reflectAs(java.lang.Class,java.lang.invoke.MethodHandle)). Don't think this is worth it: 1. This requires extra String literals in the test for method names, which is way more error-prone than the other constant literals checked by the compiler. 2. If a method handle desc is wrong, a typo would usually make the desc invalid than refer to another method, which is already guarded by the second test. ------------- PR: https://git.openjdk.org/jdk/pull/13064