Feb 11

JSR 202, JavaTM Class File Specification Update, is one of the JSRs being added to Mustang, the next J2SE which is to be released this August, according to its current roadmap.

The JSR will introduce faster class loading during runtime thanks to a technique found by the CLDC team, as said in the JSR:

As part of the development of the Connected Limited Device Confguration (CLDC) the CLDC team wished to avoid the time and space penalties of performing full verification within small devices. They therefore developed a “split verifier” which split the verification process into two phases:

  • The first phase can be performed when the class file is being created. It performs a scan of the class file and adds additional “StackMap” attributes to the class file for use by the second phase.
  • The second phase is performed at run-time. The run-time verifier uses the additional StackMap attributes to perform the final class file verification efficiently. The run-time verifier does not rely on the StackMap attributes being valid and will detect and reject any false information.

Unfortunately, I couldn’t find any more information on this by merely googling.

The JSR adds some other improvements to the class file, but this seems to be the major improvement in it. My question is: Why not add Generic type information to the class file? This could serve a lot of purposes, the most important ones being:

  • Reflection Adding the ability to identify which types the generified type is holding, much like an Array reflector knows what is the component type of its cells.
  • Run-Time efficiency Using this information during compilation, some of the casting caused by erasure could be removed, providing faster code.

I wonder why it’s not added.. I’ve downloaded the JSR’s public review document, and I will try and see if I can find a reason. For now, I’ve learned for the first time that the “magic number” of class files (claimed to be the class file’s version – However, it has minor and major version properties) is equal to 0xCAFEBABE. Get it? Cafe babe? Pff.. Engineers..

Related Posts with Thumbnails
Share

Comments are closed.