I have a class called Client, it is extending Connection class, I want to make a class called KConnection which extends Connection class, and I want that the parent of the Client should not be Connection but it should be KConnection using bytebuddy agent in the premain using AgentBuilder(). something like this
new AgentBuilder.Default()
.type(ElementMatchers.named("Client"))
.transform(new AgentBuilder.Transformer() {
@Override
public DynamicType.Builder<?> transform(DynamicType.Builder<?> builder, TypeDescription typeDescription, ClassLoader classLoader) {
return builder.superclass(KConnection.class);
}
})
.installOn(inst);
Can anyone guide me over here..?
I have reached out to the byte-buddy git hub issues and it was solved. Attaching reference .