Re: RFR: 8332614: Type-checked ConstantPool.entryByIndex and ClassReader.readEntryOrNull [v6]

2024-07-11 Thread duke
On Wed, 29 May 2024 19:27:17 GMT, Chen Liang  wrote:

>> I propose to add type-checked ConstantPool.entryByIndex and 
>> ClassReader.readEntryOrNull taking an extra Class parameter, which throws 
>> ConstantPoolException instead of ClassCastException on type mismatch, which 
>> can happen to malformed ClassFiles.
>> 
>> Requesting a review from @asotona. Thanks!
>> 
>> Proposal on mailing list: 
>> https://mail.openjdk.org/pipermail/classfile-api-dev/2024-May/000512.html
>
> 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 10 additional commits since 
> the last revision:
> 
>  - Add test to validate ClassReader behavior
>  - Merge branch 'master' of https://github.com/openjdk/jdk into 
> feature/entry-by-type
>  - Null-check the entry class eagerly, avoid returning null or throwing IAE
>  - Remove redundant import
>  - Use switch
>  - Merge branch 'master' of https://github.com/openjdk/jdk into 
> feature/entry-by-type
>  - Merge branch 'master' of https://github.com/openjdk/jdk into 
> feature/entry-by-type
>  - Merge branch 'master' of https://github.com/openjdk/jdk into 
> feature/entry-by-type
>  - Use constants, beautify code
>  - 8332614: Type-checked ConstantPool.entryByIndex and 
> ClassReader.readEntryOrNull

@liach 
Your change (at version e9021f24d905741ac1e836c198789c37c368a166) is now ready 
to be sponsored by a Committer.

-

PR Comment: https://git.openjdk.org/jdk/pull/19330#issuecomment-2139368471


Re: RFR: 8332614: Type-checked ConstantPool.entryByIndex and ClassReader.readEntryOrNull [v6]

2024-05-31 Thread David M . Lloyd
On Thu, 30 May 2024 21:47:02 GMT, Chen Liang  wrote:

>> src/java.base/share/classes/java/lang/classfile/ClassReader.java line 142:
>> 
>>> 140:  * @throws ConstantPoolException if the index is out of range of 
>>> the
>>> 141:  * constant pool size, or zero, or the entry is not of the 
>>> given type
>>> 142:  * @since 24
>> 
>> I just noticed that these are marked `@since 24`. Am I correct that this 
>> should be `@since 23`?
>
> Thanks for pointing out, I was under the assumption that this patch might not 
> come into 23. I will create an issue, and you can make a PR if you feel like 
> contributing (doc-only changes can integrate before RDPs so no rush)
> 
> Created an issue at https://bugs.openjdk.org/browse/JDK-812

Opened #19501.

-

PR Review Comment: https://git.openjdk.org/jdk/pull/19330#discussion_r1622391543


Re: RFR: 8332614: Type-checked ConstantPool.entryByIndex and ClassReader.readEntryOrNull [v6]

2024-05-30 Thread Chen Liang
On Thu, 30 May 2024 19:44:29 GMT, David M. Lloyd  wrote:

>> 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 10 additional 
>> commits since the last revision:
>> 
>>  - Add test to validate ClassReader behavior
>>  - Merge branch 'master' of https://github.com/openjdk/jdk into 
>> feature/entry-by-type
>>  - Null-check the entry class eagerly, avoid returning null or throwing IAE
>>  - Remove redundant import
>>  - Use switch
>>  - Merge branch 'master' of https://github.com/openjdk/jdk into 
>> feature/entry-by-type
>>  - Merge branch 'master' of https://github.com/openjdk/jdk into 
>> feature/entry-by-type
>>  - Merge branch 'master' of https://github.com/openjdk/jdk into 
>> feature/entry-by-type
>>  - Use constants, beautify code
>>  - 8332614: Type-checked ConstantPool.entryByIndex and 
>> ClassReader.readEntryOrNull
>
> src/java.base/share/classes/java/lang/classfile/ClassReader.java line 142:
> 
>> 140:  * @throws ConstantPoolException if the index is out of range of the
>> 141:  * constant pool size, or zero, or the entry is not of the 
>> given type
>> 142:  * @since 24
> 
> I just noticed that these are marked `@since 24`. Am I correct that this 
> should be `@since 23`?

