// Inside your premain/agentmain logic:
AgentBuilder agentBuilder = new AgentBuilder.Default()
.with(AgentBuilder.RedefinitionStrategy.RETRANSFORMATION)
.with(AgentBuilder.TypeStrategy.Default.REDEFINE)
// ADDED: The Listener to track what's happening in Mode 2
.with(new AgentBuilder.Listener.Adapter() {
@Override
public void onTransformation(net.bytebuddy.description.type.TypeDescription typeDescription,
ClassLoader classLoader,
net.bytebuddy.utility.JavaModule module,
boolean loaded,
net.bytebuddy.dynamic.DynamicType dynamicType) {
System.out.println("PROFILER: Successfully transformed " + typeDescription.getName());
}
@Override
public void onError(String typeName,
ClassLoader classLoader,
net.bytebuddy.utility.JavaModule module,
boolean loaded,
Throwable throwable) {
System.err.println("PROFILER ERROR: Failed to transform " + typeName + " -> " + throwable.getMessage());
}
});
for (String className : targetClasses) {
if (className.trim().isEmpty()) continue;
agentBuilder = agentBuilder
.type(ElementMatchers.named(className.trim()))
.transform((builder, td, cl, m) ->
builder.method(ElementMatchers.any()
.and(ElementMatchers.not(ElementMatchers.isAbstract()))
.and(ElementMatchers.not(ElementMatchers.isNative())))
.intercept(MethodDelegation.to(Interceptor.class))
);
}
agentBuilder.installOn(inst);
For further actions, you may consider blocking this person and/or reporting abuse
Top comments (0)