ByteBuddy provides LoadedTypeInitializer
but it is not persisted in generated bytecode.
Is it possible to generate a static initialisation block?
class Foo { static { /** Added code here **/ } }
Yes, on the builder:
builder.invokeable(isTypeInitializer()).intercept(...)
This way you can define it just as any static method.