Thanks for pointing out, I was under the assumption that this patch might not 
come into 23. I will create an issue, and you can make a PR if you feel like 
contributing (doc-only changes can integrate before RDPs so no rush)

-

PR Review Comment: https://git.openjdk.org/jdk/pull/19330#discussion_r1621460803


Re: RFR: 8332614: Type-checked ConstantPool.entryByIndex and ClassReader.readEntryOrNull [v6]

2024-05-30 Thread David M . Lloyd
On Wed, 29 May 2024 19:27:17 GMT, Chen Liang  wrote:

>> I propose to add type-checked ConstantPool.entryByIndex and 
>> ClassReader.readEntryOrNull taking an extra Class parameter, which throws 
>> ConstantPoolException instead of ClassCastException on type mismatch, which 
>> can happen to malformed ClassFiles.
>> 
>> Requesting a review from @asotona. Thanks!
>> 
>> Proposal on mailing list: 
>> https://mail.openjdk.org/pipermail/classfile-api-dev/2024-May/000512.html
>
> 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 10 additional commits since 
> the last revision:
> 
>  - Add test to validate ClassReader behavior
>  - Merge branch 'master' of https://github.com/openjdk/jdk into 
> feature/entry-by-type
>  - Null-check the entry class eagerly, avoid returning null or throwing IAE
>  - Remove redundant import
>  - Use switch
>  - Merge branch 'master' of https://github.com/openjdk/jdk into 
> feature/entry-by-type
>  - Merge branch 'master' of https://github.com/openjdk/jdk into 
> feature/entry-by-type
>  - Merge branch 'master' of https://github.com/openjdk/jdk into 
> feature/entry-by-type
>  - Use constants, beautify code
>  - 8332614: Type-checked ConstantPool.entryByIndex and 
> ClassReader.readEntryOrNull

src/java.base/share/classes/java/lang/classfile/ClassReader.java line 142:

> 140:  * @throws ConstantPoolException if the index is out of range of the
> 141:  * constant pool size, or zero, or the entry is not of the 
> given type
> 142:  * @since 24

I just noticed that these are marked `@since 24`. Am I correct that this should 
be `@since 23`?

-

PR Review Comment: https://git.openjdk.org/jdk/pull/19330#discussion_r1621350942


Re: RFR: 8332614: Type-checked ConstantPool.entryByIndex and ClassReader.readEntryOrNull [v6]

2024-05-29 Thread Chen Liang
> I propose to add type-checked ConstantPool.entryByIndex and 
> ClassReader.readEntryOrNull taking an extra Class parameter, which throws 
> ConstantPoolException instead of ClassCastException on type mismatch, which 
> can happen to malformed ClassFiles.
> 
> Requesting a review from @asotona. Thanks!
> 
> Proposal on mailing list: 
> https://mail.openjdk.org/pipermail/classfile-api-dev/2024-May/000512.html

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 10 additional commits since the 
last revision:

 - Add test to validate ClassReader behavior
 - Merge branch 'master' of https://github.com/openjdk/jdk into 
feature/entry-by-type
 - Null-check the entry class eagerly, avoid returning null or throwing IAE
 - Remove redundant import
 - Use switch
 - Merge branch 'master' of https://github.com/openjdk/jdk into 
feature/entry-by-type
 - Merge branch 'master' of https://github.com/openjdk/jdk into 
feature/entry-by-type
 - Merge branch 'master' of https://github.com/openjdk/jdk into 
feature/entry-by-type
 - Use constants, beautify code
 - 8332614: Type-checked ConstantPool.entryByIndex and 
ClassReader.readEntryOrNull

-

Changes:
  - all: https://git.openjdk.org/jdk/pull/19330/files
  - new: https://git.openjdk.org/jdk/pull/19330/files/ec56ce98..e9021f24

Webrevs:
 - full: https://webrevs.openjdk.org/?repo=jdk=19330=05
 - incr: https://webrevs.openjdk.org/?repo=jdk=19330=04-05

  Stats: 1876 lines in 41 files changed: 1109 ins; 498 del; 269 mod
  Patch: https://git.openjdk.org/jdk/pull/19330.diff
  Fetch: git fetch https://git.openjdk.org/jdk.git pull/19330/head:pull/19330

PR: https://git.openjdk.org/jdk/pull/19330