On Thu, 20 Apr 2023 08:24:40 GMT, Adam Sotona <asot...@openjdk.org> wrote:
>> src/java.base/share/classes/jdk/internal/classfile/impl/BufWriterImpl.java >> line 86: >> >>> 84: } >>> 85: >>> 86: public void setMajorVersion(int majorVersion) { >> >> We should ensure the version is not changed once writing has already >> happened, and the constant pool builder should have access to the major >> version as well to prevent writing of invalid entries (like condy before >> java 11) > > The class version is set into the BufWriterImpl at the last stage and user > cannot affect it later. > > For the invalid entries I would like to see a use case where it may happen > unintentionally. Otherwise the Classfile API is not a spec-enforcing library. > The library should guide to create valid classfile with minimal effort (using > defaults), however it should also allow to construct whatever classfile, if > it is user intention. the version field is now final ------------- PR Review Comment: https://git.openjdk.org/jdk/pull/13478#discussion_r1176237298