You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
This is more tricky than it might seem. If there is a type initializer from before, the above code will work. If not, you will need to add another transformation as:
This will define an empty type initializer. This does however count as changing the method structure, and a redefinition will fail, as the JVM does not allow for that.
I does not want to add a type intializer which will change the class layout, and just need to know there is a type initializer for a type.
I think bytebuddy might add a method such as hasTypeInitializer() to LazyTypeDescription since it is easy to determine this when visiting method in TypeExtractor via ASM.
Does bytebuddy have API to determine TypeInitializer method exists? So I could check it before instrument TypeInitializer as below,
new AgentBuilder.Transformer.ForAdvice().advice( isTypeInitializer(), "TypeInitializerAdvice" );
The text was updated successfully, but these errors were encountered: