Skip to content

Instantly share code, notes, and snippets.

@joshgord
joshgord / BootstrapAgent.java
Last active November 14, 2020 17:01 — forked from raphw/BootstrapAgent.java
An example agent that intercepts a method of the bootstrap class loader.
package net.bytebuddy;
import net.bytebuddy.agent.ByteBuddyAgent;
import net.bytebuddy.agent.builder.AgentBuilder;
import net.bytebuddy.description.type.TypeDescription;
import net.bytebuddy.dynamic.ClassFileLocator;
import net.bytebuddy.dynamic.DynamicType;
import net.bytebuddy.dynamic.loading.ClassInjector;
import net.bytebuddy.implementation.MethodDelegation;
import net.bytebuddy.implementation.bind.annotation.SuperCall;
whatamidoing
whatamidoing