RFR: 8299505: findVirtual on array classes incorrectly restricts the receiver type
Mandy Chung
mchung at openjdk.org
Tue May 30 23:47:59 UTC 2023
On Tue, 30 May 2023 23:38:16 GMT, Mandy Chung <mchung at openjdk.org> wrote:
>> The access hack for array class clone is only applied to `checkAccess` but missing before call to `restrictProtectedReceiver`, causing the array receiver type to be incorrectly replaced by the lookupClass type. This patch fixes that and adds a test to ensure an original lookup resolves `clone` for both array classes (public) and Object (inherited protected) correctly, and restores the old MethodHandlesGeneralTest from [JDK-8001105](https://bugs.openjdk.org/browse/JDK-8001105) which ensures correctness for publicLookup (which is already correct).
>
> test/jdk/java/lang/invoke/findVirtual/FindVirtualArrayCloneTest.java line 28:
>
>> 26: * @bug 8299505
>> 27: * @run junit FindVirtualArrayCloneTest
>> 28: * @summary Ensures Arrays' clone doesn't have incorrect receiver type bound
>
> Suggestion:
>
> * @summary Test invocation of Object.clone for arrays
Can you add test cases to verify that the invocation of `Object.clone` returns an array object with correct content for completeness?
-------------
PR Review Comment: https://git.openjdk.org/jdk/pull/13855#discussion_r1210936985
More information about the core-libs-dev
mailing list