On Wed, 19 Apr 2023 17:08:53 GMT, Chen Liang <li...@openjdk.org> wrote:
>> Adam Sotona has updated the pull request incrementally with one additional >> commit since the last revision: >> >> fixed ClassPrinterImpl > > 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. ------------- PR Review Comment: https://git.openjdk.org/jdk/pull/13478#discussion_r1172251297