Planned features of a classfile context object
Brian Goetz
brian.goetz at oracle.com
Thu May 18 14:16:36 UTC 2023
Currently the ConstantPoolBuilder is another place we we attach
options. This was more of a sin of convenience than anything else; the
theory was that if we are transforming a class, we'll parse it with a
set of options, and then generate a new class which shares its CP, and
the options came along for the ride.
Searching for a better name that ClassfileContext. The name Classfile
is too good to waste, but it doesn't represent a classfile (that's
ClassModel), so calling the new thing Classfile would likely be weird.
Also ClassfileContext would make it harder to discover the key entry
points (build/parse). Classfile.Context is better in that it is more
discoverable at least.
Classfile{Parser,Generator} are more discoverable but only tell half the
story, and there's no obvious "first half" of the story.
ClassfileReaderWriter is discoverable and honest but long.
Classfile{Broker,Manager,Mediator} sound like parodies of the Design
Patterns era.
A slightly cheeky but possibly viable option is "Classfiles"; while not
a collection of classfiles, it is a collection of behaviors _about_
classfiles.
Classfiles.of(options).parse(bytes)
Classfiles.of(options).generate(handler)
On 5/17/2023 11:21 AM, Brian Goetz wrote:
> These are basically what is on my list, though I had in mind to move
> _all_ option information to the context, and leave it out of
> individual processing decisions.
>
> On 5/17/2023 9:59 AM, - wrote:
>> Hi,
>> In the discussions a few weeks ago, we envisioned a Classfile context
>> object shared across multiple Classfile processing scenarios, mainly
>> for Class hierarchy information caching.
>>
>> I want to confirm that these are contents of the object, mainly
>> promoted from individual options:
>> - Class Hierarchy information caching
>> - Custom attribute processing
>> - A set of default options, propagated to individual processing (may
>> be overridden classfile-wise)
>>
>> What else is planned for the context object currently? Please don't
>> hesitate to propose. Thanks!
>>
>> Chen Liang
>
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <https://mail.openjdk.org/pipermail/classfile-api-dev/attachments/20230518/c7a8a230/attachment.htm>
More information about the classfile-api-dev
mailing list