Closed dogourd closed 4 months ago
You can set DECORATE as initialization: https://github.com/raphw/byte-buddy/blob/master/byte-buddy-maven-plugin/src/main/java/net/bytebuddy/build/maven/ByteBuddyMojo.java#L151
As for the synthetic methods, you can define .ignore(none()) on the agent builder to include them for delegation.
You can set DECORATE as initialization: https://github.com/raphw/byte-buddy/blob/master/byte-buddy-maven-plugin/src/main/java/net/bytebuddy/build/maven/ByteBuddyMojo.java#L151
This works great! Now the plugin is functioning as I expected.
As for the synthetic methods, you can define .ignore(none()) on the agent builder to include them for delegation.
I'm not sure what this means. I'm not using AgentBuilder
here, and from what I understand after looking through the API, ignore(none())
in the context of AgentBuilder
is used to ignore type matches, not methods. If you're referring to DynamicType.Builder#ignoreAlso(none())
, I tried running it once, and it didn't seem to work.
It worked too, use ByteBuddy().ignore(none())
When using
rebase
orredefine
, instructions within synthetic methods are not successfully replaced. However, usingdecorate
works fine.After some debugging, I discovered that it seems like the target method is ignored during the
MethodRegistry.prepare
execution stage when calling thetoTypeWriter
method.Currently, the
byte-buddy-maven-plugin
seems to be using therebase
strategy, and I haven't found an effective parameter to control this option yet, which is limiting some of my plugin's functionality.Below is a code example to reproduce this issue. I've saved the class files generated by these three methods in the execution directory. You can check the
GETSTATIC
instruction within theaccess$000
method to see the difference.