RFR: 8323707: Adjust Classfile API's type arg model to better represent the embodied type [v2]

David M. Lloyd duke at openjdk.org
Mon Feb 19 15:31:00 UTC 2024


On Mon, 15 Jan 2024 02:30:39 GMT, ExE Boss <duke at openjdk.org> wrote:

>> Chen Liang has updated the pull request with a new target base due to a merge or a rebase. The pull request now contains ten commits:
>> 
>>  - Merge branch 'master' into fix/typearg-model
>>  - redundant line
>>  - Fix a test in langtools, copyright year
>>  - Merge branch 'master' of https://github.com/openjdk/jdk into fix/typearg-model
>>  - Implementation cleanup, test update
>>  - Merge branch 'master' into fix/typearg-model
>>  - Formatting
>>  - Nuke signatureString and fix test fialure from bad cast
>>  - Adjust the type arg model to better represent the embodied type
>
> src/java.base/share/classes/java/lang/classfile/Signature.java line 219:
> 
>> 217:                  * no wildcard (empty), an exact type
>> 218:                  */
>> 219:                 DEFAULT,
> 
> I’m personally in favour of naming this `NONE`.

A belated +1 to this, at least not calling it `DEFAULT` because that has at best no meaning, and at worst it's outright confusing. If not `NONE`, then what about `EXACT`?

In my own old parsing code I have an enum called `Variance` with values `INVARIANT`, `COVARIANT`, and `CONTRAVARIANT`, but that might be a bit confusing considering that `EXTENDS` and `SUPER` match the Java language keywords directly.

As an aside, the javadoc here could be a little better IMO.

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

PR Review Comment: https://git.openjdk.org/jdk/pull/16517#discussion_r1494726792


More information about the core-libs-dev mailing list