Java would get an API for processing Java class information, beneath a proposal afoot in the Java neighborhood.
The draft classfile API proposal calls for provision of an API for parsing, building, and transforming Java course information. This classfile library at first would provide as an interior substitute for the ASM Java bytecode manipulation framework. Sooner or later, ASM would be eradicated solely from the JDK.
The classfile API proposal notes that class file technology, parsing, and instrumentation are ubiquitous in the Java ecosystem, with several tools and libraries needing to process class data files. Frameworks normally perform on-the-fly bytecode instrumentation. The JDK, the proposal states, really should give an accurate, entire, up-to-day, performant API for looking at, producing, and transforming Java class documents.
Design objectives and rules for the API include obtaining all course file entities, these as solutions and fields, represented by immutable objects. Person-driven navigation also is a purpose. Motivating the connect with for a Java classfile library are factors including:
- JDK consolidation, with the JDK alone major in working with class data files. And there is a hold off inherent in the JDK’s use of ASM.
- Model skew in between frameworks and managing the JDK. Purposes and frameworks processing class documents ordinarily bundle a classfile library these types of as ASM. But simply because new course file capabilities can look in any release of the JDK, purposes and frameworks are a lot more routinely encountering course documents that are newer than the library they are bundled with, ensuing in runtime errors or in frameworks seeking to parse class file formats from the long term. Developers want a classfile library that will be up-to-date with functioning the JDK.
- The JVM and course file format now are evolving a lot quicker than in advance of. Though some evolutions are straightforward, many others are far more complicated, this sort of as Undertaking Valhalla bringing forth new bytecodes, industry descriptors, and verification rules.
- The language has enhanced considerably given that ASM was published.
Strategies simply call for initially replacing ASM as a runtime dependency of the JDK without the need of unacceptable loss of overall performance. One more target would be to swap the inside classreader library employed by the compiler and JDK tools. Eventually, a array of frameworks and programs should be equipped to use the library as an choice to ASM, cglib, and other bytecode libraries.
Copyright © 2022 IDG Communications, Inc.