quarkusio / gizmo

Apache License 2.0
52 stars 41 forks source link

Introduce ClassTransformer #158

Closed Ladicek closed 1 year ago

Ladicek commented 1 year ago

This supersedes #157, so I added all the original reviewers.

Ladicek commented 1 year ago

FYI, I added one more commit that adds ClassTransformer.addInterface() and allows using enumSwitch(). It's an extra commit for easier review. I can drop the addInterface() stuff, I added that just to make testing easier, but I also thought it could be useful.

mkouba commented 1 year ago

FYI, I added one more commit that adds ClassTransformer.addInterface() and allows using enumSwitch(). It's an extra commit for easier review. I can drop the addInterface() stuff, I added that just to make testing easier, but I also thought it could be useful.

Nice!

Ladicek commented 1 year ago

Added one more commit that allows adding/removing modifiers from the class, its methods and fields.

EDIT: this is because I'm experimenting with ClassTransformer in ArC, and modifying modifiers is the most common bytecode transformation ArC does.

Ladicek commented 1 year ago

After talking to @mkouba, I added another commit to simplify the API (and implementation) of method/field modifications.

Ladicek commented 1 year ago

I believe this is ready for merge now. The set of transformations is small, but is good enough to cover all the use cases of ArC. More can be added relatively easily.

Hence, I squashed the intermediary commits.