Reputation: 927
As the title reads, can I redefine the extends
clause when redefining a class using ByteBuddy?
That is, redefining class A
from A extends B
to A extends C
for example.
I've read the javadoc and it only suggests a DynamicType.Builder.implement
mechanism which only accepts additional interfaces, but it's not for superclasses.
Is there someone tried this?
thanks.
Upvotes: 1
Views: 215
Reputation: 44007
That's a rather difficult translation as this affects a significant portion of the class when it comes to super class access and super method calls.
You can register a ClassVisitorWrapper
and change the property using ASM on the ClassVisitor
's visit method.
Upvotes: 1