Allow for Attributes to be read from/written to via different targets than a ClassReader/ClassWriter.

Closed raphw requested to merge raphw/asm:attribute-write into master

For interoperability between ASM and other byte code processors (namely the Classfile API in the OpenJDK), it would become necessary to read and write Attributes from and to different targets then a ClassReader or ClassWriter. Currently, attributes are resolved against a ClassReader or ClassWriter within a protected method what makes it impossible to resolve the byte representation of an attribute from outside ASM. With this binary compatible change, it would become possible to redirect the reading or writing of attributes to any implementation of a ConstantPool(Sink/Source) which can be then be implemented to resolve constant pool indices against a JDK Classfile constant pool instead of a ClassWriter.

I am using this POC for my POC of integrating ASM with the new API. So far it really seems promising to plug ASM into the new API, but Attributes would require an API adjustment. (This is work in progress, but I would appreciate some early feedback, or an alternative suggestion of how to solve this.)


Edited by raphw

Merge request reports