OpenJDK proposal would provide Java class file API


Java would get an API for processing Java class information, less than a proposal afoot in the Java group.

The draft classfile API proposal calls for provision of an API for parsing, building, and reworking Java class data files. This classfile library at first would serve as an inner alternative for the ASM Java bytecode manipulation framework. At some point, ASM would be removed totally from the JDK.

The classfile API proposal notes that course file era, parsing, and instrumentation are ubiquitous in the Java ecosystem, with several instruments and libraries needing to procedure course documents. Frameworks typically accomplish on-the-fly bytecode instrumentation. The JDK, the proposal states, ought to give an correct, entire, up-to-date, performant API for reading through, producing, and reworking Java class documents.

Style objectives and concepts for the API incorporate acquiring all course file entities, these types of as techniques and fields, represented by immutable objects. Consumer-driven navigation also is a goal. Motivating the connect with for a Java classfile library are factors together with:

  • JDK consolidation, with the JDK by itself substantial in working with class files. And there is a delay inherent in the JDK’s use of ASM.
  • Edition skew between frameworks and jogging the JDK. Purposes and frameworks processing class data files commonly bundle a classfile library these as ASM. But due to the fact new class file capabilities can surface in any release of the JDK, apps and frameworks are far more commonly encountering class files that are more recent than the library they are bundled with, resulting in runtime mistakes or in frameworks trying to parse class file formats from the potential. Developers want a classfile library that will be up-to-date with running the JDK.
  • The JVM and course file structure now are evolving more rapidly than before. Although some evolutions are uncomplicated, other people are a lot more intricate, this kind of as Undertaking Valhalla bringing forth new bytecodes, field descriptors, and verification principles.
  • The language has improved considerably considering that ASM was prepared.

Plans call for to begin with changing ASM as a runtime dependency of the JDK with out unacceptable reduction of effectiveness. One more goal would be to swap the inside classreader library employed by the compiler and JDK equipment. Inevitably, a range of frameworks and programs should be in a position to use the library as an choice to ASM, cglib, and other bytecode libraries.

Copyright © 2022 IDG Communications, Inc.


Resource url