Rafael Winterhalter
Rafael Winterhalter
This does not look right from the error message. Was it not `replacementForResponseCode` you wanted to substitute with?
Can you try with a trivial class: public class Sample { public static int replacementForResponseCode(URLConnection connection) { return 0; } } That is what should do the trick.
You can stack them. This is the most effective way anyways.
Have a looke at the replacement chain where you can add methods with custom arguments, based on annotation.
That is expected. Use ClassLoadingStrategy.UsingLookup instead. Injection used unsafe what is restricted on that version.
It's strict encapsulation that is enforced with Java 21.
The first line will break the second. With reset, you undo the instrumentation by transforming back the classes. By removing the transformer, you will simply no longer transform classes later.
You want to use `Advice` as decorator via `builder.visit(...)`. Then the code is inlined. Generally speaking, I recommend against intercepting such a central class, though, as Byte Buddy relies on...
You'd have to avoid them manually, for example by checking the call site's stack and to suppress your modifications. Byte Buddy does not interfere with this as it is only...
You need to register an ignore matcher that allows for intercepting the boot loader. Check the ignore step in the builder API.