On Fri, 3 Feb 2023 18:07:27 GMT, Maurizio Cimadamore <mcimadam...@openjdk.org> 
wrote:

>> src/java.base/share/classes/jdk/internal/classfile/Classfile.java line 346:
>> 
>>> 344:     public static final int MAGIC_NUMBER = 0xCAFEBABE;
>>> 345: 
>>> 346:     public static final int NOP             = 0;
>> 
>> Not sure how I feel about the constants being here. It seems to me that they 
>> can be moved to more appropriate places - e.g. Instructor, TypeAnnotation 
>> (for the TAT ones), ConstantPool (for the TAG ones).
>> 
>> The classfile versions, OTOH, do seem to belong here.
>
> Actually, we also have a ClassfileVersion class, so that could be a better 
> place for version numbers?

There were several iterations of "where to store numeric constants".
It is hard to find them when spread across many classes and duplicities appear 
instantly.
Dedicated "Constants" would be another bikeshed with conflicting name.
Co-location in Classfile was the latest decission as it is not just a central 
bikeshed, but it also reflect connection with classfile specification.
Please raise that discussion at classfile-api-dev at openjdk.org if necessary.

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

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

Reply via email to