RFR: 8303930: Fix ConstantUtils.skipOverFieldSignature void case return value [v3]

Mandy Chung mchung at openjdk.org
Thu Mar 30 23:51:18 UTC 2023


On Tue, 21 Mar 2023 20:21:23 GMT, Chen Liang <liach at openjdk.org> wrote:

>> This typo doesn't allow creation of malformed ClassDesc or MethodTypeDesc, but it produces an erroneous exception on certain inputs. Running `java.lang.constant.MethodTypeDesc.ofDescriptor("(IIIII[[[V)I")` in Jshell 19.0.2 throws StringIndexOutOfBoundsException, and throws IllegalArgumentException in the Jshell for this patch.
>
> Chen Liang has updated the pull request with a new target base due to a merge or a rebase. The incremental webrev excludes the unrelated changes brought in by the merge/rebase. The pull request contains five additional commits since the last revision:
> 
>  - Merge branch 'master' of https://git.openjdk.java.net/jdk into 8303930
>  - Add test for skipOverFieldSignature bug
>  - Merge branch 'master' of https://git.openjdk.java.net/jdk into 8303930
>  - Copyright year
>  - 8303930: Fix ConstantUtils.skipOverFieldSignature void case return value

Otherwise, looks good.

test/jdk/java/lang/constant/boottest/java.base/java/lang/constant/ConstantUtilsTest.java line 73:

> 71:     public void testSkipOverFieldSignatureVoid() {
> 72:        int ret = ConstantUtils.skipOverFieldSignature("(V)V", 1, 4, false);
> 73:        assertEquals(ret, 0, "Descriptor Length of (V)V starting at index 1, void disallowed");

I think you mean:

Suggestion:

       assertEquals(ret, 0, "Descriptor of (V)V starting at index 1, void disallowed");

-------------

PR Review: https://git.openjdk.org/jdk/pull/12964#pullrequestreview-1366077560
PR Review Comment: https://git.openjdk.org/jdk/pull/12964#discussion_r1153889851


More information about the core-libs-dev mailing list